00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
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