speaker: new comments to add/remove RTP recipients
[disorder] / lib / client-stubs.h
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 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 */
39 int 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 */
51 int 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 */
64 int 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 */
74 int 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 */
84 int 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 */
94 int 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 */
107 int 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 */
116 int 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 */
128 int 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 */
137 int 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 */
147 int 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 */
158 int 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 */
171 int 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 */
183 int 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 */
194 int 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 */
205 int 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 */
215 int 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 */
226 int 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 */
238 int 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 */
250 int 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 */
259 int 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 */
272 int 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 */
281 int 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 */
292 int 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 */
304 int 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 */
314 int 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 */
324 int 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 */
336 int 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 */
347 int 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 */
357 int 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 */
369 int 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 */
380 int 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 */
389 int 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 */
400 int 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 */
411 int 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 */
421 int 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 */
430 int 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 */
439 int 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 */
449 int 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 */
459 int 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 */
468 int 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 */
481 int 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 */
491 int 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 */
501 int 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 */
510 int 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 */
521 int 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 */
530 int 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 */
539 int 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 */
550 int disorder_rtp_address(disorder_client *c, char **addressp, char **portp);
551
552 /** @brief Terminate the playing track.
553 *
554 * Requires one of the 'scratch mine', 'scratch random' or 'scratch any' rights depending on how the track came to be added to the queue.
555 *
556 * @param c Client
557 * @param id Track ID (optional)
558 * @return 0 on success, non-0 on error
559 */
560 int disorder_scratch(disorder_client *c, const char *id);
561
562 /** @brief Schedule a track to play in the future
563 *
564 *
565 *
566 * @param c Client
567 * @param when When to play the track
568 * @param priority Event priority ("normal" or "junk")
569 * @param track Track to play
570 * @return 0 on success, non-0 on error
571 */
572 int disorder_schedule_add_play(disorder_client *c, time_t when, const char *priority, const char *track);
573
574 /** @brief Schedule a global setting to be changed in the future
575 *
576 *
577 *
578 * @param c Client
579 * @param when When to change the setting
580 * @param priority Event priority ("normal" or "junk")
581 * @param pref Global preference to set
582 * @param value New value of global preference
583 * @return 0 on success, non-0 on error
584 */
585 int disorder_schedule_add_set_global(disorder_client *c, time_t when, const char *priority, const char *pref, const char *value);
586
587 /** @brief Schedule a global setting to be unset in the future
588 *
589 *
590 *
591 * @param c Client
592 * @param when When to change the setting
593 * @param priority Event priority ("normal" or "junk")
594 * @param pref Global preference to set
595 * @return 0 on success, non-0 on error
596 */
597 int disorder_schedule_add_unset_global(disorder_client *c, time_t when, const char *priority, const char *pref);
598
599 /** @brief Delete a scheduled event.
600 *
601 * Users can always delete their own scheduled events; with the admin right you can delete any event.
602 *
603 * @param c Client
604 * @param event ID of event to delete
605 * @return 0 on success, non-0 on error
606 */
607 int disorder_schedule_del(disorder_client *c, const char *event);
608
609 /** @brief Get the details of scheduled event
610 *
611 *
612 *
613 * @param c Client
614 * @param id Event ID
615 * @param actiondatap Details of event
616 * @return 0 on success, non-0 on error
617 */
618 int disorder_schedule_get(disorder_client *c, const char *id, struct kvp **actiondatap);
619
620 /** @brief List scheduled events
621 *
622 * This just lists IDs. Use 'schedule-get' to retrieve more detail
623 *
624 * @param c Client
625 * @param idsp List of event IDs
626 * @param nidsp Number of elements in idsp
627 * @return 0 on success, non-0 on error
628 */
629 int disorder_schedule_list(disorder_client *c, char ***idsp, int *nidsp);
630
631 /** @brief Search for tracks
632 *
633 * Terms are either keywords or tags formatted as 'tag:TAG-NAME'.
634 *
635 * @param c Client
636 * @param terms List of search terms
637 * @param tracksp List of matching tracks
638 * @param ntracksp Number of elements in tracksp
639 * @return 0 on success, non-0 on error
640 */
641 int disorder_search(disorder_client *c, const char *terms, char ***tracksp, int *ntracksp);
642
643 /** @brief Set a track preference
644 *
645 * Requires the 'prefs' right.
646 *
647 * @param c Client
648 * @param track Track name
649 * @param pref Preference name
650 * @param value New value
651 * @return 0 on success, non-0 on error
652 */
653 int disorder_set(disorder_client *c, const char *track, const char *pref, const char *value);
654
655 /** @brief Set a global preference
656 *
657 * Requires the 'global prefs' right.
658 *
659 * @param c Client
660 * @param pref Preference name
661 * @param value New value
662 * @return 0 on success, non-0 on error
663 */
664 int disorder_set_global(disorder_client *c, const char *pref, const char *value);
665
666 /** @brief Request server shutdown
667 *
668 * Requires the 'admin' right.
669 *
670 * @param c Client
671 * @return 0 on success, non-0 on error
672 */
673 int disorder_shutdown(disorder_client *c);
674
675 /** @brief Get server statistics
676 *
677 * The details of what the server reports are not really defined. The returned strings are intended to be printed out one to a line.
678 *
679 * @param c Client
680 * @param statsp List of server information strings.
681 * @param nstatsp Number of elements in statsp
682 * @return 0 on success, non-0 on error
683 */
684 int disorder_stats(disorder_client *c, char ***statsp, int *nstatsp);
685
686 /** @brief Get a list of known tags
687 *
688 * Only tags which apply to at least one track are returned.
689 *
690 * @param c Client
691 * @param tagsp List of tags
692 * @param ntagsp Number of elements in tagsp
693 * @return 0 on success, non-0 on error
694 */
695 int disorder_tags(disorder_client *c, char ***tagsp, int *ntagsp);
696
697 /** @brief Unset a track preference
698 *
699 * Requires the 'prefs' right.
700 *
701 * @param c Client
702 * @param track Track name
703 * @param pref Preference name
704 * @return 0 on success, non-0 on error
705 */
706 int disorder_unset(disorder_client *c, const char *track, const char *pref);
707
708 /** @brief Set a global preference
709 *
710 * Requires the 'global prefs' right.
711 *
712 * @param c Client
713 * @param pref Preference name
714 * @return 0 on success, non-0 on error
715 */
716 int disorder_unset_global(disorder_client *c, const char *pref);
717
718 /** @brief Get a user property.
719 *
720 * 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.
721 *
722 * @param c Client
723 * @param username User to read
724 * @param property Property to read
725 * @param valuep Value of property
726 * @return 0 on success, non-0 on error
727 */
728 int disorder_userinfo(disorder_client *c, const char *username, const char *property, char **valuep);
729
730 /** @brief Get a list of users
731 *
732 *
733 *
734 * @param c Client
735 * @param usersp List of users
736 * @param nusersp Number of elements in usersp
737 * @return 0 on success, non-0 on error
738 */
739 int disorder_users(disorder_client *c, char ***usersp, int *nusersp);
740
741 /** @brief Get the server version
742 *
743 *
744 *
745 * @param c Client
746 * @param versionp Server version string
747 * @return 0 on success, non-0 on error
748 */
749 int disorder_version(disorder_client *c, char **versionp);
750
751 /** @brief Set the volume
752 *
753 *
754 *
755 * @param c Client
756 * @param left Left channel volume
757 * @param right Right channel volume
758 * @return 0 on success, non-0 on error
759 */
760 int disorder_set_volume(disorder_client *c, long left, long right);
761
762 /** @brief Get the volume
763 *
764 *
765 *
766 * @param c Client
767 * @param leftp Left channel volume
768 * @param rightp Right channel volume
769 * @return 0 on success, non-0 on error
770 */
771 int disorder_get_volume(disorder_client *c, long *leftp, long *rightp);
772
773 #endif