diff options
author | Max Kellermann <max@duempel.org> | 2011-09-20 20:51:46 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2011-09-20 21:15:05 +0200 |
commit | 7d9d459ac2c71e0b3598ed0f606cd2d550853838 (patch) | |
tree | 881821c611654010287da59eb27d50cac79a49f5 /src/resolver.h | |
parent | 3ea1073809bf324e5b75fd33d61dcb0422463358 (diff) | |
download | mpd-7d9d459ac2c71e0b3598ed0f606cd2d550853838.tar.gz mpd-7d9d459ac2c71e0b3598ed0f606cd2d550853838.tar.xz mpd-7d9d459ac2c71e0b3598ed0f606cd2d550853838.zip |
resolver: add function resolve_host_port()
Diffstat (limited to '')
-rw-r--r-- | src/resolver.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/resolver.h b/src/resolver.h index 179f8fd75..8d5cb187e 100644 --- a/src/resolver.h +++ b/src/resolver.h @@ -23,6 +23,14 @@ #include <glib.h> struct sockaddr; +struct addrinfo; + +G_GNUC_CONST +static inline GQuark +resolver_quark(void) +{ + return g_quark_from_static_string("resolver"); +} /** * Converts the specified socket address into a string in the form @@ -37,4 +45,19 @@ struct sockaddr; char * sockaddr_to_string(const struct sockaddr *sa, size_t length, GError **error); +/** + * Resolve a specification in the form "host", "host:port", + * "[host]:port". This is a convenience wrapper for getaddrinfo(). + * + * @param default_port a default port number that will be used if none + * is given in the string (if applicable); pass 0 to go without a + * default + * @return an #addrinfo linked list that must be freed with + * freeaddrinfo(), or NULL on error + */ +struct addrinfo * +resolve_host_port(const char *host_port, unsigned default_port, + int flags, int socktype, + GError **error_r); + #endif |