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