Transfer from CVS at SourceForge
[doldaconnect.git] / include / doldaconnect / uilib.h
1 #ifndef _UILIB_H
2 #define _UILIB_H
3
4 #include <wchar.h>
5
6 struct dc_response
7 {
8     struct dc_response *next, *prev;
9     int code, tag;
10     wchar_t *cmdname;
11     void *data;
12     void *internal;
13     struct
14     {
15         int argc;
16         wchar_t **argv;
17     } *rlines;
18     int linessize;
19     int numlines;
20     int curline;
21 };
22
23 struct dc_intresp
24 {
25     int code;
26     int argc;
27     struct
28     {
29         int type;
30         union
31         {
32             int num;
33             wchar_t *str;
34             double flnum;
35         } val;
36     } *argv;
37 };
38
39 int dc_init(void);
40 void dc_cleanup(void);
41 void dc_disconnect(void);
42 void dc_freeresp(struct dc_response *resp);
43 struct dc_response *dc_getresp(void);
44 struct dc_response *dc_gettaggedresp(int tag);
45 struct dc_response *dc_gettaggedrespsync(int tag);
46 int dc_wantwrite(void);
47 int dc_getstate(void);
48 int dc_queuecmd(int (*callback)(struct dc_response *), void *data, ...);
49 int dc_handleread(void);
50 int dc_handlewrite(void);
51 int dc_connect(char *host, int port);
52 struct dc_intresp *dc_interpret(struct dc_response *resp);
53 void dc_freeires(struct dc_intresp *ires);
54 const char *dc_gethostname(void);
55
56 #endif