| 1 | #ifndef _UILIB_H |
| 2 | #define _UILIB_H |
| 3 | |
| 4 | #include <wchar.h> |
| 5 | |
| 6 | #define DC_LATEST 2 |
| 7 | |
| 8 | struct dc_response |
| 9 | { |
| 10 | struct dc_response *next, *prev; |
| 11 | int code, tag; |
| 12 | wchar_t *cmdname; |
| 13 | void *data; |
| 14 | void *internal; |
| 15 | struct dc_respline |
| 16 | { |
| 17 | int argc; |
| 18 | wchar_t **argv; |
| 19 | } *rlines; |
| 20 | size_t linessize; |
| 21 | int numlines; |
| 22 | int curline; |
| 23 | }; |
| 24 | |
| 25 | struct dc_intresp |
| 26 | { |
| 27 | int code; |
| 28 | int argc; |
| 29 | struct |
| 30 | { |
| 31 | int type; |
| 32 | union |
| 33 | { |
| 34 | int num; |
| 35 | wchar_t *str; |
| 36 | double flnum; |
| 37 | } val; |
| 38 | } *argv; |
| 39 | }; |
| 40 | |
| 41 | char *dc_srv_local; |
| 42 | |
| 43 | int dc_init(void); |
| 44 | void dc_cleanup(void); |
| 45 | void dc_disconnect(void); |
| 46 | void dc_freeresp(struct dc_response *resp); |
| 47 | struct dc_response *dc_getresp(void); |
| 48 | struct dc_response *dc_gettaggedresp(int tag); |
| 49 | struct dc_response *dc_gettaggedrespsync(int tag); |
| 50 | int dc_wantwrite(void); |
| 51 | int dc_getstate(void); |
| 52 | int dc_queuecmd(int (*callback)(struct dc_response *), void *data, ...); |
| 53 | int dc_handleread(void); |
| 54 | int dc_handlewrite(void); |
| 55 | int dc_connect(char *host); |
| 56 | int dc_connectsync(char *host, struct dc_response **respbuf); |
| 57 | int dc_connectsync2(char *host, int rev); |
| 58 | struct dc_intresp *dc_interpret(struct dc_response *resp); |
| 59 | void dc_freeires(struct dc_intresp *ires); |
| 60 | int dc_checkprotocol(struct dc_response *resp, int revision); |
| 61 | const char *dc_gethostname(void); |
| 62 | int dc_getfd(void); |
| 63 | |
| 64 | #endif |