1 | /* Copyright (c) 2001, Stanford University
|
---|
2 | * All rights reserved.
|
---|
3 | *
|
---|
4 | * See the file LICENSE.txt for information on redistributing this software.
|
---|
5 | */
|
---|
6 |
|
---|
7 | #ifndef CR_PROTOCOL_H
|
---|
8 | #define CR_PROTOCOL_H
|
---|
9 |
|
---|
10 | #include <iprt/cdefs.h>
|
---|
11 |
|
---|
12 | #ifdef __cplusplus
|
---|
13 | extern "C" {
|
---|
14 | #endif
|
---|
15 |
|
---|
16 | typedef enum {
|
---|
17 | /* first message types is 'wGL\001', so we can immediately
|
---|
18 | recognize bad message types */
|
---|
19 | CR_MESSAGE_OPCODES = 0x77474c01,
|
---|
20 | CR_MESSAGE_WRITEBACK,
|
---|
21 | CR_MESSAGE_READBACK,
|
---|
22 | CR_MESSAGE_READ_PIXELS,
|
---|
23 | CR_MESSAGE_MULTI_BODY,
|
---|
24 | CR_MESSAGE_MULTI_TAIL,
|
---|
25 | CR_MESSAGE_FLOW_CONTROL,
|
---|
26 | CR_MESSAGE_OOB,
|
---|
27 | CR_MESSAGE_NEWCLIENT,
|
---|
28 | CR_MESSAGE_GATHER,
|
---|
29 | CR_MESSAGE_ERROR,
|
---|
30 | CR_MESSAGE_CRUT,
|
---|
31 | CR_MESSAGE_REDIR_PTR
|
---|
32 | } CRMessageType;
|
---|
33 |
|
---|
34 | typedef union {
|
---|
35 | /* pointers are usually 4 bytes, but on 64-bit machines (Alpha,
|
---|
36 | * SGI-n64, etc.) they are 8 bytes. Pass network pointers around
|
---|
37 | * as an opaque array of bytes, since the interpretation & size of
|
---|
38 | * the pointer only matter to the machine which emitted the
|
---|
39 | * pointer (and will eventually receive the pointer back again) */
|
---|
40 | unsigned int ptrAlign[2];
|
---|
41 | unsigned char ptrSize[8];
|
---|
42 | /* hack to make this packet big */
|
---|
43 | /* unsigned int junk[512]; */
|
---|
44 | } CRNetworkPointer;
|
---|
45 |
|
---|
46 | typedef struct {
|
---|
47 | CRMessageType type;
|
---|
48 | unsigned int conn_id;
|
---|
49 | } CRMessageHeader;
|
---|
50 |
|
---|
51 | typedef struct CRMessageOpcodes {
|
---|
52 | CRMessageHeader header;
|
---|
53 | unsigned int numOpcodes;
|
---|
54 | } CRMessageOpcodes;
|
---|
55 |
|
---|
56 | typedef struct CRMessageRedirPtr {
|
---|
57 | CRMessageHeader header;
|
---|
58 | CRMessageHeader* pMessage;
|
---|
59 | } CRMessageRedirPtr;
|
---|
60 |
|
---|
61 | typedef struct CRMessageWriteback {
|
---|
62 | CRMessageHeader header;
|
---|
63 | CRNetworkPointer writeback_ptr;
|
---|
64 | } CRMessageWriteback;
|
---|
65 |
|
---|
66 | typedef struct CRMessageReadback {
|
---|
67 | CRMessageHeader header;
|
---|
68 | CRNetworkPointer writeback_ptr;
|
---|
69 | CRNetworkPointer readback_ptr;
|
---|
70 | } CRMessageReadback;
|
---|
71 |
|
---|
72 | typedef struct CRMessageMulti {
|
---|
73 | CRMessageHeader header;
|
---|
74 | } CRMessageMulti;
|
---|
75 |
|
---|
76 | typedef struct CRMessageFlowControl {
|
---|
77 | CRMessageHeader header;
|
---|
78 | unsigned int credits;
|
---|
79 | } CRMessageFlowControl;
|
---|
80 |
|
---|
81 | typedef struct CRMessageReadPixels {
|
---|
82 | CRMessageHeader header;
|
---|
83 | int width, height;
|
---|
84 | unsigned int bytes_per_row;
|
---|
85 | unsigned int stride;
|
---|
86 | int alignment;
|
---|
87 | int skipRows;
|
---|
88 | int skipPixels;
|
---|
89 | int rowLength;
|
---|
90 | int format;
|
---|
91 | int type;
|
---|
92 | CRNetworkPointer pixels;
|
---|
93 | } CRMessageReadPixels;
|
---|
94 |
|
---|
95 | typedef struct CRMessageNewClient {
|
---|
96 | CRMessageHeader header;
|
---|
97 | } CRMessageNewClient;
|
---|
98 |
|
---|
99 | typedef struct CRMessageGather {
|
---|
100 | CRMessageHeader header;
|
---|
101 | unsigned long offset;
|
---|
102 | unsigned long len;
|
---|
103 | } CRMessageGather;
|
---|
104 |
|
---|
105 | typedef union {
|
---|
106 | CRMessageHeader header;
|
---|
107 | CRMessageOpcodes opcodes;
|
---|
108 | CRMessageRedirPtr redirptr;
|
---|
109 | CRMessageWriteback writeback;
|
---|
110 | CRMessageReadback readback;
|
---|
111 | CRMessageReadPixels readPixels;
|
---|
112 | CRMessageMulti multi;
|
---|
113 | CRMessageFlowControl flowControl;
|
---|
114 | CRMessageNewClient newclient;
|
---|
115 | CRMessageGather gather;
|
---|
116 | } CRMessage;
|
---|
117 |
|
---|
118 | DECLEXPORT(void) crNetworkPointerWrite( CRNetworkPointer *dst, void *src );
|
---|
119 |
|
---|
120 | #ifdef __cplusplus
|
---|
121 | }
|
---|
122 | #endif
|
---|
123 |
|
---|
124 | #endif /* CR_PROTOCOL_H */
|
---|