blob: f1502c41651975073f41e4fbe1d1ef53f77f6e14 [file] [log] [blame]
Constantin Kaplinskyb30ae7f2006-05-25 05:04:46 +00001/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
2 *
3 * This is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This software is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this software; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16 * USA.
17 */
18#ifndef _VNCEXT_H_
19#define _VNCEXT_H_
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25#define X_VncExtSetParam 0
26#define X_VncExtGetParam 1
27#define X_VncExtGetParamDesc 2
28#define X_VncExtListParams 3
29#define X_VncExtSetServerCutText 4
30#define X_VncExtGetClientCutText 5
31#define X_VncExtSelectInput 6
32#define X_VncExtConnect 7
33#define X_VncExtGetQueryConnect 8
34#define X_VncExtApproveConnect 9
35
36#define VncExtClientCutTextNotify 0
37#define VncExtSelectionChangeNotify 1
38#define VncExtQueryConnectNotify 2
39#define VncExtClientCutTextMask (1 << VncExtClientCutTextNotify)
40#define VncExtSelectionChangeMask (1 << VncExtSelectionChangeNotify)
41#define VncExtQueryConnectMask (1 << VncExtQueryConnectNotify)
42
43#define VncExtNumberEvents 3
44#define VncExtNumberErrors 0
45
46#ifndef _VNCEXT_SERVER_
47
48Bool XVncExtQueryExtension(Display* dpy, int* event_basep, int* error_basep);
49Bool XVncExtSetParam(Display* dpy, const char* param);
50Bool XVncExtGetParam(Display* dpy, const char* param, char** value, int* len);
51char* XVncExtGetParamDesc(Display* dpy, const char* param);
52char** XVncExtListParams(Display* dpy, int* nParams);
53void XVncExtFreeParamList(char** list);
54Bool XVncExtSetServerCutText(Display* dpy, const char* str, int len);
55Bool XVncExtGetClientCutText(Display* dpy, char** str, int* len);
56Bool XVncExtSelectInput(Display* dpy, Window w, int mask);
57Bool XVncExtConnect(Display* dpy, char* hostAndPort);
58Bool XVncExtGetQueryConnect(Display* dpy, char** addr,
59 char** user, int* timeout, void** opaqueId);
60Bool XVncExtApproveConnect(Display* dpy, void* opaqueId, int approve);
61
62
63typedef struct {
64 int type;
65 unsigned long serial;
66 Bool send_event;
67 Display *display;
68 Window window;
69 Time time;
70} XVncExtClientCutTextEvent;
71
72typedef struct {
73 int type;
74 unsigned long serial;
75 Bool send_event;
76 Display *display;
77 Window window;
78 Atom selection;
79} XVncExtSelectionChangeEvent;
80
81typedef struct {
82 int type;
83 unsigned long serial;
84 Bool send_event;
85 Display *display;
86 Window window;
87} XVncExtQueryConnectEvent;
88
89#endif
90
91#ifdef _VNCEXT_PROTO_
92
93#define VNCEXTNAME "VNC-EXTENSION"
94
95typedef struct {
96 CARD8 reqType; /* always VncExtReqCode */
97 CARD8 vncExtReqType; /* always VncExtSetParam */
98 CARD16 length B16;
99 CARD8 paramLen;
100 CARD8 pad0;
101 CARD16 pad1 B16;
102} xVncExtSetParamReq;
103#define sz_xVncExtSetParamReq 8
104
105typedef struct {
106 BYTE type; /* X_Reply */
107 BYTE success;
108 CARD16 sequenceNumber B16;
109 CARD32 length B32;
110 CARD32 pad0 B32;
111 CARD32 pad1 B32;
112 CARD32 pad2 B32;
113 CARD32 pad3 B32;
114 CARD32 pad4 B32;
115 CARD32 pad5 B32;
116} xVncExtSetParamReply;
117#define sz_xVncExtSetParamReply 32
118
119
120typedef struct {
121 CARD8 reqType; /* always VncExtReqCode */
122 CARD8 vncExtReqType; /* always VncExtGetParam */
123 CARD16 length B16;
124 CARD8 paramLen;
125 CARD8 pad0;
126 CARD16 pad1 B16;
127} xVncExtGetParamReq;
128#define sz_xVncExtGetParamReq 8
129
130typedef struct {
131 BYTE type; /* X_Reply */
132 BYTE success;
133 CARD16 sequenceNumber B16;
134 CARD32 length B32;
135 CARD16 valueLen B16;
136 CARD16 pad0 B16;
137 CARD32 pad1 B32;
138 CARD32 pad2 B32;
139 CARD32 pad3 B32;
140 CARD32 pad4 B32;
141 CARD32 pad5 B32;
142} xVncExtGetParamReply;
143#define sz_xVncExtGetParamReply 32
144
145
146typedef struct {
147 CARD8 reqType; /* always VncExtReqCode */
148 CARD8 vncExtReqType; /* always VncExtGetParamDesc */
149 CARD16 length B16;
150 CARD8 paramLen;
151 CARD8 pad0;
152 CARD16 pad1 B16;
153} xVncExtGetParamDescReq;
154#define sz_xVncExtGetParamDescReq 8
155
156typedef struct {
157 BYTE type; /* X_Reply */
158 BYTE success;
159 CARD16 sequenceNumber B16;
160 CARD32 length B32;
161 CARD16 descLen B16;
162 CARD16 pad0 B16;
163 CARD32 pad1 B32;
164 CARD32 pad2 B32;
165 CARD32 pad3 B32;
166 CARD32 pad4 B32;
167 CARD32 pad5 B32;
168} xVncExtGetParamDescReply;
169#define sz_xVncExtGetParamDescReply 32
170
171
172typedef struct {
173 CARD8 reqType; /* always VncExtReqCode */
174 CARD8 vncExtReqType; /* always VncExtListParams */
175 CARD16 length B16;
176} xVncExtListParamsReq;
177#define sz_xVncExtListParamsReq 4
178
179typedef struct {
180 BYTE type; /* X_Reply */
181 BYTE pad0;
182 CARD16 sequenceNumber B16;
183 CARD32 length B32;
184 CARD16 nParams B16;
185 CARD16 pad1 B16;
186 CARD32 pad2 B32;
187 CARD32 pad3 B32;
188 CARD32 pad4 B32;
189 CARD32 pad5 B32;
190 CARD32 pad6 B32;
191} xVncExtListParamsReply;
192#define sz_xVncExtListParamsReply 32
193
194
195typedef struct {
196 CARD8 reqType; /* always VncExtReqCode */
197 CARD8 vncExtReqType; /* always VncExtSetServerCutText */
198 CARD16 length B16;
199 CARD32 textLen B32;
200} xVncExtSetServerCutTextReq;
201#define sz_xVncExtSetServerCutTextReq 8
202
203
204typedef struct {
205 CARD8 reqType; /* always VncExtReqCode */
206 CARD8 vncExtReqType; /* always VncExtGetClientCutText */
207 CARD16 length B16;
208} xVncExtGetClientCutTextReq;
209#define sz_xVncExtGetClientCutTextReq 4
210
211typedef struct {
212 BYTE type; /* X_Reply */
213 BYTE pad0;
214 CARD16 sequenceNumber B16;
215 CARD32 length B32;
216 CARD32 textLen B32;
217 CARD32 pad1 B32;
218 CARD32 pad2 B32;
219 CARD32 pad3 B32;
220 CARD32 pad4 B32;
221 CARD32 pad5 B32;
222} xVncExtGetClientCutTextReply;
223#define sz_xVncExtGetClientCutTextReply 32
224
225
226typedef struct {
227 CARD8 reqType; /* always VncExtReqCode */
228 CARD8 vncExtReqType; /* always VncExtSelectInput */
229 CARD16 length B16;
230 CARD32 window B32;
231 CARD32 mask B32;
232} xVncExtSelectInputReq;
233#define sz_xVncExtSelectInputReq 12
234
235
236typedef struct {
237 CARD8 reqType; /* always VncExtReqCode */
238 CARD8 vncExtReqType; /* always VncExtConnect */
239 CARD16 length B16;
240 CARD8 strLen;
241 CARD8 pad0;
242 CARD16 pad1 B16;
243} xVncExtConnectReq;
244#define sz_xVncExtConnectReq 8
245
246typedef struct {
247 BYTE type; /* X_Reply */
248 BYTE success;
249 CARD16 sequenceNumber B16;
250 CARD32 length B32;
251 CARD32 pad0 B32;
252 CARD32 pad1 B32;
253 CARD32 pad2 B32;
254 CARD32 pad3 B32;
255 CARD32 pad4 B32;
256 CARD32 pad5 B32;
257} xVncExtConnectReply;
258#define sz_xVncExtConnectReply 32
259
260
261typedef struct {
262 CARD8 reqType; /* always VncExtReqCode */
263 CARD8 vncExtReqType; /* always VncExtGetQueryConnect */
264 CARD16 length B16;
265} xVncExtGetQueryConnectReq;
266#define sz_xVncExtGetQueryConnectReq 4
267
268typedef struct {
269 BYTE type; /* X_Reply */
270 BYTE pad0;
271 CARD16 sequenceNumber B16;
272 CARD32 length B32;
273 CARD32 addrLen B32;
274 CARD32 userLen B32;
275 CARD32 timeout B32;
276 CARD32 opaqueId B32;
277 CARD32 pad4 B32;
278 CARD32 pad5 B32;
279} xVncExtGetQueryConnectReply;
280#define sz_xVncExtGetQueryConnectReply 32
281
282typedef struct {
283 CARD8 reqType; /* always VncExtReqCode */
284 CARD8 vncExtReqType; /* always VncExtApproveConnect */
285 CARD16 length B16;
286 CARD8 approve;
287 CARD8 pad0;
288 CARD16 pad1;
289 CARD32 opaqueId B32;
290} xVncExtApproveConnectReq;
291#define sz_xVncExtApproveConnectReq 12
292
293
294
295typedef struct {
296 BYTE type; /* always eventBase + VncExtClientCutTextNotify */
297 BYTE pad0;
298 CARD16 sequenceNumber B16;
299 CARD32 window B32;
300 CARD32 time B32;
301 CARD32 pad1 B32;
302 CARD32 pad2 B32;
303 CARD32 pad3 B32;
304 CARD32 pad4 B32;
305 CARD32 pad5 B32;
306} xVncExtClientCutTextNotifyEvent;
307#define sz_xVncExtClientCutTextNotifyEvent 32
308
309typedef struct {
310 BYTE type; /* always eventBase + VncExtSelectionChangeNotify */
311 BYTE pad0;
312 CARD16 sequenceNumber B16;
313 CARD32 window B32;
314 CARD32 selection B32;
315 CARD32 pad1 B32;
316 CARD32 pad2 B32;
317 CARD32 pad3 B32;
318 CARD32 pad4 B32;
319 CARD32 pad5 B32;
320} xVncExtSelectionChangeNotifyEvent;
321#define sz_xVncExtSelectionChangeNotifyEvent 32
322
323typedef struct {
324 BYTE type; /* always eventBase + VncExtQueryConnectNotify */
325 BYTE pad0;
326 CARD16 sequenceNumber B16;
327 CARD32 window B32;
328 CARD32 pad6 B32;
329 CARD32 pad1 B32;
330 CARD32 pad2 B32;
331 CARD32 pad3 B32;
332 CARD32 pad4 B32;
333 CARD32 pad5 B32;
334} xVncExtQueryConnectNotifyEvent;
335#define sz_xVncExtQueryConnectNotifyEvent 32
336
337#endif
338
339#ifdef __cplusplus
340}
341#endif
342
343#endif