2009-03-13 18:43:16 +01:00
|
|
|
/*
|
2010-01-01 05:55:13 +01:00
|
|
|
* Copyright (C) 2003-2010 The Music Player Daemon Project
|
2009-03-13 18:43:16 +01:00
|
|
|
* http://www.musicpd.org
|
2004-02-24 00:41:20 +01:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2009-03-13 18:43:16 +01:00
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2004-02-24 00:41:20 +01:00
|
|
|
*/
|
|
|
|
|
2008-10-31 09:19:53 +01:00
|
|
|
#ifndef MPD_CLIENT_H
|
|
|
|
#define MPD_CLIENT_H
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2008-12-02 03:00:02 +01:00
|
|
|
#include <glib.h>
|
2008-10-14 22:38:14 +02:00
|
|
|
#include <stdbool.h>
|
2008-10-08 10:49:29 +02:00
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
2008-08-29 09:36:42 +02:00
|
|
|
struct client;
|
2008-12-29 17:42:43 +01:00
|
|
|
struct sockaddr;
|
2009-11-03 21:08:48 +01:00
|
|
|
struct player_control;
|
2008-08-29 09:36:42 +02:00
|
|
|
|
2008-08-28 20:03:02 +02:00
|
|
|
void client_manager_init(void);
|
|
|
|
void client_manager_deinit(void);
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2009-11-03 21:08:48 +01:00
|
|
|
void client_new(struct player_control *player_control,
|
|
|
|
int fd, const struct sockaddr *sa, size_t sa_length, int uid);
|
2008-08-29 09:36:40 +02:00
|
|
|
|
2008-10-31 13:58:00 +01:00
|
|
|
bool client_is_expired(const struct client *client);
|
2008-08-29 09:37:11 +02:00
|
|
|
|
2008-10-15 22:34:21 +02:00
|
|
|
/**
|
|
|
|
* returns the uid of the client process, or a negative value if the
|
|
|
|
* uid is unknown
|
|
|
|
*/
|
|
|
|
int client_get_uid(const struct client *client);
|
|
|
|
|
2008-10-17 23:53:28 +02:00
|
|
|
unsigned client_get_permission(const struct client *client);
|
2008-09-07 19:16:34 +02:00
|
|
|
|
2008-10-17 23:53:28 +02:00
|
|
|
void client_set_permission(struct client *client, unsigned permission);
|
2008-09-07 19:16:34 +02:00
|
|
|
|
2008-09-07 13:24:51 +02:00
|
|
|
/**
|
|
|
|
* Write a C string to the client.
|
|
|
|
*/
|
|
|
|
void client_puts(struct client *client, const char *s);
|
|
|
|
|
2008-09-07 13:25:54 +02:00
|
|
|
/**
|
|
|
|
* Write a printf-like formatted string to the client.
|
|
|
|
*/
|
|
|
|
void client_vprintf(struct client *client, const char *fmt, va_list args);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Write a printf-like formatted string to the client.
|
|
|
|
*/
|
2008-12-02 03:00:02 +01:00
|
|
|
G_GNUC_PRINTF(2, 3) void client_printf(struct client *client, const char *fmt, ...);
|
2008-09-07 13:25:54 +02:00
|
|
|
|
2008-10-14 22:38:14 +02:00
|
|
|
/**
|
|
|
|
* Adds the specified idle flags to all clients and immediately sends
|
|
|
|
* notifications to all waiting clients.
|
|
|
|
*/
|
|
|
|
void client_manager_idle_add(unsigned flags);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks whether the client has pending idle flags. If yes, they are
|
|
|
|
* sent immediately and "true" is returned". If no, it puts the
|
|
|
|
* client into waiting mode and returns false.
|
|
|
|
*/
|
2008-11-22 13:26:21 +01:00
|
|
|
bool client_idle_wait(struct client *client, unsigned flags);
|
2008-10-14 22:38:14 +02:00
|
|
|
|
2004-02-24 00:41:20 +01:00
|
|
|
#endif
|