aboutsummaryrefslogtreecommitdiffstats
path: root/src/socket_util.h
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-03-14 18:29:38 +0100
committerMax Kellermann <max@duempel.org>2009-03-14 18:29:38 +0100
commitc8c392050069f9a6b922ccd8ea8a4c71dda4a2c8 (patch)
tree37aedc11cd4fc5a7a77fe7e0cb93835a33e2520b /src/socket_util.h
parentdccb973cfef9664644e4945fbddedb3eee8c215b (diff)
downloadmpd-c8c392050069f9a6b922ccd8ea8a4c71dda4a2c8.tar.gz
mpd-c8c392050069f9a6b922ccd8ea8a4c71dda4a2c8.tar.xz
mpd-c8c392050069f9a6b922ccd8ea8a4c71dda4a2c8.zip
socket_util: added socket_bind_listen()
Moved code from listen_add_address() (listen.c) to socket_util.c.
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