chiark / gitweb /
disobedience, playrtp: Have `playrtp' handle volume control.
[disorder] / lib / client-stubs.h
... / ...
CommitLineData
1/*
2 * Automatically generated file, see scripts/protocol
3 *
4 * DO NOT EDIT.
5 */
6/*
7 * This file is part of DisOrder.
8 * Copyright (C) 2010-11 Richard Kettlewell
9 *
10 * This program is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 */
23#ifndef CLIENT_STUBS_H
24#define CLIENT_STUBS_H
25/** @file lib/client-stubs.h
26 * @brief Generated client API
27 *
28 * Don't include this file directly - use @ref lib/client.h instead.
29 */
30
31/** @brief Adopt a track
32 *
33 * Makes the calling user owner of a randomly picked track.
34 *
35 * @param c Client
36 * @param id Track ID
37 * @return 0 on success, non-0 on error
38 */
39int disorder_adopt(disorder_client *c, const char *id);
40
41/** @brief Create a user
42 *
43 * Create a new user. Requires the 'admin' right. Email addresses etc must be filled in in separate commands.
44 *
45 * @param c Client
46 * @param user New username
47 * @param password Initial password
48 * @param rights Initial rights (optional)
49 * @return 0 on success, non-0 on error
50 */
51int disorder_adduser(disorder_client *c, const char *user, const char *password, const char *rights);
52
53/** @brief List files and directories in a directory
54 *
55 * See 'files' and 'dirs' for more specific lists.
56 *
57 * @param c Client
58 * @param dir Directory to list (optional)
59 * @param re Regexp that results must match (optional)
60 * @param filesp List of matching files and directories
61 * @param nfilesp Number of elements in filesp
62 * @return 0 on success, non-0 on error
63 */
64int disorder_allfiles(disorder_client *c, const char *dir, const char *re, char ***filesp, int *nfilesp);
65
66/** @brief Confirm registration
67 *
68 * The confirmation string must have been created with 'register'. The username is returned so the caller knows who they are.
69 *
70 * @param c Client
71 * @param confirmation Confirmation string
72 * @return 0 on success, non-0 on error
73 */
74int disorder_confirm(disorder_client *c, const char *confirmation);
75
76/** @brief Log in with a cookie
77 *
78 * The cookie must have been created with 'make-cookie'. The username is returned so the caller knows who they are.
79 *
80 * @param c Client
81 * @param cookie Cookie string
82 * @return 0 on success, non-0 on error
83 */
84int disorder_cookie(disorder_client *c, const char *cookie);
85
86/** @brief Delete user
87 *
88 * Requires the 'admin' right.
89 *
90 * @param c Client
91 * @param user User to delete
92 * @return 0 on success, non-0 on error
93 */
94int disorder_deluser(disorder_client *c, const char *user);
95
96/** @brief List directories in a directory
97 *
98 *
99 *
100 * @param c Client
101 * @param dir Directory to list (optional)
102 * @param re Regexp that results must match (optional)
103 * @param filesp List of matching directories
104 * @param nfilesp Number of elements in filesp
105 * @return 0 on success, non-0 on error
106 */
107int disorder_dirs(disorder_client *c, const char *dir, const char *re, char ***filesp, int *nfilesp);
108
109/** @brief Disable play
110 *
111 * Play will stop at the end of the current track, if one is playing. Requires the 'global prefs' right.
112 *
113 * @param c Client
114 * @return 0 on success, non-0 on error
115 */
116int disorder_disable(disorder_client *c);
117
118/** @brief Set a user property
119 *
120 * With the 'admin' right you can do anything. Otherwise you need the 'userinfo' right and can only set 'email' and 'password'.
121 *
122 * @param c Client
123 * @param username User to modify
124 * @param property Property name
125 * @param value New property value
126 * @return 0 on success, non-0 on error
127 */
128int disorder_edituser(disorder_client *c, const char *username, const char *property, const char *value);
129
130/** @brief Enable play
131 *
132 * Requires the 'global prefs' right.
133 *
134 * @param c Client
135 * @return 0 on success, non-0 on error
136 */
137int disorder_enable(disorder_client *c);
138
139/** @brief Detect whether play is enabled
140 *
141 *
142 *
143 * @param c Client
144 * @param enabledp 1 if play is enabled and 0 otherwise
145 * @return 0 on success, non-0 on error
146 */
147int disorder_enabled(disorder_client *c, int *enabledp);
148
149/** @brief Test whether a track exists
150 *
151 *
152 *
153 * @param c Client
154 * @param track Track name
155 * @param existsp 1 if the track exists and 0 otherwise
156 * @return 0 on success, non-0 on error
157 */
158int disorder_exists(disorder_client *c, const char *track, int *existsp);
159
160/** @brief List files in a directory
161 *
162 *
163 *
164 * @param c Client
165 * @param dir Directory to list (optional)
166 * @param re Regexp that results must match (optional)
167 * @param filesp List of matching files
168 * @param nfilesp Number of elements in filesp
169 * @return 0 on success, non-0 on error
170 */
171int disorder_files(disorder_client *c, const char *dir, const char *re, char ***filesp, int *nfilesp);
172
173/** @brief Get a track preference
174 *
175 * If the track does not exist that is an error. If the track exists but the preference does not then a null value is returned.
176 *
177 * @param c Client
178 * @param track Track name
179 * @param pref Preference name
180 * @param valuep Preference value
181 * @return 0 on success, non-0 on error
182 */
183int disorder_get(disorder_client *c, const char *track, const char *pref, char **valuep);
184
185/** @brief Get a global preference
186 *
187 * If the preference does exist not then a null value is returned.
188 *
189 * @param c Client
190 * @param pref Global preference name
191 * @param valuep Preference value
192 * @return 0 on success, non-0 on error
193 */
194int disorder_get_global(disorder_client *c, const char *pref, char **valuep);
195
196/** @brief Get a track's length
197 *
198 * If the track does not exist an error is returned.
199 *
200 * @param c Client
201 * @param track Track name
202 * @param lengthp Track length in seconds
203 * @return 0 on success, non-0 on error
204 */
205int disorder_length(disorder_client *c, const char *track, long *lengthp);
206
207/** @brief Create a login cookie for this user
208 *
209 * The cookie may be redeemed via the 'cookie' command
210 *
211 * @param c Client
212 * @param cookiep Newly created cookie
213 * @return 0 on success, non-0 on error
214 */
215int disorder_make_cookie(disorder_client *c, char **cookiep);
216
217/** @brief Move a track
218 *
219 * Requires one of the 'move mine', 'move random' or 'move any' rights depending on how the track came to be added to the queue.
220 *
221 * @param c Client
222 * @param track Track ID or name
223 * @param delta How far to move the track towards the head of the queue
224 * @return 0 on success, non-0 on error
225 */
226int disorder_move(disorder_client *c, const char *track, long delta);
227
228/** @brief Move multiple tracks
229 *
230 * Requires one of the 'move mine', 'move random' or 'move any' rights depending on how the track came to be added to the queue.
231 *
232 * @param c Client
233 * @param target Move after this track, or to head if ""
234 * @param ids List of tracks to move by ID
235 * @param nids Length of ids
236 * @return 0 on success, non-0 on error
237 */
238int disorder_moveafter(disorder_client *c, const char *target, char **ids, int nids);
239
240/** @brief List recently added tracks
241 *
242 *
243 *
244 * @param c Client
245 * @param max Maximum tracks to fetch, or 0 for all available
246 * @param tracksp Recently added tracks
247 * @param ntracksp Number of elements in tracksp
248 * @return 0 on success, non-0 on error
249 */
250int disorder_new_tracks(disorder_client *c, long max, char ***tracksp, int *ntracksp);
251
252/** @brief Do nothing
253 *
254 * Used as a keepalive. No authentication required.
255 *
256 * @param c Client
257 * @return 0 on success, non-0 on error
258 */
259int disorder_nop(disorder_client *c);
260
261/** @brief Get a track name part
262 *
263 * If the name part cannot be constructed an empty string is returned.
264 *
265 * @param c Client
266 * @param track Track name
267 * @param context Context ("sort" or "display")
268 * @param part Name part ("artist", "album" or "title")
269 * @param partp Value of name part
270 * @return 0 on success, non-0 on error
271 */
272int disorder_part(disorder_client *c, const char *track, const char *context, const char *part, char **partp);
273
274/** @brief Pause the currently playing track
275 *
276 * Requires the 'pause' right.
277 *
278 * @param c Client
279 * @return 0 on success, non-0 on error
280 */
281int disorder_pause(disorder_client *c);
282
283/** @brief Play a track
284 *
285 * Requires the 'play' right.
286 *
287 * @param c Client
288 * @param track Track to play
289 * @param idp Queue ID of new track
290 * @return 0 on success, non-0 on error
291 */
292int disorder_play(disorder_client *c, const char *track, char **idp);
293
294/** @brief Play multiple tracks
295 *
296 * Requires the 'play' right.
297 *
298 * @param c Client
299 * @param target Insert into queue after this track, or at head if ""
300 * @param tracks List of track names to play
301 * @param ntracks Length of tracks
302 * @return 0 on success, non-0 on error
303 */
304int disorder_playafter(disorder_client *c, const char *target, char **tracks, int ntracks);
305
306/** @brief Retrieve the playing track
307 *
308 *
309 *
310 * @param c Client
311 * @param playingp Details of the playing track
312 * @return 0 on success, non-0 on error
313 */
314int disorder_playing(disorder_client *c, struct queue_entry **playingp);
315
316/** @brief Delete a playlist
317 *
318 * Requires the 'play' right and permission to modify the playlist.
319 *
320 * @param c Client
321 * @param playlist Playlist to delete
322 * @return 0 on success, non-0 on error
323 */
324int disorder_playlist_delete(disorder_client *c, const char *playlist);
325
326/** @brief List the contents of a playlist
327 *
328 * Requires the 'read' right and oermission to read the playlist.
329 *
330 * @param c Client
331 * @param playlist Playlist name
332 * @param tracksp List of tracks in playlist
333 * @param ntracksp Number of elements in tracksp
334 * @return 0 on success, non-0 on error
335 */
336int disorder_playlist_get(disorder_client *c, const char *playlist, char ***tracksp, int *ntracksp);
337
338/** @brief Get a playlist's sharing status
339 *
340 * Requires the 'read' right and permission to read the playlist.
341 *
342 * @param c Client
343 * @param playlist Playlist to read
344 * @param sharep Sharing status ("public", "private" or "shared")
345 * @return 0 on success, non-0 on error
346 */
347int disorder_playlist_get_share(disorder_client *c, const char *playlist, char **sharep);
348
349/** @brief Lock a playlist
350 *
351 * Requires the 'play' right and permission to modify the playlist. A given connection may lock at most one playlist.
352 *
353 * @param c Client
354 * @param playlist Playlist to delete
355 * @return 0 on success, non-0 on error
356 */
357int disorder_playlist_lock(disorder_client *c, const char *playlist);
358
359/** @brief Set the contents of a playlist
360 *
361 * Requires the 'play' right and permission to modify the playlist, which must be locked.
362 *
363 * @param c Client
364 * @param playlist Playlist to modify
365 * @param tracks New list of tracks for playlist
366 * @param ntracks Length of tracks
367 * @return 0 on success, non-0 on error
368 */
369int disorder_playlist_set(disorder_client *c, const char *playlist, char **tracks, int ntracks);
370
371/** @brief Set a playlist's sharing status
372 *
373 * Requires the 'play' right and permission to modify the playlist.
374 *
375 * @param c Client
376 * @param playlist Playlist to modify
377 * @param share New sharing status ("public", "private" or "shared")
378 * @return 0 on success, non-0 on error
379 */
380int disorder_playlist_set_share(disorder_client *c, const char *playlist, const char *share);
381
382/** @brief Unlock the locked playlist playlist
383 *
384 * The playlist to unlock is implicit in the connection.
385 *
386 * @param c Client
387 * @return 0 on success, non-0 on error
388 */
389int disorder_playlist_unlock(disorder_client *c);
390
391/** @brief List playlists
392 *
393 * Requires the 'read' right. Only playlists that you have permission to read are returned.
394 *
395 * @param c Client
396 * @param playlistsp Playlist names
397 * @param nplaylistsp Number of elements in playlistsp
398 * @return 0 on success, non-0 on error
399 */
400int disorder_playlists(disorder_client *c, char ***playlistsp, int *nplaylistsp);
401
402/** @brief Get all the preferences for a track
403 *
404 *
405 *
406 * @param c Client
407 * @param track Track name
408 * @param prefsp Track preferences
409 * @return 0 on success, non-0 on error
410 */
411int disorder_prefs(disorder_client *c, const char *track, struct kvp **prefsp);
412
413/** @brief List the queue
414 *
415 *
416 *
417 * @param c Client
418 * @param queuep Current queue contents
419 * @return 0 on success, non-0 on error
420 */
421int disorder_queue(disorder_client *c, struct queue_entry **queuep);
422
423/** @brief Disable random play
424 *
425 * Requires the 'global prefs' right.
426 *
427 * @param c Client
428 * @return 0 on success, non-0 on error
429 */
430int disorder_random_disable(disorder_client *c);
431
432/** @brief Enable random play
433 *
434 * Requires the 'global prefs' right.
435 *
436 * @param c Client
437 * @return 0 on success, non-0 on error
438 */
439int disorder_random_enable(disorder_client *c);
440
441/** @brief Detect whether random play is enabled
442 *
443 * Random play counts as enabled even if play is disabled.
444 *
445 * @param c Client
446 * @param enabledp 1 if random play is enabled and 0 otherwise
447 * @return 0 on success, non-0 on error
448 */
449int disorder_random_enabled(disorder_client *c, int *enabledp);
450
451/** @brief List recently played tracks
452 *
453 *
454 *
455 * @param c Client
456 * @param recentp Recently played tracks
457 * @return 0 on success, non-0 on error
458 */
459int disorder_recent(disorder_client *c, struct queue_entry **recentp);
460
461/** @brief Re-read configuraiton file.
462 *
463 * Requires the 'admin' right.
464 *
465 * @param c Client
466 * @return 0 on success, non-0 on error
467 */
468int disorder_reconfigure(disorder_client *c);
469
470/** @brief Register a new user
471 *
472 * Requires the 'register' right which is usually only available to the 'guest' user. Redeem the confirmation string via 'confirm' to complete registration.
473 *
474 * @param c Client
475 * @param username Requested new username
476 * @param password Requested initial password
477 * @param email New user's email address
478 * @param confirmationp Confirmation string
479 * @return 0 on success, non-0 on error
480 */
481int disorder_register(disorder_client *c, const char *username, const char *password, const char *email, char **confirmationp);
482
483/** @brief Send a password reminder.
484 *
485 * If the user has no valid email address, or no password, or a reminder has been sent too recently, then no reminder will be sent.
486 *
487 * @param c Client
488 * @param username User to remind
489 * @return 0 on success, non-0 on error
490 */
491int disorder_reminder(disorder_client *c, const char *username);
492
493/** @brief Remove a track form the queue.
494 *
495 * Requires one of the 'remove mine', 'remove random' or 'remove any' rights depending on how the track came to be added to the queue.
496 *
497 * @param c Client
498 * @param id Track ID
499 * @return 0 on success, non-0 on error
500 */
501int disorder_remove(disorder_client *c, const char *id);
502
503/** @brief Rescan all collections for new or obsolete tracks.
504 *
505 * Requires the 'rescan' right.
506 *
507 * @param c Client
508 * @return 0 on success, non-0 on error
509 */
510int disorder_rescan(disorder_client *c);
511
512/** @brief Resolve a track name
513 *
514 * Converts aliases to non-alias track names
515 *
516 * @param c Client
517 * @param track Track name (might be an alias)
518 * @param resolvedp Resolve track name (definitely not an alias)
519 * @return 0 on success, non-0 on error
520 */
521int disorder_resolve(disorder_client *c, const char *track, char **resolvedp);
522
523/** @brief Resume the currently playing track
524 *
525 * Requires the 'pause' right.
526 *
527 * @param c Client
528 * @return 0 on success, non-0 on error
529 */
530int disorder_resume(disorder_client *c);
531
532/** @brief Revoke a cookie.
533 *
534 * It will not subsequently be possible to log in with the cookie.
535 *
536 * @param c Client
537 * @return 0 on success, non-0 on error
538 */
539int disorder_revoke(disorder_client *c);
540
541/** @brief Get the server's RTP address information
542 *
543 *
544 *
545 * @param c Client
546 * @param addressp Where to store hostname or address
547 * @param portp Where to store service name or port number
548 * @return 0 on success, non-0 on error
549 */
550int disorder_rtp_address(disorder_client *c, char **addressp, char **portp);
551
552/** @brief Cancel RTP stream
553 *
554 *
555 *
556 * @param c Client
557 * @return 0 on success, non-0 on error
558 */
559int disorder_rtp_cancel(disorder_client *c);
560
561/** @brief Request a unicast RTP stream
562 *
563 *
564 *
565 * @param c Client
566 * @param address Destination address
567 * @param port Destination port number
568 * @return 0 on success, non-0 on error
569 */
570int disorder_rtp_request(disorder_client *c, const char *address, const char *port);
571
572/** @brief Terminate the playing track.
573 *
574 * Requires one of the 'scratch mine', 'scratch random' or 'scratch any' rights depending on how the track came to be added to the queue.
575 *
576 * @param c Client
577 * @param id Track ID (optional)
578 * @return 0 on success, non-0 on error
579 */
580int disorder_scratch(disorder_client *c, const char *id);
581
582/** @brief Schedule a track to play in the future
583 *
584 *
585 *
586 * @param c Client
587 * @param when When to play the track
588 * @param priority Event priority ("normal" or "junk")
589 * @param track Track to play
590 * @return 0 on success, non-0 on error
591 */
592int disorder_schedule_add_play(disorder_client *c, time_t when, const char *priority, const char *track);
593
594/** @brief Schedule a global setting to be changed in the future
595 *
596 *
597 *
598 * @param c Client
599 * @param when When to change the setting
600 * @param priority Event priority ("normal" or "junk")
601 * @param pref Global preference to set
602 * @param value New value of global preference
603 * @return 0 on success, non-0 on error
604 */
605int disorder_schedule_add_set_global(disorder_client *c, time_t when, const char *priority, const char *pref, const char *value);
606
607/** @brief Schedule a global setting to be unset in the future
608 *
609 *
610 *
611 * @param c Client
612 * @param when When to change the setting
613 * @param priority Event priority ("normal" or "junk")
614 * @param pref Global preference to set
615 * @return 0 on success, non-0 on error
616 */
617int disorder_schedule_add_unset_global(disorder_client *c, time_t when, const char *priority, const char *pref);
618
619/** @brief Delete a scheduled event.
620 *
621 * Users can always delete their own scheduled events; with the admin right you can delete any event.
622 *
623 * @param c Client
624 * @param event ID of event to delete
625 * @return 0 on success, non-0 on error
626 */
627int disorder_schedule_del(disorder_client *c, const char *event);
628
629/** @brief Get the details of scheduled event
630 *
631 *
632 *
633 * @param c Client
634 * @param id Event ID
635 * @param actiondatap Details of event
636 * @return 0 on success, non-0 on error
637 */
638int disorder_schedule_get(disorder_client *c, const char *id, struct kvp **actiondatap);
639
640/** @brief List scheduled events
641 *
642 * This just lists IDs. Use 'schedule-get' to retrieve more detail
643 *
644 * @param c Client
645 * @param idsp List of event IDs
646 * @param nidsp Number of elements in idsp
647 * @return 0 on success, non-0 on error
648 */
649int disorder_schedule_list(disorder_client *c, char ***idsp, int *nidsp);
650
651/** @brief Search for tracks
652 *
653 * Terms are either keywords or tags formatted as 'tag:TAG-NAME'.
654 *
655 * @param c Client
656 * @param terms List of search terms
657 * @param tracksp List of matching tracks
658 * @param ntracksp Number of elements in tracksp
659 * @return 0 on success, non-0 on error
660 */
661int disorder_search(disorder_client *c, const char *terms, char ***tracksp, int *ntracksp);
662
663/** @brief Set a track preference
664 *
665 * Requires the 'prefs' right.
666 *
667 * @param c Client
668 * @param track Track name
669 * @param pref Preference name
670 * @param value New value
671 * @return 0 on success, non-0 on error
672 */
673int disorder_set(disorder_client *c, const char *track, const char *pref, const char *value);
674
675/** @brief Set a global preference
676 *
677 * Requires the 'global prefs' right.
678 *
679 * @param c Client
680 * @param pref Preference name
681 * @param value New value
682 * @return 0 on success, non-0 on error
683 */
684int disorder_set_global(disorder_client *c, const char *pref, const char *value);
685
686/** @brief Request server shutdown
687 *
688 * Requires the 'admin' right.
689 *
690 * @param c Client
691 * @return 0 on success, non-0 on error
692 */
693int disorder_shutdown(disorder_client *c);
694
695/** @brief Get server statistics
696 *
697 * The details of what the server reports are not really defined. The returned strings are intended to be printed out one to a line.
698 *
699 * @param c Client
700 * @param statsp List of server information strings.
701 * @param nstatsp Number of elements in statsp
702 * @return 0 on success, non-0 on error
703 */
704int disorder_stats(disorder_client *c, char ***statsp, int *nstatsp);
705
706/** @brief Get a list of known tags
707 *
708 * Only tags which apply to at least one track are returned.
709 *
710 * @param c Client
711 * @param tagsp List of tags
712 * @param ntagsp Number of elements in tagsp
713 * @return 0 on success, non-0 on error
714 */
715int disorder_tags(disorder_client *c, char ***tagsp, int *ntagsp);
716
717/** @brief Unset a track preference
718 *
719 * Requires the 'prefs' right.
720 *
721 * @param c Client
722 * @param track Track name
723 * @param pref Preference name
724 * @return 0 on success, non-0 on error
725 */
726int disorder_unset(disorder_client *c, const char *track, const char *pref);
727
728/** @brief Set a global preference
729 *
730 * Requires the 'global prefs' right.
731 *
732 * @param c Client
733 * @param pref Preference name
734 * @return 0 on success, non-0 on error
735 */
736int disorder_unset_global(disorder_client *c, const char *pref);
737
738/** @brief Get a user property.
739 *
740 * If the user does not exist an error is returned, if the user exists but the property does not then a null value is returned.
741 *
742 * @param c Client
743 * @param username User to read
744 * @param property Property to read
745 * @param valuep Value of property
746 * @return 0 on success, non-0 on error
747 */
748int disorder_userinfo(disorder_client *c, const char *username, const char *property, char **valuep);
749
750/** @brief Get a list of users
751 *
752 *
753 *
754 * @param c Client
755 * @param usersp List of users
756 * @param nusersp Number of elements in usersp
757 * @return 0 on success, non-0 on error
758 */
759int disorder_users(disorder_client *c, char ***usersp, int *nusersp);
760
761/** @brief Get the server version
762 *
763 *
764 *
765 * @param c Client
766 * @param versionp Server version string
767 * @return 0 on success, non-0 on error
768 */
769int disorder_version(disorder_client *c, char **versionp);
770
771/** @brief Set the volume
772 *
773 *
774 *
775 * @param c Client
776 * @param left Left channel volume
777 * @param right Right channel volume
778 * @return 0 on success, non-0 on error
779 */
780int disorder_set_volume(disorder_client *c, long left, long right);
781
782/** @brief Get the volume
783 *
784 *
785 *
786 * @param c Client
787 * @param leftp Left channel volume
788 * @param rightp Right channel volume
789 * @return 0 on success, non-0 on error
790 */
791int disorder_get_volume(disorder_client *c, long *leftp, long *rightp);
792
793#endif