Added 64-bit types to the library.
[doldaconnect.git] / include / doldaconnect / uilib.h
1 #ifndef _UILIB_H
2 #define _UILIB_H
3
4 #include <wchar.h>
5
6 #define DC_LATEST 2
7
8 typedef long long dc_lnum_t;
9
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;
17     struct dc_respline
18     {
19         int argc;
20         wchar_t **argv;
21     } *rlines;
22     size_t linessize;
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;
37             dc_lnum_t lnum;
38             wchar_t *str;
39             double flnum;
40         } val;
41     } *argv;
42 };
43
44 char *dc_srv_local;
45
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);
58 int dc_connect(char *host);
59 int dc_connectsync(char *host, struct dc_response **respbuf);
60 int dc_connectsync2(char *host, int rev);
61 struct dc_intresp *dc_interpret(struct dc_response *resp);
62 void dc_freeires(struct dc_intresp *ires);
63 int dc_checkprotocol(struct dc_response *resp, int revision);
64 const char *dc_gethostname(void);
65 int dc_getfd(void);
66
67 #endif