initial commit
[xdos] / src / proto.h
1 #ifndef PROTO_H_
2 #define PROTO_H_
3
4 #include "xtypes.h"
5
6 #define PROTO_MAJOR             11
7 #define PROTO_MINOR             0
8
9 struct xconn_setup_header {
10         char byteorder, unused1;
11         CARD16 proto_major, proto_minor;
12         CARD16 auth_name_length;
13         CARD16 auth_data_length;
14         CARD16 unused2;
15         /* then followed by:
16          * - n auth_name bytes
17          * - pad to next 32bit-aligned address
18          * - m auth_data bytes
19          * - pad to next 32bit-aligned address
20          */
21 };
22
23 struct xconn_accept_header {
24         CARD8 success, unused1;
25         CARD16 proto_major, proto_minor;
26         CARD16 add_length;      /* 8+2*numfmt+(vendor_len+pad+m?)/4 */
27         CARD32 release;
28         CARD32 resid_base, resid_mask;
29         CARD32 motionbuf_size;
30         CARD16 vendor_length;
31         CARD16 max_req_length;
32         CARD8 num_screens;
33         CARD8 num_pixfmt;
34         CARD8 img_byteorder;
35         CARD8 bm_fmt_bitorder;
36         CARD8 bm_fmt_scanline_unit;
37         CARD8 bm_fmt_scanline_pad;
38         KEYCODE min_keycode, max_keycode;
39         CARD32 unused2;
40         /* followed by:
41          * - vendor string of size vendor_length
42          * - pad to next 32bit-aligned address
43          * - 8*num_pixfmt pixel formats
44          * - list of screens (multiple of 4?)
45          */
46 };
47
48 struct xformat {
49         CARD8 depth;
50         CARD8 bpp;
51         CARD8 scanline_pad;
52         char unused[5];
53 };
54
55 struct xrequest_header {
56         CARD8 major;
57         CARD8 data;
58         CARD16 length;
59 };
60
61 struct xreply {
62         CARD32 length;
63         CARD16 req;
64         char data[28];
65 };
66
67 struct xerror {
68         CARD8 error;
69         CARD8 code;
70         CARD16 seqnum;
71         char data[28];
72 };
73
74 struct xevent {
75         CARD8 code;
76         CARD8 detail;
77         CARD16 seqnum;
78         char data[28];
79 };
80
81 /* in-place byteorder swapping functions for all protocol structures */
82 void swap_xconn_accept(struct xconn_accept_header *hdr);
83
84 void swap_xreq_header(struct xrequest_header *hdr);
85 /* TODO: all possible requests */
86
87 #endif  /* PROTO_H_ */