2 * Copyright (C) 2003-2010 The Music Player Daemon Project
3 * http://www.musicpd.org
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 * This library provides easy helper functions for working with
34 * Converts the specified socket address into a string in the form
35 * "IP:PORT". The return value must be freed with g_free() when you
36 * don't need it anymore.
38 * @param sa the sockaddr struct
39 * @param length the length of #sa in bytes
40 * @param error location to store the error occuring, or NULL to
44 sockaddr_to_string(const struct sockaddr
*sa
, size_t length
, GError
**error
);
47 * Creates a socket listening on the specified address. This is a
48 * shortcut for socket(), bind() and listen().
50 * @param domain the socket domain, e.g. PF_INET6
51 * @param type the socket type, e.g. SOCK_STREAM
52 * @param protocol the protocol, usually 0 to let the kernel choose
53 * @param address the address to listen on
54 * @param address_length the size of #address
55 * @param backlog the backlog parameter for the listen() system call
56 * @param error location to store the error occuring, or NULL to
58 * @return the socket file descriptor or -1 on error
61 socket_bind_listen(int domain
, int type
, int protocol
,
62 const struct sockaddr
*address
, size_t address_length
,