Lines Matching refs:pai

144 static int dns_getaddrinfo(const char* name, const addrinfo* pai,
151 static bool files_getaddrinfo(const size_t netid, const char* name, const addrinfo* pai,
184 (ai) = get_ai(pai, (afd), (addr)); \
462 static int explore_fqdn(const addrinfo* pai, const char* hostname, const char* servname, in explore_fqdn() argument
465 assert(pai != nullptr); in explore_fqdn()
474 if ((error = get_portmatch(pai, servname))) return error; in explore_fqdn()
476 if (!files_getaddrinfo(netcontext->dns_netid, hostname, pai, &result)) { in explore_fqdn()
477 error = dns_getaddrinfo(hostname, pai, netcontext, &result, event); in explore_fqdn()
500 static int explore_null(const struct addrinfo* pai, const char* servname, struct addrinfo** res) { in explore_null() argument
509 assert(pai != NULL); in explore_null()
521 s = socket(pai->ai_family, SOCK_DGRAM | SOCK_CLOEXEC, 0); in explore_null()
530 if (get_portmatch(pai, servname) != 0) return 0; in explore_null()
532 afd = find_afd(pai->ai_family); in explore_null()
535 if (pai->ai_flags & AI_PASSIVE) { in explore_null()
555 static int explore_numeric(const struct addrinfo* pai, const char* hostname, const char* servname, in explore_numeric() argument
563 assert(pai != NULL); in explore_numeric()
575 if (get_portmatch(pai, servname) != 0) return 0; in explore_numeric()
577 afd = find_afd(pai->ai_family); in explore_numeric()
581 if (pai->ai_family == afd->a_af || pai->ai_family == PF_UNSPEC /*?*/) { in explore_numeric()
584 if ((pai->ai_flags & AI_CANONNAME)) { in explore_numeric()
590 error = get_canonname(pai, cur->ai_next, canonname); in explore_numeric()
612 static int explore_numeric_scope(const struct addrinfo* pai, const char* hostname, in explore_numeric_scope() argument
622 assert(pai != NULL); in explore_numeric_scope()
630 if (get_portmatch(pai, servname) != 0) return 0; in explore_numeric_scope()
632 afd = find_afd(pai->ai_family); in explore_numeric_scope()
635 if (!afd->a_scoped) return explore_numeric(pai, hostname, servname, res, hostname); in explore_numeric_scope()
638 if (cp == NULL) return explore_numeric(pai, hostname, servname, res, hostname); in explore_numeric_scope()
650 error = explore_numeric(pai, addr, servname, res, hostname); in explore_numeric_scope()
670 static int get_canonname(const struct addrinfo* pai, struct addrinfo* ai, const char* str) { in get_canonname() argument
671 assert(pai != NULL); in get_canonname()
675 if ((pai->ai_flags & AI_CANONNAME) != 0) { in get_canonname()
682 static struct addrinfo* get_ai(const struct addrinfo* pai, const struct afd* afd, in get_ai() argument
687 assert(pai != NULL); in get_ai()
694 memcpy(ai, pai, sizeof(struct addrinfo)); in get_ai()
842 int qtype, const struct addrinfo* pai, int* herrno) { in getanswer() argument
859 assert(pai != NULL); in getanswer()
997 ai = *pai; in getanswer()
1016 (void) get_canonname(pai, sentinel.ai_next, qname); in getanswer()
1018 (void) get_canonname(pai, sentinel.ai_next, canonname); in getanswer()
1394 static int dns_getaddrinfo(const char* name, const addrinfo* pai, in dns_getaddrinfo() argument
1400 switch (pai->ai_family) { in dns_getaddrinfo()
1406 if (pai->ai_flags & AI_ADDRCONFIG) { in dns_getaddrinfo()
1452 addrinfo* ai = getanswer(q.answer, q.n, q.name, q.qtype, pai, &he); in dns_getaddrinfo()
1458 ai = getanswer(q2.answer, q2.n, q2.name, q2.qtype, pai, &he); in dns_getaddrinfo()
1487 static struct addrinfo* _gethtent(FILE** hostf, const char* name, const struct addrinfo* pai) { in _gethtent() argument
1496 assert(pai != NULL); in _gethtent()
1522 error = getaddrinfo_numeric(addr, nullptr, *pai, &res0); in _gethtent()
1526 res->ai_flags = pai->ai_flags; in _gethtent()
1528 if (pai->ai_flags & AI_CANONNAME) { in _gethtent()
1529 if (get_canonname(pai, res, cname) != 0) { in _gethtent()
1539 const struct addrinfo* _Nonnull pai) { in getCustomHosts() argument
1545 int error = getaddrinfo_numeric(host.c_str(), nullptr, *pai, &res0); in getCustomHosts()
1555 static bool files_getaddrinfo(const size_t netid, const char* name, const addrinfo* pai, in files_getaddrinfo() argument
1563 while ((p = _gethtent(&hostf, name, pai)) != nullptr) { in files_getaddrinfo()
1569 if ((p = getCustomHosts(netid, name, pai)) != nullptr) { in files_getaddrinfo()