/* Resolves the given hostname or IP address with getaddrinfo, and stores all results into a linked list. The rest of the behavior is same as resolve(). */ int resolve_multi(const char *hostname, unsigned short port, struct sockaddr_list *sl, int af) { int flags; flags = 0; if (o.nodns) flags |= AI_NUMERICHOST; return resolve_internal(hostname, port, sl, af, flags, 1); }
/* Resolves the given hostname or IP address with getaddrinfo, and stores the first result (if any) in *ss and *sslen. The value of port will be set in the appropriate place in *ss; set to 0 if you don't care. af may be AF_UNSPEC, in which case getaddrinfo may return e.g. both IPv4 and IPv6 results; which one is first depends on the system configuration. Returns 0 on success, or a getaddrinfo return code (suitable for passing to gai_strerror) on failure. *ss and *sslen are always defined when this function returns 0. If the global o.nodns is true, then do not resolve any names with DNS. */ int resolve(const char *hostname, unsigned short port, struct sockaddr_storage *ss, size_t *sslen, int af) { int flags; flags = 0; if (o.nodns) flags |= AI_NUMERICHOST; return resolve_internal(hostname, port, ss, sslen, af, flags); }
/* Resolves the given hostname or IP address with getaddrinfo, and stores the first result (if any) in *ss and *sslen. The value of port will be set in the appropriate place in *ss; set to 0 if you don't care. af may be AF_UNSPEC, in which case getaddrinfo may return e.g. both IPv4 and IPv6 results; which one is first depends on the system configuration. Returns 0 on success, or a getaddrinfo return code (suitable for passing to gai_strerror) on failure. *ss and *sslen are always defined when this function returns 0. If the global o.nodns is true, then do not resolve any names with DNS. */ int resolve(const char *hostname, unsigned short port, struct sockaddr_storage *ss, size_t *sslen, int af) { int flags; struct sockaddr_list sl; int result; flags = 0; if (o.nodns) flags |= AI_NUMERICHOST; result = resolve_internal(hostname, port, &sl, af, flags, 0); *ss = sl.addr.storage; *sslen = sl.addrlen; return result; }