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.
20
#ifndef MPD_CLIENT_INTERNAL_H
21
#define MPD_CLIENT_INTERNAL_H
27
#define G_LOG_DOMAIN "client"
29
struct deferred_buffer {
31
char data[sizeof(long)];
38
/** the buffer for reading lines from the #channel */
39
struct fifo_buffer *input;
43
/** the uid of the client process, or -1 if unknown */
47
* How long since the last activity from this client?
49
GTimer *last_activity;
51
GSList *cmd_list; /* for when in list mode */
52
int cmd_list_OK; /* print OK after each command execution */
53
size_t cmd_list_size; /* mem cmd_list consumes */
54
GQueue *deferred_send; /* for output if client is slow */
55
size_t deferred_bytes; /* mem deferred_send consumes */
56
unsigned int num; /* client number */
59
size_t send_buf_used; /* bytes used this instance */
61
/** is this client waiting for an "idle" response? */
64
/** idle flags pending on this client, to be sent as soon as
65
the client enters "idle" */
68
/** idle flags that the client wants to receive */
69
unsigned idle_subscriptions;
72
extern unsigned int client_max_connections;
73
extern int client_timeout;
74
extern size_t client_max_command_list_size;
75
extern size_t client_max_output_buffer_size;
78
client_list_is_empty(void);
81
client_list_is_full(void);
84
client_list_get_first(void);
87
client_list_add(struct client *client);
90
client_list_foreach(GFunc func, gpointer user_data);
93
client_list_remove(struct client *client);
96
client_close(struct client *client);
99
new_cmd_list_ptr(struct client *client, const char *s)
101
client->cmd_list = g_slist_prepend(client->cmd_list, g_strdup(s));
105
free_cmd_list(GSList *list)
107
for (GSList *tmp = list; tmp != NULL; tmp = g_slist_next(tmp))
114
client_set_expired(struct client *client);
117
* Schedule an "expired" check for all clients: permanently delete
118
* clients which have been set "expired" with client_set_expired().
121
client_schedule_expire(void);
124
* Removes a scheduled "expired" check.
127
client_deinit_expire(void);
130
client_read(struct client *client);
133
client_process_line(struct client *client, char *line);
136
client_write_deferred(struct client *client);
139
client_write_output(struct client *client);
142
client_in_event(GIOChannel *source, GIOCondition condition,