Lines Matching refs:pai
142 static int dns_getaddrinfo(const char* name, const addrinfo* pai,
149 static bool files_getaddrinfo(const size_t netid, const char* name, const addrinfo* pai,
182 (ai) = get_ai(pai, (afd), (addr)); \
446 static int explore_fqdn(const addrinfo* pai, const char* hostname, const char* servname, in explore_fqdn() argument
449 assert(pai != nullptr); in explore_fqdn()
458 if ((error = get_portmatch(pai, servname))) return error; in explore_fqdn()
460 if (!files_getaddrinfo(netcontext->dns_netid, hostname, pai, &result)) { in explore_fqdn()
461 error = dns_getaddrinfo(hostname, pai, netcontext, &result, event); in explore_fqdn()
484 static int explore_null(const struct addrinfo* pai, const char* servname, struct addrinfo** res) { in explore_null() argument
493 assert(pai != NULL); in explore_null()
505 s = socket(pai->ai_family, SOCK_DGRAM | SOCK_CLOEXEC, 0); in explore_null()
514 if (get_portmatch(pai, servname) != 0) return 0; in explore_null()
516 afd = find_afd(pai->ai_family); in explore_null()
519 if (pai->ai_flags & AI_PASSIVE) { in explore_null()
539 static int explore_numeric(const struct addrinfo* pai, const char* hostname, const char* servname, in explore_numeric() argument
547 assert(pai != NULL); in explore_numeric()
559 if (get_portmatch(pai, servname) != 0) return 0; in explore_numeric()
561 afd = find_afd(pai->ai_family); in explore_numeric()
565 if (pai->ai_family == afd->a_af || pai->ai_family == PF_UNSPEC /*?*/) { in explore_numeric()
568 if ((pai->ai_flags & AI_CANONNAME)) { in explore_numeric()
574 error = get_canonname(pai, cur->ai_next, canonname); in explore_numeric()
596 static int explore_numeric_scope(const struct addrinfo* pai, const char* hostname, in explore_numeric_scope() argument
606 assert(pai != NULL); in explore_numeric_scope()
614 if (get_portmatch(pai, servname) != 0) return 0; in explore_numeric_scope()
616 afd = find_afd(pai->ai_family); in explore_numeric_scope()
619 if (!afd->a_scoped) return explore_numeric(pai, hostname, servname, res, hostname); in explore_numeric_scope()
622 if (cp == NULL) return explore_numeric(pai, hostname, servname, res, hostname); in explore_numeric_scope()
634 error = explore_numeric(pai, addr, servname, res, hostname); in explore_numeric_scope()
654 static int get_canonname(const struct addrinfo* pai, struct addrinfo* ai, const char* str) { in get_canonname() argument
655 assert(pai != NULL); in get_canonname()
659 if ((pai->ai_flags & AI_CANONNAME) != 0) { in get_canonname()
666 static struct addrinfo* get_ai(const struct addrinfo* pai, const struct afd* afd, in get_ai() argument
671 assert(pai != NULL); in get_ai()
678 memcpy(ai, pai, sizeof(struct addrinfo)); in get_ai()
817 int qtype, const struct addrinfo* pai, int* herrno) { in getanswer() argument
834 assert(pai != NULL); in getanswer()
972 ai = *pai; in getanswer()
991 (void) get_canonname(pai, sentinel.ai_next, qname); in getanswer()
993 (void) get_canonname(pai, sentinel.ai_next, canonname); in getanswer()
1384 static int dns_getaddrinfo(const char* name, const addrinfo* pai, in dns_getaddrinfo() argument
1392 switch (pai->ai_family) { in dns_getaddrinfo()
1398 if (pai->ai_flags & AI_ADDRCONFIG) { in dns_getaddrinfo()
1442 addrinfo* ai = getanswer(q.answer, q.n, q.name, q.qtype, pai, &he); in dns_getaddrinfo()
1448 ai = getanswer(q2.answer, q2.n, q2.name, q2.qtype, pai, &he); in dns_getaddrinfo()
1477 static struct addrinfo* _gethtent(FILE** hostf, const char* name, const struct addrinfo* pai) { in _gethtent() argument
1486 assert(pai != NULL); in _gethtent()
1512 error = getaddrinfo_numeric(addr, nullptr, *pai, &res0); in _gethtent()
1516 res->ai_flags = pai->ai_flags; in _gethtent()
1518 if (pai->ai_flags & AI_CANONNAME) { in _gethtent()
1519 if (get_canonname(pai, res, cname) != 0) { in _gethtent()
1529 const struct addrinfo* _Nonnull pai) { in getCustomHosts() argument
1535 int error = getaddrinfo_numeric(host.c_str(), nullptr, *pai, &res0); in getCustomHosts()
1545 static bool files_getaddrinfo(const size_t netid, const char* name, const addrinfo* pai, in files_getaddrinfo() argument
1553 while ((p = _gethtent(&hostf, name, pai)) != nullptr) { in files_getaddrinfo()
1559 if ((p = getCustomHosts(netid, name, pai)) != nullptr) { in files_getaddrinfo()