Add dc_checkprotocol and DC_LATEST.
[doldaconnect.git] / include / doldaconnect / uilib.h
CommitLineData
d3372da9 1#ifndef _UILIB_H
2#define _UILIB_H
3
4#include <wchar.h>
5
691f0a70 6#define DC_LATEST 1
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
41int dc_init(void);
42void dc_cleanup(void);
43void dc_disconnect(void);
44void dc_freeresp(struct dc_response *resp);
45struct dc_response *dc_getresp(void);
46struct dc_response *dc_gettaggedresp(int tag);
47struct dc_response *dc_gettaggedrespsync(int tag);
48int dc_wantwrite(void);
49int dc_getstate(void);
50int dc_queuecmd(int (*callback)(struct dc_response *), void *data, ...);
51int dc_handleread(void);
52int dc_handlewrite(void);
12383d48 53int dc_connect(char *host);
d3372da9 54struct dc_intresp *dc_interpret(struct dc_response *resp);
55void dc_freeires(struct dc_intresp *ires);
691f0a70 56int dc_checkprotocol(struct dc_response *resp, int revision);
d3372da9 57const char *dc_gethostname(void);
58
59#endif