libmpdclient 2.10

mpd/async.h

Go to the documentation of this file.
00001 /* libmpdclient
00002    (c) 2003-2015 The Music Player Daemon Project
00003    This project's homepage is: http://www.musicpd.org
00004 
00005    Redistribution and use in source and binary forms, with or without
00006    modification, are permitted provided that the following conditions
00007    are met:
00008 
00009    - Redistributions of source code must retain the above copyright
00010    notice, this list of conditions and the following disclaimer.
00011 
00012    - Redistributions in binary form must reproduce the above copyright
00013    notice, this list of conditions and the following disclaimer in the
00014    documentation and/or other materials provided with the distribution.
00015 
00016    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00017    ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00018    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00019    A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
00020    CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00021    EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00022    PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00023    PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00024    LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00025    NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00026    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027 */
00028 
00041 #ifndef MPD_ASYNC_H
00042 #define MPD_ASYNC_H
00043 
00044 #include <mpd/error.h>
00045 #include <mpd/compiler.h>
00046 
00047 #include <stdbool.h>
00048 #include <stdarg.h>
00049 
00053 enum mpd_async_event {
00055         MPD_ASYNC_EVENT_READ = 1,
00056 
00058         MPD_ASYNC_EVENT_WRITE = 2,
00059 
00061         MPD_ASYNC_EVENT_HUP = 4,
00062 
00064         MPD_ASYNC_EVENT_ERROR = 8,
00065 };
00066 
00073 struct mpd_async;
00074 
00075 #ifdef __cplusplus
00076 extern "C" {
00077 #endif
00078 
00086 mpd_malloc
00087 struct mpd_async *
00088 mpd_async_new(int fd);
00089 
00093 void
00094 mpd_async_free(struct mpd_async *async);
00095 
00100 mpd_pure
00101 enum mpd_error
00102 mpd_async_get_error(const struct mpd_async *async);
00103 
00115 mpd_pure
00116 const char *
00117 mpd_async_get_error_message(const struct mpd_async *async);
00118 
00126 mpd_pure
00127 int
00128 mpd_async_get_system_error(const struct mpd_async *async);
00129 
00136 mpd_pure
00137 int
00138 mpd_async_get_fd(const struct mpd_async *async);
00139 
00152 void mpd_async_set_keepalive(struct mpd_async *async,
00153                              bool keepalive);
00154 
00158 mpd_pure
00159 enum mpd_async_event
00160 mpd_async_events(const struct mpd_async *async);
00161 
00169 bool
00170 mpd_async_io(struct mpd_async *async, enum mpd_async_event events);
00171 
00181 bool
00182 mpd_async_send_command_v(struct mpd_async *async, const char *command,
00183                          va_list args);
00184 
00193 mpd_sentinel
00194 bool
00195 mpd_async_send_command(struct mpd_async *async, const char *command, ...);
00196 
00205 mpd_malloc
00206 char *
00207 mpd_async_recv_line(struct mpd_async *async);
00208 
00209 #ifdef __cplusplus
00210 }
00211 #endif
00212 
00213 #endif