1/*
2   Copyright (c) 2002  XFree86 Inc
3*/
4
5#ifndef _XRESPROTO_H
6#define _XRESPROTO_H
7
8#define XRES_MAJOR_VERSION 1
9#define XRES_MINOR_VERSION 2
10
11#define XRES_NAME "X-Resource"
12
13/* v1.0 */
14#define X_XResQueryVersion            0
15#define X_XResQueryClients            1
16#define X_XResQueryClientResources    2
17#define X_XResQueryClientPixmapBytes  3
18
19/* Version 1.1 has been accidentally released from the version           */
20/* control and while it doesn't have differences to version 1.0, the     */
21/* next version is labeled 1.2 in order to remove the risk of confusion. */
22
23/* v1.2 */
24#define X_XResQueryClientIds          4
25#define X_XResQueryResourceBytes      5
26
27typedef struct {
28   CARD32 resource_base;
29   CARD32 resource_mask;
30} xXResClient;
31#define sz_xXResClient 8
32
33typedef struct {
34   CARD32 resource_type;
35   CARD32 count;
36} xXResType;
37#define sz_xXResType 8
38
39/* XResQueryVersion */
40
41typedef struct _XResQueryVersion {
42   CARD8   reqType;
43   CARD8   XResReqType;
44   CARD16  length;
45   CARD8   client_major;
46   CARD8   client_minor;
47   CARD16  unused;
48} xXResQueryVersionReq;
49#define sz_xXResQueryVersionReq 8
50
51typedef struct {
52   CARD8   type;
53   CARD8   pad1;
54   CARD16  sequenceNumber;
55   CARD32  length;
56   CARD16  server_major;
57   CARD16  server_minor;
58   CARD32  pad2;
59   CARD32  pad3;
60   CARD32  pad4;
61   CARD32  pad5;
62   CARD32  pad6;
63} xXResQueryVersionReply;
64#define sz_xXResQueryVersionReply  32
65
66/* XResQueryClients */
67
68typedef struct _XResQueryClients {
69   CARD8   reqType;
70   CARD8   XResReqType;
71   CARD16  length;
72} xXResQueryClientsReq;
73#define sz_xXResQueryClientsReq 4
74
75typedef struct {
76   CARD8   type;
77   CARD8   pad1;
78   CARD16  sequenceNumber;
79   CARD32  length;
80   CARD32  num_clients;
81   CARD32  pad2;
82   CARD32  pad3;
83   CARD32  pad4;
84   CARD32  pad5;
85   CARD32  pad6;
86} xXResQueryClientsReply;
87#define sz_xXResQueryClientsReply  32
88
89/* XResQueryClientResources */
90
91typedef struct _XResQueryClientResources {
92   CARD8   reqType;
93   CARD8   XResReqType;
94   CARD16  length;
95   CARD32  xid;
96} xXResQueryClientResourcesReq;
97#define sz_xXResQueryClientResourcesReq 8
98
99typedef struct {
100   CARD8   type;
101   CARD8   pad1;
102   CARD16  sequenceNumber;
103   CARD32  length;
104   CARD32  num_types;
105   CARD32  pad2;
106   CARD32  pad3;
107   CARD32  pad4;
108   CARD32  pad5;
109   CARD32  pad6;
110} xXResQueryClientResourcesReply;
111#define sz_xXResQueryClientResourcesReply  32
112
113/* XResQueryClientPixmapBytes */
114
115typedef struct _XResQueryClientPixmapBytes {
116   CARD8   reqType;
117   CARD8   XResReqType;
118   CARD16  length;
119   CARD32  xid;
120} xXResQueryClientPixmapBytesReq;
121#define sz_xXResQueryClientPixmapBytesReq 8
122
123typedef struct {
124   CARD8   type;
125   CARD8   pad1;
126   CARD16  sequenceNumber;
127   CARD32  length;
128   CARD32  bytes;
129   CARD32  bytes_overflow;
130   CARD32  pad2;
131   CARD32  pad3;
132   CARD32  pad4;
133   CARD32  pad5;
134} xXResQueryClientPixmapBytesReply;
135#define sz_xXResQueryClientPixmapBytesReply  32
136
137/* v1.2 XResQueryClientIds */
138
139#define X_XResClientXIDMask      0x01
140#define X_XResLocalClientPIDMask 0x02
141
142typedef struct _XResClientIdSpec {
143   CARD32  client;
144   CARD32  mask;
145} xXResClientIdSpec;
146#define sz_xXResClientIdSpec 8
147
148typedef struct _XResClientIdValue {
149   xXResClientIdSpec spec;
150   CARD32  length;
151   // followed by length CARD32s
152} xXResClientIdValue;
153#define sz_xResClientIdValue (sz_xXResClientIdSpec + 4)
154
155typedef struct _XResQueryClientIds {
156   CARD8   reqType;
157   CARD8   XResReqType;
158   CARD16  length;
159   CARD32  numSpecs;
160   // followed by numSpecs times XResClientIdSpec
161} xXResQueryClientIdsReq;
162#define sz_xXResQueryClientIdsReq 8
163
164typedef struct {
165   CARD8   type;
166   CARD8   pad1;
167   CARD16  sequenceNumber;
168   CARD32  length;
169   CARD32  numIds;
170   CARD32  pad2;
171   CARD32  pad3;
172   CARD32  pad4;
173   CARD32  pad5;
174   CARD32  pad6;
175   // followed by numIds times XResClientIdValue
176} xXResQueryClientIdsReply;
177#define sz_xXResQueryClientIdsReply  32
178
179/* v1.2 XResQueryResourceBytes */
180
181typedef struct _XResResourceIdSpec {
182   CARD32  resource;
183   CARD32  type;
184} xXResResourceIdSpec;
185#define sz_xXResResourceIdSpec 8
186
187typedef struct _XResQueryResourceBytes {
188   CARD8   reqType;
189   CARD8   XResReqType;
190   CARD16  length;
191   CARD32  client;
192   CARD32  numSpecs;
193   // followed by numSpecs times XResResourceIdSpec
194} xXResQueryResourceBytesReq;
195#define sz_xXResQueryResourceBytesReq 12
196
197typedef struct _XResResourceSizeSpec {
198   xXResResourceIdSpec spec;
199   CARD32  bytes;
200   CARD32  refCount;
201   CARD32  useCount;
202} xXResResourceSizeSpec;
203#define sz_xXResResourceSizeSpec (sz_xXResResourceIdSpec + 12)
204
205typedef struct _XResResourceSizeValue {
206   xXResResourceSizeSpec size;
207   CARD32  numCrossReferences;
208   // followed by numCrossReferences times XResResourceSizeSpec
209} xXResResourceSizeValue;
210#define sz_xXResResourceSizeValue (sz_xXResResourceSizeSpec + 4)
211
212typedef struct {
213   CARD8   type;
214   CARD8   pad1;
215   CARD16  sequenceNumber;
216   CARD32  length;
217   CARD32  numSizes;
218   CARD32  pad2;
219   CARD32  pad3;
220   CARD32  pad4;
221   CARD32  pad5;
222   CARD32  pad6;
223   // followed by numSizes times XResResourceSizeValue
224} xXResQueryResourceBytesReply;
225#define sz_xXResQueryResourceBytesReply  32
226
227#endif /* _XRESPROTO_H */
228