Lines Matching refs:pai
143 static int dns_getaddrinfo(const char* name, const addrinfo* pai,
148 static bool files_getaddrinfo(const char* name, const addrinfo* pai, addrinfo** res);
180 (ai) = get_ai(pai, (afd), (addr)); \
438 static int explore_fqdn(const struct addrinfo* pai, const char* hostname, const char* servname, in explore_fqdn() argument
443 assert(pai != NULL); in explore_fqdn()
451 if (get_portmatch(pai, servname) != 0) return 0; in explore_fqdn()
453 if (!files_getaddrinfo(hostname, pai, &result)) { in explore_fqdn()
454 error = dns_getaddrinfo(hostname, pai, netcontext, &result); in explore_fqdn()
476 static int explore_null(const struct addrinfo* pai, const char* servname, struct addrinfo** res) { in explore_null() argument
485 assert(pai != NULL); in explore_null()
497 s = socket(pai->ai_family, SOCK_DGRAM | SOCK_CLOEXEC, 0); in explore_null()
506 if (get_portmatch(pai, servname) != 0) return 0; in explore_null()
508 afd = find_afd(pai->ai_family); in explore_null()
511 if (pai->ai_flags & AI_PASSIVE) { in explore_null()
531 static int explore_numeric(const struct addrinfo* pai, const char* hostname, const char* servname, in explore_numeric() argument
539 assert(pai != NULL); in explore_numeric()
551 if (get_portmatch(pai, servname) != 0) return 0; in explore_numeric()
553 afd = find_afd(pai->ai_family); in explore_numeric()
557 if (pai->ai_family == afd->a_af || pai->ai_family == PF_UNSPEC /*?*/) { in explore_numeric()
560 if ((pai->ai_flags & AI_CANONNAME)) { in explore_numeric()
566 error = get_canonname(pai, cur->ai_next, canonname); in explore_numeric()
588 static int explore_numeric_scope(const struct addrinfo* pai, const char* hostname, in explore_numeric_scope() argument
598 assert(pai != NULL); in explore_numeric_scope()
606 if (get_portmatch(pai, servname) != 0) return 0; in explore_numeric_scope()
608 afd = find_afd(pai->ai_family); in explore_numeric_scope()
611 if (!afd->a_scoped) return explore_numeric(pai, hostname, servname, res, hostname); in explore_numeric_scope()
614 if (cp == NULL) return explore_numeric(pai, hostname, servname, res, hostname); in explore_numeric_scope()
626 error = explore_numeric(pai, addr, servname, res, hostname); in explore_numeric_scope()
646 static int get_canonname(const struct addrinfo* pai, struct addrinfo* ai, const char* str) { in get_canonname() argument
647 assert(pai != NULL); in get_canonname()
651 if ((pai->ai_flags & AI_CANONNAME) != 0) { in get_canonname()
658 static struct addrinfo* get_ai(const struct addrinfo* pai, const struct afd* afd, in get_ai() argument
663 assert(pai != NULL); in get_ai()
670 memcpy(ai, pai, sizeof(struct addrinfo)); in get_ai()
829 const struct addrinfo* pai, int* herrno) { in getanswer() argument
848 assert(pai != NULL); in getanswer()
984 ai = *pai; in getanswer()
1003 (void) get_canonname(pai, sentinel.ai_next, qname); in getanswer()
1005 (void) get_canonname(pai, sentinel.ai_next, canonname); in getanswer()
1381 static int dns_getaddrinfo(const char* name, const addrinfo* pai, in dns_getaddrinfo() argument
1389 switch (pai->ai_family) { in dns_getaddrinfo()
1397 if (pai->ai_flags & AI_ADDRCONFIG) { in dns_getaddrinfo()
1456 addrinfo* ai = getanswer(buf.get(), q.n, q.name, q.qtype, pai, &he); in dns_getaddrinfo()
1462 ai = getanswer(buf2.get(), q2.n, q2.name, q2.qtype, pai, &he); in dns_getaddrinfo()
1491 static struct addrinfo* _gethtent(FILE** hostf, const char* name, const struct addrinfo* pai) { in _gethtent() argument
1500 assert(pai != NULL); in _gethtent()
1526 error = getaddrinfo_numeric(addr, nullptr, *pai, &res0); in _gethtent()
1530 res->ai_flags = pai->ai_flags; in _gethtent()
1532 if (pai->ai_flags & AI_CANONNAME) { in _gethtent()
1533 if (get_canonname(pai, res, cname) != 0) { in _gethtent()
1542 static bool files_getaddrinfo(const char* name, const addrinfo* pai, addrinfo** res) { in files_getaddrinfo() argument
1550 while ((p = _gethtent(&hostf, name, pai)) != NULL) { in files_getaddrinfo()