socket_util: added socket_bind_listen()
Moved code from listen_add_address() (listen.c) to socket_util.c.
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user