Added synchronous versions of connect and login.
[doldaconnect.git] / include / doldaconnect / uilib.h
CommitLineData
d3372da9 1#ifndef _UILIB_H
2#define _UILIB_H
3
4#include <wchar.h>
5
7ac0fb29 6#define DC_LATEST 2
691f0a70 7
d3372da9 8struct dc_response
9{
10 struct dc_response *next, *prev;
11 int code, tag;
12 wchar_t *cmdname;
13 void *data;
14 void *internal;
34a61ecb 15 struct dc_respline
d3372da9 16 {
17 int argc;
18 wchar_t **argv;
19 } *rlines;
113b3e9a 20 size_t linessize;
d3372da9 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
e4b88cc0 41char *dc_srv_local;
42
d3372da9 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);
12383d48 55int dc_connect(char *host);
e4b88cc0 56int dc_connectsync(char *host, struct dc_response **respbuf);
57int dc_connectsync2(char *host, int rev);
d3372da9 58struct dc_intresp *dc_interpret(struct dc_response *resp);
59void dc_freeires(struct dc_intresp *ires);
691f0a70 60int dc_checkprotocol(struct dc_response *resp, int revision);
d3372da9 61const char *dc_gethostname(void);
e4b88cc0 62int dc_getfd(void);
d3372da9 63
64#endif