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 | /*For now guest is allowed to connect host opengl service if protocol version matches exactly*/
|
---|
17 | /*Note: that after any change to this file, or glapi_parser\apispec.txt version should be changed*/
|
---|
18 | #define CR_PROTOCOL_VERSION_MAJOR 7
|
---|
19 | #define CR_PROTOCOL_VERSION_MINOR 1
|
---|
20 |
|
---|
21 | typedef enum {
|
---|
22 | /* first message types is 'wGL\001', so we can immediately
|
---|
23 | recognize bad message types */
|
---|
24 | CR_MESSAGE_OPCODES = 0x77474c01,
|
---|
25 | CR_MESSAGE_WRITEBACK,
|
---|
26 | CR_MESSAGE_READBACK,
|
---|
27 | CR_MESSAGE_READ_PIXELS,
|
---|
28 | CR_MESSAGE_MULTI_BODY,
|
---|
29 | CR_MESSAGE_MULTI_TAIL,
|
---|
30 | CR_MESSAGE_FLOW_CONTROL,
|
---|
31 | CR_MESSAGE_OOB,
|
---|
32 | CR_MESSAGE_NEWCLIENT,
|
---|
33 | CR_MESSAGE_GATHER,
|
---|
34 | CR_MESSAGE_ERROR,
|
---|
35 | CR_MESSAGE_CRUT,
|
---|
36 | CR_MESSAGE_REDIR_PTR
|
---|
37 | } CRMessageType;
|
---|
38 |
|
---|
39 | typedef union {
|
---|
40 | /* pointers are usually 4 bytes, but on 64-bit machines (Alpha,
|
---|
41 | * SGI-n64, etc.) they are 8 bytes. Pass network pointers around
|
---|
42 | * as an opaque array of bytes, since the interpretation & size of
|
---|
43 | * the pointer only matter to the machine which emitted the
|
---|
44 | * pointer (and will eventually receive the pointer back again) */
|
---|
45 | unsigned int ptrAlign[2];
|
---|
46 | unsigned char ptrSize[8];
|
---|
47 | /* hack to make this packet big */
|
---|
48 | /* unsigned int junk[512]; */
|
---|
49 | } CRNetworkPointer;
|
---|
50 |
|
---|
51 | typedef struct {
|
---|
52 | CRMessageType type;
|
---|
53 | unsigned int conn_id;
|
---|
54 | } CRMessageHeader;
|
---|
55 |
|
---|
56 | typedef struct CRMessageOpcodes {
|
---|
57 | CRMessageHeader header;
|
---|
58 | unsigned int numOpcodes;
|
---|
59 | } CRMessageOpcodes;
|
---|
60 |
|
---|
61 | typedef struct CRMessageRedirPtr {
|
---|
62 | CRMessageHeader header;
|
---|
63 | CRMessageHeader* pMessage;
|
---|
64 | } CRMessageRedirPtr;
|
---|
65 |
|
---|
66 | typedef struct CRMessageWriteback {
|
---|
67 | CRMessageHeader header;
|
---|
68 | CRNetworkPointer writeback_ptr;
|
---|
69 | } CRMessageWriteback;
|
---|
70 |
|
---|
71 | typedef struct CRMessageReadback {
|
---|
72 | CRMessageHeader header;
|
---|
73 | CRNetworkPointer writeback_ptr;
|
---|
74 | CRNetworkPointer readback_ptr;
|
---|
75 | } CRMessageReadback;
|
---|
76 |
|
---|
77 | typedef struct CRMessageMulti {
|
---|
78 | CRMessageHeader header;
|
---|
79 | } CRMessageMulti;
|
---|
80 |
|
---|
81 | typedef struct CRMessageFlowControl {
|
---|
82 | CRMessageHeader header;
|
---|
83 | unsigned int credits;
|
---|
84 | } CRMessageFlowControl;
|
---|
85 |
|
---|
86 | typedef struct CRMessageReadPixels {
|
---|
87 | CRMessageHeader header;
|
---|
88 | int width, height;
|
---|
89 | unsigned int bytes_per_row;
|
---|
90 | unsigned int stride;
|
---|
91 | int alignment;
|
---|
92 | int skipRows;
|
---|
93 | int skipPixels;
|
---|
94 | int rowLength;
|
---|
95 | int format;
|
---|
96 | int type;
|
---|
97 | CRNetworkPointer pixels;
|
---|
98 | } CRMessageReadPixels;
|
---|
99 |
|
---|
100 | typedef struct CRMessageNewClient {
|
---|
101 | CRMessageHeader header;
|
---|
102 | } CRMessageNewClient;
|
---|
103 |
|
---|
104 | typedef struct CRMessageGather {
|
---|
105 | CRMessageHeader header;
|
---|
106 | unsigned long offset;
|
---|
107 | unsigned long len;
|
---|
108 | } CRMessageGather;
|
---|
109 |
|
---|
110 | typedef union {
|
---|
111 | CRMessageHeader header;
|
---|
112 | CRMessageOpcodes opcodes;
|
---|
113 | CRMessageRedirPtr redirptr;
|
---|
114 | CRMessageWriteback writeback;
|
---|
115 | CRMessageReadback readback;
|
---|
116 | CRMessageReadPixels readPixels;
|
---|
117 | CRMessageMulti multi;
|
---|
118 | CRMessageFlowControl flowControl;
|
---|
119 | CRMessageNewClient newclient;
|
---|
120 | CRMessageGather gather;
|
---|
121 | } CRMessage;
|
---|
122 |
|
---|
123 | DECLEXPORT(void) crNetworkPointerWrite( CRNetworkPointer *dst, void *src );
|
---|
124 |
|
---|
125 | #ifdef __cplusplus
|
---|
126 | }
|
---|
127 | #endif
|
---|
128 |
|
---|
129 | #endif /* CR_PROTOCOL_H */
|
---|