aboutsummaryrefslogtreecommitdiffstats
path: root/src/socket_util.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/socket_util.h')
-rw-r--r--src/socket_util.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/socket_util.h b/src/socket_util.h
index b54897b99..dc129df40 100644
--- a/src/socket_util.h
+++ b/src/socket_util.h
@@ -43,4 +43,24 @@ struct sockaddr;
char *
sockaddr_to_string(const struct sockaddr *sa, size_t length, GError **error);
+/**
+ * Creates a socket listening on the specified address. This is a
+ * shortcut for socket(), bind() and listen().
+ *
+ * @param domain the socket domain, e.g. PF_INET6
+ * @param type the socket type, e.g. SOCK_STREAM
+ * @param protocol the protocol, usually 0 to let the kernel choose
+ * @param address the address to listen on
+ * @param address_length the size of #address
+ * @param backlog the backlog parameter for the listen() system call
+ * @param error location to store the error occuring, or NULL to
+ * ignore errors
+ * @return the socket file descriptor or -1 on error
+ */
+int
+socket_bind_listen(int domain, int type, int protocol,
+ const struct sockaddr *address, size_t address_length,
+ int backlog,
+ GError **error);
+
#endif