Converted pollsocks to use select instead of poll.
[doldaconnect.git] / include / doldaconnect / uilib.h
CommitLineData
d3372da9 1#ifndef _UILIB_H
2#define _UILIB_H
3
4#include <wchar.h>
5
040118de 6#define DC_LATEST 3
691f0a70 7
8f623b36
FT
8typedef long long dc_lnum_t;
9
d3372da9 10struct dc_response
11{
12 struct dc_response *next, *prev;
13 int code, tag;
14 wchar_t *cmdname;
15 void *data;
16 void *internal;
34a61ecb 17 struct dc_respline
d3372da9 18 {
19 int argc;
20 wchar_t **argv;
21 } *rlines;
113b3e9a 22 size_t linessize;
d3372da9 23 int numlines;
24 int curline;
25};
26
27struct dc_intresp
28{
29 int code;
30 int argc;
31 struct
32 {
33 int type;
34 union
35 {
36 int num;
8f623b36 37 dc_lnum_t lnum;
d3372da9 38 wchar_t *str;
39 double flnum;
40 } val;
41 } *argv;
42};
43
e4b88cc0 44char *dc_srv_local;
45
d3372da9 46int dc_init(void);
47void dc_cleanup(void);
48void dc_disconnect(void);
49void dc_freeresp(struct dc_response *resp);
50struct dc_response *dc_getresp(void);
51struct dc_response *dc_gettaggedresp(int tag);
52struct dc_response *dc_gettaggedrespsync(int tag);
53int dc_wantwrite(void);
54int dc_getstate(void);
55int dc_queuecmd(int (*callback)(struct dc_response *), void *data, ...);
56int dc_handleread(void);
57int dc_handlewrite(void);
12383d48 58int dc_connect(char *host);
e4b88cc0 59int dc_connectsync(char *host, struct dc_response **respbuf);
60int dc_connectsync2(char *host, int rev);
d3372da9 61struct dc_intresp *dc_interpret(struct dc_response *resp);
62void dc_freeires(struct dc_intresp *ires);
691f0a70 63int dc_checkprotocol(struct dc_response *resp, int revision);
d3372da9 64const char *dc_gethostname(void);
e4b88cc0 65int dc_getfd(void);
d3372da9 66
67#endif