MPD 0.17~git
src/server_socket.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2003-2011 The Music Player Daemon Project
00003  * http://www.musicpd.org
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation; either version 2 of the License, or
00008  * (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License along
00016  * with this program; if not, write to the Free Software Foundation, Inc.,
00017  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00018  */
00019 
00020 #ifndef MPD_SERVER_SOCKET_H
00021 #define MPD_SERVER_SOCKET_H
00022 
00023 #include <stdbool.h>
00024 
00025 #include <glib.h>
00026 
00027 struct sockaddr;
00028 
00029 typedef void (*server_socket_callback_t)(int fd,
00030                                          const struct sockaddr *address,
00031                                          size_t address_length, int uid,
00032                                          void *ctx);
00033 
00034 struct server_socket *
00035 server_socket_new(server_socket_callback_t callback, void *callback_ctx);
00036 
00037 void
00038 server_socket_free(struct server_socket *ss);
00039 
00040 bool
00041 server_socket_open(struct server_socket *ss, GError **error_r);
00042 
00043 void
00044 server_socket_close(struct server_socket *ss);
00045 
00054 bool
00055 server_socket_add_port(struct server_socket *ss, unsigned port,
00056                        GError **error_r);
00057 
00068 bool
00069 server_socket_add_host(struct server_socket *ss, const char *hostname,
00070                        unsigned port, GError **error_r);
00071 
00080 bool
00081 server_socket_add_path(struct server_socket *ss, const char *path,
00082                        GError **error_r);
00083 
00084 #endif