From 7d9d459ac2c71e0b3598ed0f606cd2d550853838 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 20 Sep 2011 20:51:46 +0200 Subject: resolver: add function resolve_host_port() --- src/resolver.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/resolver.h') diff --git a/src/resolver.h b/src/resolver.h index 179f8fd7..8d5cb187 100644 --- a/src/resolver.h +++ b/src/resolver.h @@ -23,6 +23,14 @@ #include 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 -- cgit v1.2.3