Added synchronous versions of connect and login.
[doldaconnect.git] / include / doldaconnect / uilib.h
... / ...
CommitLineData
1#ifndef _UILIB_H
2#define _UILIB_H
3
4#include <wchar.h>
5
6#define DC_LATEST 2
7
8struct 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
25struct 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
41char *dc_srv_local;
42
43int dc_init(void);
44void dc_cleanup(void);
45void dc_disconnect(void);
46void dc_freeresp(struct dc_response *resp);
47struct dc_response *dc_getresp(void);
48struct dc_response *dc_gettaggedresp(int tag);
49struct dc_response *dc_gettaggedrespsync(int tag);
50int dc_wantwrite(void);
51int dc_getstate(void);
52int dc_queuecmd(int (*callback)(struct dc_response *), void *data, ...);
53int dc_handleread(void);
54int dc_handlewrite(void);
55int dc_connect(char *host);
56int dc_connectsync(char *host, struct dc_response **respbuf);
57int dc_connectsync2(char *host, int rev);
58struct dc_intresp *dc_interpret(struct dc_response *resp);
59void dc_freeires(struct dc_intresp *ires);
60int dc_checkprotocol(struct dc_response *resp, int revision);
61const char *dc_gethostname(void);
62int dc_getfd(void);
63
64#endif