chiark / gitweb /
client.c make-cookie support
[disorder] / lib / client.h
CommitLineData
460b9539 1/*
2 * This file is part of DisOrder.
78efa64e 3 * Copyright (C) 2004, 2005, 2006, 2007 Richard Kettlewell
460b9539 4 *
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.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18 * USA
19 */
20
21#ifndef CLIENT_H
22#define CLIENT_H
23
24/* A simple synchronous client interface. */
25
26typedef struct disorder_client disorder_client;
27
28struct queue_entry;
29struct kvp;
30struct sink;
31
32/* Parameter strings (e.g. @track@) are UTF-8 unless specified
33 * otherwise. */
34
35disorder_client *disorder_new(int verbose);
36/* create a new disorder_client */
37
38int disorder_running(disorder_client *c);
39/* return 1 if the server is running, else 0 */
40
41int disorder_connect(disorder_client *c);
42/* connect a disorder_client using the default settings */
43
44int disorder_connect_sock(disorder_client *c,
45 const struct sockaddr *sa,
46 socklen_t len,
47 const char *username,
48 const char *password,
49 const char *ident);
50/* connect a disorder_client */
51
52int disorder_close(disorder_client *c);
53/* close a disorder_client */
54
55int disorder_become(disorder_client *c, const char *user);
56/* become another user (trusted users only) */
57
58int disorder_version(disorder_client *c, char **versionp);
59/* get the server version */
60
61int disorder_play(disorder_client *c, const char *track);
62/* add a track to the queue */
63
64int disorder_remove(disorder_client *c, const char *track);
65/* remove a track from the queue */
66
67int disorder_move(disorder_client *c, const char *track, int delta);
68/* move a track in the queue @delta@ steps towards the head */
69
70int disorder_enable(disorder_client *c);
71/* enable playing if it is not already enabled */
72
73int disorder_disable(disorder_client *c);
74/* disable playing if it is not already disabled. */
75
76int disorder_scratch(disorder_client *c, const char *id);
77/* scratch the currently playing track. If @id@ is not a null pointer
78 * then the scratch will be ignored if the ID does not mactch. */
79
80int disorder_shutdown(disorder_client *c);
81/* shut down the server immediately */
82
83int disorder_reconfigure(disorder_client *c);
84/* re-read the configuration file */
85
86int disorder_rescan(disorder_client *c);
87/* initiate a rescan */
88
89int disorder_playing(disorder_client *c, struct queue_entry **qp);
90/* get the details of the currently playing track (null pointer if
91 * nothing playing). The first entry in the list is the next track to
92 * be played. */
93
94int disorder_recent(disorder_client *c, struct queue_entry **qp);
95/* get a list of recently played tracks. The LAST entry in the list
96 * is last track to have been played. */
97
98int disorder_queue(disorder_client *c, struct queue_entry **qp);
99/* get the queue */
100
101int disorder_directories(disorder_client *c, const char *dir, const char *re,
102 char ***vecp, int *nvecp);
103/* get subdirectories of @dir@, or of the root if @dir@ is an null
104 * pointer */
105
106int disorder_files(disorder_client *c, const char *dir, const char *re,
107 char ***vecp, int *nvecp);
108/* get list of files in @dir@ */
109
110int disorder_allfiles(disorder_client *c, const char *dir, const char *re,
111 char ***vecp, int *nvecp);
112/* get list of files and directories in @dir@ */
113
114char *disorder_user(disorder_client *c);
115/* remind ourselves what user we went in as */
116
117int disorder_exists(disorder_client *c, const char *track, int *existsp);
118/* set @*existsp@ to 1 if the track exists, else 0 */
119
120int disorder_enabled(disorder_client *c, int *enabledp);
121/* set @*enabledp@ to 1 if playing enabled, else 0 */
122
123int disorder_set(disorder_client *c, const char *track,
124 const char *key, const char *value);
125int disorder_unset(disorder_client *c, const char *track,
126 const char *key);
127int disorder_get(disorder_client *c, const char *track, const char *key,
128 char **valuep);
129int disorder_prefs(disorder_client *c, const char *track,
130 struct kvp **kp);
131/* set, unset, get, list preferences */
132
133int disorder_length(disorder_client *c, const char *track,
134 long *valuep);
135/* get the length of a track in seconds, if it is known */
136
137int disorder_search(disorder_client *c, const char *terms,
138 char ***vecp, int *nvecp);
139/* get a list of tracks matching @words@ */
140
141int disorder_random_enable(disorder_client *c);
142/* enable random play if it is not already enabled */
143
144int disorder_random_disable(disorder_client *c);
145/* disable random play if it is not already disabled */
146
147int disorder_random_enabled(disorder_client *c, int *enabledp);
148/* determine whether random play is enabled */
149
150int disorder_stats(disorder_client *c,
151 char ***vecp, int *nvecp);
152/* get server statistics */
153
154int disorder_set_volume(disorder_client *c, int left, int right);
155int disorder_get_volume(disorder_client *c, int *left, int *right);
156/* get or set the volume */
157
158int disorder_log(disorder_client *c, struct sink *s);
159/* send log output to @s@ */
160
161int disorder_part(disorder_client *c, char **partp,
162 const char *track, const char *context, const char *part);
163/* get a track name part */
164
165int disorder_resolve(disorder_client *c, char **trackp, const char *track);
166/* resolve a track name */
167
168int disorder_pause(disorder_client *c);
169/* Pause the currently playing track. */
170
171int disorder_resume(disorder_client *c);
172/* Resume after a pause. */
173
174int disorder_tags(disorder_client *c,
175 char ***vecp, int *nvecp);
176/* get known tags */
177
178int disorder_set_global(disorder_client *c,
179 const char *key, const char *value);
180int disorder_unset_global(disorder_client *c, const char *key);
181int disorder_get_global(disorder_client *c, const char *key, char **valuep);
182/* get/unset/set global prefs */
183
2a10b70b
RK
184int disorder_new_tracks(disorder_client *c,
185 char ***vecp, int *nvecp,
186 int max);
187/* get new tracks */
188
ca831831
RK
189int disorder_rtp_address(disorder_client *c, char **addressp, char **portp);
190
f0feb22e 191int disorder_adduser(disorder_client *c,
0f55e905
RK
192 const char *user, const char *password,
193 const char *rights);
f0feb22e 194int disorder_deluser(disorder_client *c, const char *user);
a55c70c7
RK
195int disorder_userinfo(disorder_client *c, const char *user, const char *key,
196 char **valuep);
5df73aeb
RK
197int disorder_edituser(disorder_client *c, const char *user,
198 const char *key, const char *value);
c3be4f19
RK
199int disorder_users(disorder_client *c,
200 char ***vecp, int *nvecp);
ba39faf6
RK
201int disorder_register(disorder_client *c, const char *user,
202 const char *password, const char *email,
203 char **confirmp);
204int disorder_confirm(disorder_client *c, const char *confirm);
07969f9b 205int disorder_make_cookie(disorder_client *c, char **cookiep);
f0feb22e 206
460b9539 207#endif /* CLIENT_H */
208
209/*
210Local Variables:
211c-basic-offset:2
212comment-column:40
213End:
214*/