aboutsummaryrefslogtreecommitdiff
path: root/src/resolver.h
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2011-09-20 20:51:46 +0200
committerMax Kellermann <max@duempel.org>2011-09-20 21:15:05 +0200
commit7d9d459ac2c71e0b3598ed0f606cd2d550853838 (patch)
tree881821c611654010287da59eb27d50cac79a49f5 /src/resolver.h
parent3ea1073809bf324e5b75fd33d61dcb0422463358 (diff)
resolver: add function resolve_host_port()
Diffstat (limited to 'src/resolver.h')
-rw-r--r--src/resolver.h23
1 files changed, 23 insertions, 0 deletions
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 <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