aboutsummaryrefslogtreecommitdiff
path: root/nxcomp/include/NXproto.h
blob: bbc6813079ce7a106c31485412093dc85618c29a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
/**************************************************************************/
/*                                                                        */
/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com)          */
/* Copyright (c) 2008-2017 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de>  */
/* Copyright (c) 2014-2022 Ulrich Sibiller <uli42@gmx.de>                 */
/* Copyright (c) 2014-2019 Mihai Moldovan <ionic@ionic.de>                */
/* Copyright (c) 2011-2022 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com)           */
/*                                                                        */
/* NXCOMP, NX protocol compression and NX extensions to this software     */
/* are copyright of the aforementioned persons and companies.             */
/*                                                                        */
/* Redistribution and use of the present software is allowed according    */
/* to terms specified in the file LICENSE.nxcomp which comes in the       */
/* source distribution.                                                   */
/*                                                                        */
/* All rights reserved.                                                   */
/*                                                                        */
/* NOTE: This software has received contributions from various other      */
/* contributors, only the core maintainers and supporters are listed as   */
/* copyright holders. Please contact us, if you feel you should be listed */
/* as copyright holder, as well.                                          */
/*                                                                        */
/**************************************************************************/

#ifndef NXproto_H
#define NXproto_H

#ifdef __cplusplus
extern "C" {
#endif

#include <X11/X.h>
#include <X11/Xmd.h>
#include <X11/Xproto.h>

/*
 * Force the size to match the wire protocol.
 */

#define Drawable CARD32
#define GContext CARD32

#define sz_xNXGetControlParametersReq           4
#define sz_xNXGetCleanupParametersReq           4
#define sz_xNXGetImageParametersReq             4
#define sz_xNXGetUnpackParametersReq            8
#define sz_xNXGetShmemParametersReq             16
#define sz_xNXGetFontParametersReq              4
#define sz_xNXSetExposeParametersReq            8
#define sz_xNXSetCacheParametersReq             8
#define sz_xNXStartSplitReq                     8
#define sz_xNXEndSplitReq                       4
#define sz_xNXCommitSplitReq                    12
#define sz_xNXSetUnpackGeometryReq              24
#define sz_xNXSetUnpackColormapReq              16
#define sz_xNXSetUnpackAlphaReq                 16
#define sz_xNXPutPackedImageReq                 40
#define sz_xNXFreeUnpackReq                     4
#define sz_xNXFinishSplitReq                    4
#define sz_xNXAbortSplitReq                     4
#define sz_xNXFreeSplitReq                      4

#define sz_xGetControlParametersReply           32
#define sz_xGetCleanupParametersReply           32
#define sz_xGetImageParametersReply             32
#define sz_xGetUnpackParametersReply            32
#define sz_xGetShmemParametersReply             32

#define LINK_TYPE_LIMIT                         5

#define LINK_TYPE_NONE                          0
#define LINK_TYPE_MODEM                         1
#define LINK_TYPE_ISDN                          2
#define LINK_TYPE_ADSL                          3
#define LINK_TYPE_WAN                           4
#define LINK_TYPE_LAN                           5

/*
 * NX Replies.
 */

/*
 * The following reply has 4 new boolean
 * fields in the last protocol version.
 */

typedef struct _NXGetControlParametersReply {
    BYTE   type; /* Is X_Reply. */
    CARD8  linkType;
    CARD16 sequenceNumber B16;
    CARD32 length B32; /* Is 0. */
    CARD8  localMajor;
    CARD8  localMinor;
    CARD8  localPatch;
    CARD8  remoteMajor;
    CARD8  remoteMinor;
    CARD8  remotePatch;
    CARD16 splitTimeout B16;
    CARD16 motionTimeout B16;
    CARD8  splitMode;
    CARD8  pad1;
    CARD32 splitSize B32;
    CARD8  packMethod;
    CARD8  packQuality;
    CARD8  dataLevel;
    CARD8  streamLevel;
    CARD8  deltaLevel;
    CARD8  loadCache;
    CARD8  saveCache;
    CARD8  startupCache;
} xNXGetControlParametersReply;

typedef struct _NXGetCleanupParametersReply {
    BYTE   type; /* Is X_Reply. */
    BYTE   pad;
    CARD16 sequenceNumber B16;
    CARD32 length B32; /* Is 0. */
    BOOL   cleanGet;
    BOOL   cleanAlloc;
    BOOL   cleanFlush;
    BOOL   cleanSend;
    BOOL   cleanImages;
    BYTE   pad1, pad2, pad3;
    CARD32 pad4 B32;
    CARD32 pad5 B32;
    CARD32 pad6 B32;
    CARD32 pad7 B32;
} xNXGetCleanupParametersReply;

typedef struct _NXGetImageParametersReply {
    BYTE   type; /* Is X_Reply. */
    BYTE   pad;
    CARD16 sequenceNumber B16;
    CARD32 length B32; /* Is 0. */
    BOOL   imageSplit;
    BOOL   imageMask;
    BOOL   imageFrame;
    CARD8  imageMaskMethod;
    CARD8  imageSplitMethod;
    BYTE   pad1, pad2, pad3;
    CARD32 pad4 B32;
    CARD32 pad5 B32;
    CARD32 pad6 B32;
    CARD32 pad7 B32;
} xNXGetImageParametersReply;

/*
 * Data is made of PACK_METHOD_LIMIT values of
 * type BOOL telling which unpack capabilities
 * are implemented in proxy.
 */

typedef struct _NXGetUnpackParametersReply {
    BYTE   type; /* Is X_Reply. */
    BYTE   pad;
    CARD16 sequenceNumber B16;
    CARD32 length B32; /* Is PACK_METHOD_LIMIT / 4 from NXpack.h. */
    CARD8  entries;    /* Is PACK_METHOD_LIMIT. */
    BYTE   pad1, pad2, pad3;
    CARD32 pad4 B32;
    CARD32 pad5 B32;
    CARD32 pad6 B32;
    CARD32 pad7 B32;
    CARD32 pad8 B32;
} xNXGetUnpackParametersReply;

typedef struct _NXGetShmemParametersReply {
    BYTE   type;             /* Is X_Reply. */
    CARD8  stage;            /* As in the corresponding request. */
    CARD16 sequenceNumber B16;
    CARD32 length B32;       /* Is 0. */
    BOOL   clientEnabled;    /* SHM on path agent to proxy.      */
    BOOL   serverEnabled;    /* SHM on path proxy to X server.   */
    BYTE   pad1, pad2;       /* Previous values can be checked   */
    CARD32 clientSize B32;   /* at end of stage 2.               */
    CARD32 serverSize B32;
    CARD32 pad3 B32;
    CARD32 pad4 B32;
    CARD32 pad5 B32;
} xNXGetShmemParametersReply;

typedef struct _NXGetFontParametersReply {
    BYTE   type; /* Is X_Reply. */
    BYTE   pad1;
    CARD16 sequenceNumber B16;
    CARD32 length B32; /* Is length of path string + 1 / 4. */
    CARD32 pad2 B32;
    CARD32 pad3 B32;
    CARD32 pad4 B32;
    CARD32 pad5 B32;
    CARD32 pad6 B32;
    CARD32 pad7 B32;
} xNXGetFontParametersReply;

/*
 * NX Requests.
 */

typedef struct _NXGetControlParametersReq {
    CARD8  reqType;
    BYTE   pad;
    CARD16 length B16;
} xNXGetControlParametersReq;

typedef struct _NXGetCleanupParametersReq {
    CARD8  reqType;
    BYTE   pad;
    CARD16 length B16;
} xNXGetCleanupParametersReq;

typedef struct _NXGetImageParametersReq {
    CARD8  reqType;
    BYTE   pad;
    CARD16 length B16;
} xNXGetImageParametersReq;

typedef struct _NXGetUnpackParametersReq {
    CARD8  reqType;
    BYTE   pad;
    CARD16 length B16;
    CARD8  entries;
    BYTE   pad1, pad2, pad3;
} xNXGetUnpackParametersReq;

typedef struct _NXGetShmemParametersReq {
    CARD8    reqType;
    CARD8    stage;         /* It is between 0 and 2.     */
    CARD16   length B16;
    BOOL     enableClient;  /* X client side support is   */
    BOOL     enableServer;  /* not implemented yet.       */
    BYTE     pad1, pad2;
    CARD32   clientSegment; /* XID identifying the shared */
    CARD32   serverSegment; /* memory segments.           */
} xNXGetShmemParametersReq;

typedef struct _NXGetFontParametersReq {
    CARD8    reqType;
    CARD8    pad;
    CARD16   length B16;
} xNXGetFontParametersReq;

/*
 * The available split modes.
 */

#define NXSplitModeDefault              0
#define NXSplitModeAsync                1
#define NXSplitModeSync                 2

typedef struct _NXStartSplitReq {
    CARD8  reqType;
    CARD8  resource;
    CARD16 length B16;
    CARD8  mode;
    BYTE   pad1, pad2, pad3;
} xNXStartSplitReq;

typedef struct _NXEndSplitReq {
    CARD8  reqType;
    CARD8  resource;
    CARD16 length B16;
} xNXEndSplitReq;

typedef struct _NXCommitSplitReq {
    CARD8  reqType;
    CARD8  resource;
    CARD16 length B16;
    CARD8  propagate;
    CARD8  request;
    BYTE   pad1, pad2;
    CARD32 position B32;
} xNXCommitSplitReq;

typedef struct _NXFinishSplitReq {
    CARD8  reqType;
    CARD8  resource;
    CARD16 length B16;
} xNXFinishSplitReq;

typedef struct _NXAbortSplitReq {
    CARD8  reqType;
    CARD8  resource;
    CARD16 length B16;
} xNXAbortSplitReq;

typedef struct _NXFreeSplitReq {
    CARD8  reqType;
    CARD8  resource;
    CARD16 length B16;
} xNXFreeSplitReq;

typedef struct _NXSetExposeParametersReq {
    CARD8  reqType;
    BYTE   pad;
    CARD16 length B16;
    BOOL   expose;
    BOOL   graphicsExpose;
    BOOL   noExpose;
    BYTE   pad1;
} xNXSetExposeParametersReq;

typedef struct _NXSetCacheParametersReq {
    CARD8  reqType;
    BYTE   pad;
    CARD16 length B16;
    BOOL   enableCache;
    BOOL   enableSplit;
    BOOL   enableSave;
    BOOL   enableLoad;
} xNXSetCacheParametersReq;

typedef struct _NXSetUnpackGeometryReq {
    CARD8  reqType;
    CARD8  resource;
    CARD16 length B16;
    CARD8  depth1Bpp;
    CARD8  depth4Bpp;
    CARD8  depth8Bpp;
    CARD8  depth16Bpp;
    CARD8  depth24Bpp;
    CARD8  depth32Bpp;
    BYTE   pad1, pad2;
    CARD32 redMask B32;
    CARD32 greenMask B32;
    CARD32 blueMask B32;
} xNXSetUnpackGeometryReq;

typedef struct _NXSetUnpackColormapReq {
    CARD8  reqType;
    CARD8  resource;
    CARD16 length B16;
    CARD8  method;
    BYTE   pad1, pad2, pad3;
    CARD32 srcLength B32;
    CARD32 dstLength B32;
} xNXSetUnpackColormapReq;

typedef struct _NXSetUnpackAlphaReq {
    CARD8  reqType;
    CARD8  resource;
    CARD16 length B16;
    CARD8  method;
    BYTE   pad1, pad2, pad3;
    CARD32 srcLength B32;
    CARD32 dstLength B32;
} xNXSetUnpackAlphaReq;

typedef struct _NXPutPackedImageReq {
    CARD8    reqType;
    CARD8    resource;
    CARD16   length B16;
    Drawable drawable B32;
    GContext gc B32;
    CARD8    method;
    CARD8    format;
    CARD8    srcDepth;
    CARD8    dstDepth;
    CARD32   srcLength B32;
    CARD32   dstLength B32;
    INT16    srcX B16, srcY B16;
    CARD16   srcWidth B16, srcHeight B16;
    INT16    dstX B16, dstY B16;
    CARD16   dstWidth B16, dstHeight B16;
} xNXPutPackedImageReq;

typedef struct _NXFreeUnpackReq {
    CARD8  reqType;
    CARD8  resource;
    CARD16 length B16;
} xNXFreeUnpackReq;

/*
 * The X_NXSplitData and X_NXSplitEvent opcodes
 * are used internally and are ignored if coming
 * from the agent.
 */

#define X_NXInternalGenericData         0
#define X_NXInternalGenericReply        1
#define X_NXInternalGenericRequest      255

#define X_NXInternalShapeExtension      128
#define X_NXInternalRenderExtension     129

#define X_NXFirstOpcode                 230
#define X_NXLastOpcode                  252

#define X_NXGetControlParameters        230
#define X_NXGetCleanupParameters        231
#define X_NXGetImageParameters          232
#define X_NXGetUnpackParameters         233
#define X_NXStartSplit                  234
#define X_NXEndSplit                    235
#define X_NXSplitData                   236
#define X_NXCommitSplit                 237
#define X_NXSetExposeParameters         240
#define X_NXSetUnpackGeometry           241
#define X_NXSetUnpackColormap           242
#define X_NXPutPackedImage              243
#define X_NXSplitEvent                  244
#define X_NXGetShmemParameters          245
#define X_NXSetUnpackAlpha              246
#define X_NXFreeUnpack                  247
#define X_NXFinishSplit                 248
#define X_NXAbortSplit                  249
#define X_NXFreeSplit                   250
#define X_NXGetFontParameters           251
#define X_NXSetCacheParameters          252

/*
 * The following events are received by the agent
 * in the form of a ClientMessage with the value
 * 0 in fields atom and window. The format is
 * always 32. Event specific data starts at byte
 * offset 12.
 *
 * These events are sent by the NX transport to
 * notify the agent about the result of a split
 * operation.
 */

#define NXNoSplitNotify                 1
#define NXStartSplitNotify              2
#define NXCommitSplitNotify             3
#define NXEndSplitNotify                4
#define NXEmptySplitNotify              5

/*
 * Notifications of collect events. These events
 * don't come from the NX transport but are put
 * back in client's event queue by NXlib.
 */

#define NXCollectImageNotify            8
#define NXCollectPropertyNotify         9
#define NXCollectGrabPointerNotify      10
#define NXCollectInputFocusNotify       11

#undef Drawable
#undef GContext

#ifdef __cplusplus
}
#endif

#endif /* NXproto_H */