1 | /** @file
|
---|
2 | * VBox Remote Desktop Protocol:
|
---|
3 | * Public APIs.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2007 innotek GmbH
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License as published by the Free Software Foundation,
|
---|
13 | * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
14 | * distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
15 | * be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * If you received this file as part of a commercial VirtualBox
|
---|
18 | * distribution, then only the terms of your commercial VirtualBox
|
---|
19 | * license agreement apply instead of the previous paragraph.
|
---|
20 | */
|
---|
21 |
|
---|
22 | #ifndef __VBox_vrdpapi_h__
|
---|
23 | #define __VBox_vrdpapi_h__
|
---|
24 |
|
---|
25 | #include <VBox/cdefs.h>
|
---|
26 | #include <VBox/types.h>
|
---|
27 |
|
---|
28 | #ifdef IN_RING0
|
---|
29 | # error "There are no VRDP APIs available in Ring-0 Host Context!"
|
---|
30 | #endif
|
---|
31 | #ifdef IN_GC
|
---|
32 | # error "There are no VRDP APIs available Guest Context!"
|
---|
33 | #endif
|
---|
34 |
|
---|
35 |
|
---|
36 | /** @defgroup grp_vrdp VRDP
|
---|
37 | * VirtualBox Remote Desktop Protocol (VRDP) interface that lets to use
|
---|
38 | * the VRDP server.
|
---|
39 | * @{
|
---|
40 | */
|
---|
41 |
|
---|
42 | /** Default port that VRDP binds to. */
|
---|
43 | #define VRDP_DEFAULT_PORT (3389)
|
---|
44 |
|
---|
45 | __BEGIN_DECLS
|
---|
46 |
|
---|
47 | /* Forward declaration of the VRDP server instance handle. */
|
---|
48 | #ifdef __cplusplus
|
---|
49 | class VRDPServer;
|
---|
50 | typedef class VRDPServer *HVRDPSERVER;
|
---|
51 | #else
|
---|
52 | struct VRDPServer;
|
---|
53 | typedef struct VRDPServer *HVRDPSERVER;
|
---|
54 | #endif /* __cplusplus */
|
---|
55 |
|
---|
56 | /**
|
---|
57 | * Start server for the specified IConsole.
|
---|
58 | *
|
---|
59 | * @return VBox status code
|
---|
60 | * @param pconsole Pointer to IConsole instance to fetch display, mouse and keyboard interfaces.
|
---|
61 | * @param pvrdpserver Pointer to IVRDPServer instance to fetch configuration.
|
---|
62 | * @param phserver Pointer to server instance handle,
|
---|
63 | * created by the function.
|
---|
64 | */
|
---|
65 | VRDPR3DECL(int) VRDPStartServer (IConsole *pconsole, IVRDPServer *pvrdpserver, HVRDPSERVER *phserver);
|
---|
66 |
|
---|
67 |
|
---|
68 | /**
|
---|
69 | * Shutdown server.
|
---|
70 | *
|
---|
71 | * @param hserver Handle of VRDP server instance to be stopped.
|
---|
72 | */
|
---|
73 | VRDPR3DECL(void) VRDPShutdownServer (HVRDPSERVER hserver);
|
---|
74 |
|
---|
75 |
|
---|
76 | /**
|
---|
77 | * Send framebuffer bitmap to client.
|
---|
78 | *
|
---|
79 | * @param hserver Handle of VRDP server instance.
|
---|
80 | * @param x top left horizontal coordinate in framebuffer.
|
---|
81 | * @param y top left vertical coordinate in framebuffer.
|
---|
82 | * @param w width of rectangle.
|
---|
83 | * @param h height of rectangle.
|
---|
84 | */
|
---|
85 | VRDPR3DECL(void) VRDPSendUpdateBitmap (HVRDPSERVER hserver, unsigned uScreenId, unsigned x, unsigned y, unsigned w, unsigned h);
|
---|
86 |
|
---|
87 | /**
|
---|
88 | * Inform client that display was resized.
|
---|
89 | * New width and height are taken from the current framebuffer.
|
---|
90 | *
|
---|
91 | * @param hserver Handle of VRDP server instance.
|
---|
92 | */
|
---|
93 | VRDPR3DECL(void) VRDPSendResize (HVRDPSERVER hserver);
|
---|
94 |
|
---|
95 | /**
|
---|
96 | * Send an update in accelerated mode.
|
---|
97 | *
|
---|
98 | * @param hserver Handle of VRDP server instance.
|
---|
99 | * @param pvUpdate The update information. Actually pointer to VBoxGuest.h::VBVACMDHDR structure with extra data.
|
---|
100 | * @param cbUpdate Size of the update data.
|
---|
101 | */
|
---|
102 | VRDPR3DECL(void) VRDPSendUpdate (HVRDPSERVER hserver, unsigned uScreenId, void *pvUpdate, uint32_t cbUpdate);
|
---|
103 |
|
---|
104 | /** @todo comment the structure. */
|
---|
105 | typedef struct _VRDPCOLORPOINTER
|
---|
106 | {
|
---|
107 | uint16_t xHot;
|
---|
108 | uint16_t yHot;
|
---|
109 | uint16_t width;
|
---|
110 | uint16_t height;
|
---|
111 | uint16_t masklen;
|
---|
112 | uint16_t datalen;
|
---|
113 | uint32_t vrdpInternal;
|
---|
114 | } VRDPCOLORPOINTER;
|
---|
115 |
|
---|
116 | typedef VRDPCOLORPOINTER *PVRDPCOLORPOINTER;
|
---|
117 |
|
---|
118 | /**
|
---|
119 | * Set mouse pointer shape.
|
---|
120 | *
|
---|
121 | * @param hserver Handle of VRDP server instance.
|
---|
122 | * @param porder The pointer shape information.
|
---|
123 | */
|
---|
124 | VRDPR3DECL(void) VRDPSendColorPointer (HVRDPSERVER hserver, PVRDPCOLORPOINTER pdata);
|
---|
125 |
|
---|
126 | /**
|
---|
127 | * Hide mouse pointer.
|
---|
128 | *
|
---|
129 | * @param hserver Handle of VRDP server instance.
|
---|
130 | */
|
---|
131 | VRDPR3DECL(void) VRDPSendHidePointer (HVRDPSERVER hserver);
|
---|
132 |
|
---|
133 | /** Audio format information packed in a 32 bit value. */
|
---|
134 | typedef uint32_t VRDPAUDIOFORMAT;
|
---|
135 |
|
---|
136 | /** Constructs 32 bit value for given frequency, number of channel and bits per sample. */
|
---|
137 | #define VRDP_AUDIO_FMT_MAKE(freq, c, bps, s) ((((s) & 0x1) << 28) + (((bps) & 0xFF) << 20) + (((c) & 0xF) << 16) + ((freq) & 0xFFFF))
|
---|
138 |
|
---|
139 | /** Decode frequency. */
|
---|
140 | #define VRDP_AUDIO_FMT_SAMPLE_FREQ(a) ((a) & 0xFFFF)
|
---|
141 | /** Decode number of channels. */
|
---|
142 | #define VRDP_AUDIO_FMT_CHANNELS(a) (((a) >> 16) & 0xF)
|
---|
143 | /** Decode number signess. */
|
---|
144 | #define VRDP_AUDIO_FMT_SIGNED(a) (((a) >> 28) & 0x1)
|
---|
145 | /** Decode number of bits per sample. */
|
---|
146 | #define VRDP_AUDIO_FMT_BITS_PER_SAMPLE(a) (((a) >> 20) & 0xFF)
|
---|
147 | /** Decode number of bytes per sample. */
|
---|
148 | #define VRDP_AUDIO_FMT_BYTES_PER_SAMPLE(a) ((VRDP_AUDIO_FMT_BITS_PER_SAMPLE(a) + 7) / 8)
|
---|
149 |
|
---|
150 | /**
|
---|
151 | * Queues the samples to be sent to client.
|
---|
152 | *
|
---|
153 | * @param hserver Handle of VRDP server instance.
|
---|
154 | * @param pvSamples Address of samples to be sent.
|
---|
155 | * @param cSamples Number of samples.
|
---|
156 | * @param format Encoded audio format for these samples.
|
---|
157 | */
|
---|
158 | VRDPR3DECL(void) VRDPSendAudioSamples (HVRDPSERVER hserver, void *pvSamples, uint32_t cSamples, VRDPAUDIOFORMAT format);
|
---|
159 |
|
---|
160 | /**
|
---|
161 | * Sets sound volume on client.
|
---|
162 | *
|
---|
163 | * @param hserver Handle of VRDP server instance.
|
---|
164 | * @param left 0..0xFFFF volume level for left channel.
|
---|
165 | * @param right 0..0xFFFF volume level for right channel.
|
---|
166 | */
|
---|
167 | VRDPR3DECL(void) VRDPSendAudioVolume (HVRDPSERVER hserver, uint16_t left, uint16_t right);
|
---|
168 |
|
---|
169 |
|
---|
170 | /*
|
---|
171 | * Remote USB backend protocol.
|
---|
172 | */
|
---|
173 |
|
---|
174 | /* The version of Remote USB Protocol. */
|
---|
175 | #define VRDP_USB_VERSION (1)
|
---|
176 |
|
---|
177 | /** USB backend operations. */
|
---|
178 | #define VRDP_USB_REQ_OPEN (0)
|
---|
179 | #define VRDP_USB_REQ_CLOSE (1)
|
---|
180 | #define VRDP_USB_REQ_RESET (2)
|
---|
181 | #define VRDP_USB_REQ_SET_CONFIG (3)
|
---|
182 | #define VRDP_USB_REQ_CLAIM_INTERFACE (4)
|
---|
183 | #define VRDP_USB_REQ_RELEASE_INTERFACE (5)
|
---|
184 | #define VRDP_USB_REQ_INTERFACE_SETTING (6)
|
---|
185 | #define VRDP_USB_REQ_QUEUE_URB (7)
|
---|
186 | #define VRDP_USB_REQ_REAP_URB (8)
|
---|
187 | #define VRDP_USB_REQ_CLEAR_HALTED_EP (9)
|
---|
188 | #define VRDP_USB_REQ_CANCEL_URB (10)
|
---|
189 |
|
---|
190 | /** USB service operations. */
|
---|
191 | #define VRDP_USB_REQ_DEVICE_LIST (11)
|
---|
192 | #define VRDP_USB_REQ_NEGOTIATE (12)
|
---|
193 |
|
---|
194 | /** An operation completion status is a byte. */
|
---|
195 | typedef uint8_t VRDPUSBSTATUS;
|
---|
196 |
|
---|
197 | /** USB device identifier is an 32 bit value. */
|
---|
198 | typedef uint32_t VRDPUSBDEVID;
|
---|
199 |
|
---|
200 | /** Status codes. */
|
---|
201 | #define VRDP_USB_STATUS_SUCCESS ((VRDPUSBSTATUS)0)
|
---|
202 | #define VRDP_USB_STATUS_ACCESS_DENIED ((VRDPUSBSTATUS)1)
|
---|
203 | #define VRDP_USB_STATUS_DEVICE_REMOVED ((VRDPUSBSTATUS)2)
|
---|
204 |
|
---|
205 | /*
|
---|
206 | * Data structures to use with VRDPSendUSBRequest.
|
---|
207 | * The *RET* structures always represent the layout of VRDP data.
|
---|
208 | * The *PARM* structures normally the same as VRDP layout.
|
---|
209 | * However the VRDP_USB_REQ_QUEUE_URB_PARM has a pointer to
|
---|
210 | * URB data in place where actual data will be in VRDP layout.
|
---|
211 | *
|
---|
212 | * Since replies (*RET*) are asynchronous, the 'success'
|
---|
213 | * replies are not required for operations which return
|
---|
214 | * only the status code (VRDPUSBREQRETHDR only):
|
---|
215 | * VRDP_USB_REQ_OPEN
|
---|
216 | * VRDP_USB_REQ_RESET
|
---|
217 | * VRDP_USB_REQ_SET_CONFIG
|
---|
218 | * VRDP_USB_REQ_CLAIM_INTERFACE
|
---|
219 | * VRDP_USB_REQ_RELEASE_INTERFACE
|
---|
220 | * VRDP_USB_REQ_INTERFACE_SETTING
|
---|
221 | * VRDP_USB_REQ_CLEAR_HALTED_EP
|
---|
222 | *
|
---|
223 | */
|
---|
224 |
|
---|
225 | /* VRDP layout has no aligments. */
|
---|
226 | #pragma pack(1)
|
---|
227 |
|
---|
228 | /* Common header for all VRDP USB packets. After the reply hdr follows *PARM* or *RET* data. */
|
---|
229 | typedef struct _VRDPUSBPKTHDR
|
---|
230 | {
|
---|
231 | /* Total length of the reply NOT including the 'length' field. */
|
---|
232 | uint32_t length;
|
---|
233 | /* The operation code for which the reply was sent by the client. */
|
---|
234 | uint8_t code;
|
---|
235 | } VRDPUSBPKTHDR;
|
---|
236 |
|
---|
237 | /* Common header for all return structures. */
|
---|
238 | typedef struct _VRDPUSBREQRETHDR
|
---|
239 | {
|
---|
240 | /* Device status. */
|
---|
241 | VRDPUSBSTATUS status;
|
---|
242 | /* Device id. */
|
---|
243 | VRDPUSBDEVID id;
|
---|
244 | } VRDPUSBREQRETHDR;
|
---|
245 |
|
---|
246 |
|
---|
247 | /* VRDP_USB_REQ_OPEN
|
---|
248 | */
|
---|
249 | typedef struct _VRDP_USB_REQ_OPEN_PARM
|
---|
250 | {
|
---|
251 | uint8_t code;
|
---|
252 | VRDPUSBDEVID id;
|
---|
253 | } VRDP_USB_REQ_OPEN_PARM;
|
---|
254 |
|
---|
255 | typedef struct _VRDP_USB_REQ_OPEN_RET
|
---|
256 | {
|
---|
257 | VRDPUSBREQRETHDR hdr;
|
---|
258 | } VRDP_USB_REQ_OPEN_RET;
|
---|
259 |
|
---|
260 |
|
---|
261 | /* VRDP_USB_REQ_CLOSE
|
---|
262 | */
|
---|
263 | typedef struct _VRDP_USB_REQ_CLOSE_PARM
|
---|
264 | {
|
---|
265 | uint8_t code;
|
---|
266 | VRDPUSBDEVID id;
|
---|
267 | } VRDP_USB_REQ_CLOSE_PARM;
|
---|
268 |
|
---|
269 | /* The close request has no returned data. */
|
---|
270 |
|
---|
271 |
|
---|
272 | /* VRDP_USB_REQ_RESET
|
---|
273 | */
|
---|
274 | typedef struct _VRDP_USB_REQ_RESET_PARM
|
---|
275 | {
|
---|
276 | uint8_t code;
|
---|
277 | VRDPUSBDEVID id;
|
---|
278 | } VRDP_USB_REQ_RESET_PARM;
|
---|
279 |
|
---|
280 | typedef struct _VRDP_USB_REQ_RESET_RET
|
---|
281 | {
|
---|
282 | VRDPUSBREQRETHDR hdr;
|
---|
283 | } VRDP_USB_REQ_RESET_RET;
|
---|
284 |
|
---|
285 |
|
---|
286 | /* VRDP_USB_REQ_SET_CONFIG
|
---|
287 | */
|
---|
288 | typedef struct _VRDP_USB_REQ_SET_CONFIG_PARM
|
---|
289 | {
|
---|
290 | uint8_t code;
|
---|
291 | VRDPUSBDEVID id;
|
---|
292 | uint8_t configuration;
|
---|
293 | } VRDP_USB_REQ_SET_CONFIG_PARM;
|
---|
294 |
|
---|
295 | typedef struct _VRDP_USB_REQ_SET_CONFIG_RET
|
---|
296 | {
|
---|
297 | VRDPUSBREQRETHDR hdr;
|
---|
298 | } VRDP_USB_REQ_SET_CONFIG_RET;
|
---|
299 |
|
---|
300 |
|
---|
301 | /* VRDP_USB_REQ_CLAIM_INTERFACE
|
---|
302 | */
|
---|
303 | typedef struct _VRDP_USB_REQ_CLAIM_INTERFACE_PARM
|
---|
304 | {
|
---|
305 | uint8_t code;
|
---|
306 | VRDPUSBDEVID id;
|
---|
307 | uint8_t iface;
|
---|
308 | } VRDP_USB_REQ_CLAIM_INTERFACE_PARM;
|
---|
309 |
|
---|
310 | typedef struct _VRDP_USB_REQ_CLAIM_INTERFACE_RET
|
---|
311 | {
|
---|
312 | VRDPUSBREQRETHDR hdr;
|
---|
313 | } VRDP_USB_REQ_CLAIM_INTERFACE_RET;
|
---|
314 |
|
---|
315 |
|
---|
316 | /* VRDP_USB_REQ_RELEASE_INTERFACE
|
---|
317 | */
|
---|
318 | typedef struct _VRDP_USB_REQ_RELEASE_INTERFACE_PARM
|
---|
319 | {
|
---|
320 | uint8_t code;
|
---|
321 | VRDPUSBDEVID id;
|
---|
322 | uint8_t iface;
|
---|
323 | } VRDP_USB_REQ_RELEASE_INTERFACE_PARM;
|
---|
324 |
|
---|
325 | typedef struct _VRDP_USB_REQ_RELEASE_INTERFACE_RET
|
---|
326 | {
|
---|
327 | VRDPUSBREQRETHDR hdr;
|
---|
328 | } VRDP_USB_REQ_RELEASE_INTERFACE_RET;
|
---|
329 |
|
---|
330 |
|
---|
331 | /* VRDP_USB_REQ_INTERFACE_SETTING
|
---|
332 | */
|
---|
333 | typedef struct _VRDP_USB_REQ_INTERFACE_SETTING_PARM
|
---|
334 | {
|
---|
335 | uint8_t code;
|
---|
336 | VRDPUSBDEVID id;
|
---|
337 | uint8_t iface;
|
---|
338 | uint8_t setting;
|
---|
339 | } VRDP_USB_REQ_INTERFACE_SETTING_PARM;
|
---|
340 |
|
---|
341 | typedef struct _VRDP_USB_REQ_INTERFACE_SETTING_RET
|
---|
342 | {
|
---|
343 | VRDPUSBREQRETHDR hdr;
|
---|
344 | } VRDP_USB_REQ_INTERFACE_SETTING_RET;
|
---|
345 |
|
---|
346 |
|
---|
347 | /* VRDP_USB_REQ_QUEUE_URB
|
---|
348 | */
|
---|
349 |
|
---|
350 | #define VRDP_USB_TRANSFER_TYPE_CTRL (0)
|
---|
351 | #define VRDP_USB_TRANSFER_TYPE_ISOC (1)
|
---|
352 | #define VRDP_USB_TRANSFER_TYPE_BULK (2)
|
---|
353 | #define VRDP_USB_TRANSFER_TYPE_INTR (3)
|
---|
354 | #define VRDP_USB_TRANSFER_TYPE_MSG (4)
|
---|
355 |
|
---|
356 | #define VRDP_USB_DIRECTION_SETUP (0)
|
---|
357 | #define VRDP_USB_DIRECTION_IN (1)
|
---|
358 | #define VRDP_USB_DIRECTION_OUT (2)
|
---|
359 |
|
---|
360 | typedef struct _VRDP_USB_REQ_QUEUE_URB_PARM
|
---|
361 | {
|
---|
362 | uint8_t code;
|
---|
363 | VRDPUSBDEVID id;
|
---|
364 | uint32_t handle; /* Distinguishes that particular URB. Later used in CancelURB and returned by ReapURB */
|
---|
365 | uint8_t type;
|
---|
366 | uint8_t ep;
|
---|
367 | uint8_t direction;
|
---|
368 | uint32_t urblen; /* Length of the URB. */
|
---|
369 | uint32_t datalen; /* Length of the data. */
|
---|
370 | void *data; /* In RDP layout the data follow. */
|
---|
371 | } VRDP_USB_REQ_QUEUE_URB_PARM;
|
---|
372 |
|
---|
373 | /* The queue URB has no explicit return. The reap URB reply will be
|
---|
374 | * eventually the indirect result.
|
---|
375 | */
|
---|
376 |
|
---|
377 |
|
---|
378 | /* VRDP_USB_REQ_REAP_URB
|
---|
379 | * Notificationg from server to client that server expects an URB
|
---|
380 | * from any device.
|
---|
381 | * Only sent if negotiated URB return method is polling.
|
---|
382 | * Normally, the client will send URBs back as soon as they are ready.
|
---|
383 | */
|
---|
384 | typedef struct _VRDP_USB_REQ_REAP_URB_PARM
|
---|
385 | {
|
---|
386 | uint8_t code;
|
---|
387 | } VRDP_USB_REQ_REAP_URB_PARM;
|
---|
388 |
|
---|
389 |
|
---|
390 | #define VRDP_USB_XFER_OK (0)
|
---|
391 | #define VRDP_USB_XFER_STALL (1)
|
---|
392 | #define VRDP_USB_XFER_DNR (2)
|
---|
393 | #define VRDP_USB_XFER_CRC (3)
|
---|
394 |
|
---|
395 | #define VRDP_USB_REAP_FLAG_CONTINUED (0x0)
|
---|
396 | #define VRDP_USB_REAP_FLAG_LAST (0x1)
|
---|
397 |
|
---|
398 | #define VRDP_USB_REAP_VALID_FLAGS (VRDP_USB_REAP_FLAG_LAST)
|
---|
399 |
|
---|
400 | typedef struct _VRDPUSBREQREAPURBBODY
|
---|
401 | {
|
---|
402 | VRDPUSBDEVID id; /* From which device the URB arrives. */
|
---|
403 | uint8_t flags; /* VRDP_USB_REAP_FLAG_* */
|
---|
404 | uint8_t error; /* VRDP_USB_XFER_* */
|
---|
405 | uint32_t handle; /* Handle of returned URB. Not 0. */
|
---|
406 | uint32_t len; /* Length of data actually transferred. */
|
---|
407 | /* Data follow. */
|
---|
408 | } VRDPUSBREQREAPURBBODY;
|
---|
409 |
|
---|
410 | typedef struct _VRDP_USB_REQ_REAP_URB_RET
|
---|
411 | {
|
---|
412 | /* The REAP URB has no header, only completed URBs are returned. */
|
---|
413 | VRDPUSBREQREAPURBBODY body;
|
---|
414 | /* Another body may follow, depending on flags. */
|
---|
415 | } VRDP_USB_REQ_REAP_URB_RET;
|
---|
416 |
|
---|
417 |
|
---|
418 | /* VRDP_USB_REQ_CLEAR_HALTED_EP
|
---|
419 | */
|
---|
420 | typedef struct _VRDP_USB_REQ_CLEAR_HALTED_EP_PARM
|
---|
421 | {
|
---|
422 | uint8_t code;
|
---|
423 | VRDPUSBDEVID id;
|
---|
424 | uint8_t ep;
|
---|
425 | } VRDP_USB_REQ_CLEAR_HALTED_EP_PARM;
|
---|
426 |
|
---|
427 | typedef struct _VRDP_USB_REQ_CLEAR_HALTED_EP_RET
|
---|
428 | {
|
---|
429 | VRDPUSBREQRETHDR hdr;
|
---|
430 | } VRDP_USB_REQ_CLEAR_HALTED_EP_RET;
|
---|
431 |
|
---|
432 |
|
---|
433 | /* VRDP_USB_REQ_CANCEL_URB
|
---|
434 | */
|
---|
435 | typedef struct _VRDP_USB_REQ_CANCEL_URB_PARM
|
---|
436 | {
|
---|
437 | uint8_t code;
|
---|
438 | VRDPUSBDEVID id;
|
---|
439 | uint32_t handle;
|
---|
440 | } VRDP_USB_REQ_CANCEL_URB_PARM;
|
---|
441 |
|
---|
442 | /* The cancel URB request has no return. */
|
---|
443 |
|
---|
444 |
|
---|
445 | /* VRDP_USB_REQ_DEVICE_LIST
|
---|
446 | *
|
---|
447 | * Server polls USB devices on client by sending this request
|
---|
448 | * periodically. Client sends back a list of all devices
|
---|
449 | * connected to it. Each device is assigned with an identifier,
|
---|
450 | * that is used to distinguish the particular device.
|
---|
451 | */
|
---|
452 | typedef struct _VRDP_USB_REQ_DEVICE_LIST_PARM
|
---|
453 | {
|
---|
454 | uint8_t code;
|
---|
455 | } VRDP_USB_REQ_DEVICE_LIST_PARM;
|
---|
456 |
|
---|
457 | /* Data is a list of the following variable length structures. */
|
---|
458 | typedef struct _VRDPUSBDEVICEDESC
|
---|
459 | {
|
---|
460 | /* Offset of the next structure. 0 if last. */
|
---|
461 | uint16_t oNext;
|
---|
462 |
|
---|
463 | /* Identifier of the device assigned by client. */
|
---|
464 | VRDPUSBDEVID id;
|
---|
465 |
|
---|
466 | /** USB version number. */
|
---|
467 | uint16_t bcdUSB;
|
---|
468 | /** Device class. */
|
---|
469 | uint8_t bDeviceClass;
|
---|
470 | /** Device subclass. */
|
---|
471 | uint8_t bDeviceSubClass;
|
---|
472 | /** Device protocol */
|
---|
473 | uint8_t bDeviceProtocol;
|
---|
474 | /** Vendor ID. */
|
---|
475 | uint16_t idVendor;
|
---|
476 | /** Product ID. */
|
---|
477 | uint16_t idProduct;
|
---|
478 | /** Revision, integer part. */
|
---|
479 | uint16_t bcdRev;
|
---|
480 | /** Manufacturer string. */
|
---|
481 | uint16_t oManufacturer;
|
---|
482 | /** Product string. */
|
---|
483 | uint16_t oProduct;
|
---|
484 | /** Serial number string. */
|
---|
485 | uint16_t oSerialNumber;
|
---|
486 | /** Physical USB port the device is connected to. */
|
---|
487 | uint16_t idPort;
|
---|
488 |
|
---|
489 | } VRDPUSBDEVICEDESC;
|
---|
490 |
|
---|
491 | typedef struct _VRDP_USB_REQ_DEVICE_LIST_RET
|
---|
492 | {
|
---|
493 | VRDPUSBDEVICEDESC body;
|
---|
494 | /* Other devices may follow.
|
---|
495 | * The list ends with (uint16_t)0,
|
---|
496 | * which means that an empty list consists of 2 zero bytes.
|
---|
497 | */
|
---|
498 | } VRDP_USB_REQ_DEVICE_LIST_RET;
|
---|
499 |
|
---|
500 | typedef struct _VRDPUSBREQNEGOTIATEPARM
|
---|
501 | {
|
---|
502 | uint8_t code;
|
---|
503 |
|
---|
504 | /* Remote USB Protocol version. */
|
---|
505 | uint32_t version;
|
---|
506 |
|
---|
507 | } VRDPUSBREQNEGOTIATEPARM;
|
---|
508 |
|
---|
509 | #define VRDP_USB_CAPS_FLAG_ASYNC (0x0)
|
---|
510 | #define VRDP_USB_CAPS_FLAG_POLL (0x1)
|
---|
511 |
|
---|
512 | #define VRDP_USB_CAPS_VALID_FLAGS (VRDP_USB_CAPS_FLAG_POLL)
|
---|
513 |
|
---|
514 | typedef struct _VRDPUSBREQNEGOTIATERET
|
---|
515 | {
|
---|
516 | uint8_t flags;
|
---|
517 | } VRDPUSBREQNEGOTIATERET;
|
---|
518 |
|
---|
519 | #pragma pack()
|
---|
520 |
|
---|
521 |
|
---|
522 | #define VRDP_CLIPBOARD_FORMAT_NULL (0x0)
|
---|
523 | #define VRDP_CLIPBOARD_FORMAT_UNICODE_TEXT (0x1)
|
---|
524 | #define VRDP_CLIPBOARD_FORMAT_BITMAP (0x2)
|
---|
525 | #define VRDP_CLIPBOARD_FORMAT_HTML (0x4)
|
---|
526 |
|
---|
527 | #define VRDP_CLIPBOARD_FUNCTION_FORMAT_ANNOUNCE (0)
|
---|
528 | #define VRDP_CLIPBOARD_FUNCTION_DATA_READ (1)
|
---|
529 | #define VRDP_CLIPBOARD_FUNCTION_DATA_WRITE (2)
|
---|
530 |
|
---|
531 | /**
|
---|
532 | * Called by the host when (VRDP_CLIPBOARD_FUNCTION_*):
|
---|
533 | * - (0) guest announces available clipboard formats;
|
---|
534 | * - (1) guest requests clipboard data;
|
---|
535 | * - (2) guest responds to the client's request for clipboard data.
|
---|
536 | *
|
---|
537 | * @param hserver The VRDP server handle.
|
---|
538 | * @param u32Function The cause of the call.
|
---|
539 | * @param u32Format Bitmask of announced formats or the format of data.
|
---|
540 | * @param pvData Points to: (1) buffer to be filled with clients data;
|
---|
541 | * (2) data from the host.
|
---|
542 | * @param cbData Size of 'pvData' buffer in bytes.
|
---|
543 | * @param pcbActualRead Size of the copied data in bytes.
|
---|
544 | *
|
---|
545 | */
|
---|
546 | VRDPR3DECL(void) VRDPClipboard (HVRDPSERVER hserver,
|
---|
547 | uint32_t u32Function,
|
---|
548 | uint32_t u32Format,
|
---|
549 | void *pvData,
|
---|
550 | uint32_t cbData,
|
---|
551 | uint32_t *pcbActualRead);
|
---|
552 |
|
---|
553 | /**
|
---|
554 | * Sends a USB request.
|
---|
555 | *
|
---|
556 | * @param hserver Handle of VRDP server instance.
|
---|
557 | * @param u32ClientId An identifier that allows the server to find the corresponding client.
|
---|
558 | * The identifier is always passed by the server as a parameter
|
---|
559 | * of the FNVRDPUSBCALLBACK. Note that the value is the same as
|
---|
560 | * in the VRDPSERVERCALLBACK functions.
|
---|
561 | * @param pvParm Function specific parameters buffer.
|
---|
562 | * @param cbParm Size of the buffer.
|
---|
563 | */
|
---|
564 | VRDPR3DECL(void) VRDPSendUSBRequest (HVRDPSERVER hserver,
|
---|
565 | uint32_t u32ClientId,
|
---|
566 | void *pvParm,
|
---|
567 | uint32_t cbRarm);
|
---|
568 |
|
---|
569 |
|
---|
570 | /**
|
---|
571 | * Called by the server when a reply is received from a client.
|
---|
572 | *
|
---|
573 | * @param pvCallback Callback specific value returned by VRDPSERVERCALLBACK::pfnInterceptUSB.
|
---|
574 | * @param u32ClientId Identifies the client that sent the reply.
|
---|
575 | * @param u8Code The operation code VRDP_USB_REQ_*.
|
---|
576 | * @param pvRet Points to data received from the client.
|
---|
577 | * @param cbRet Size of the data in bytes.
|
---|
578 | *
|
---|
579 | * @return VBox error code.
|
---|
580 | */
|
---|
581 | typedef DECLCALLBACK(int) FNVRDPUSBCALLBACK (void *pvCallback,
|
---|
582 | uint32_t u32ClientId,
|
---|
583 | uint8_t u8Code,
|
---|
584 | const void *pvRet,
|
---|
585 | uint32_t cbRet);
|
---|
586 |
|
---|
587 | typedef FNVRDPUSBCALLBACK *PFNVRDPUSBCALLBACK;
|
---|
588 |
|
---|
589 | /**
|
---|
590 | * Called by the server when (VRDP_CLIPBOARD_FUNCTION_*):
|
---|
591 | * - (0) client announces available clipboard formats;
|
---|
592 | * - (1) client requests clipboard data.
|
---|
593 | *
|
---|
594 | * @param pvCallback Callback specific value returned by VRDPSERVERCALLBACK::pfnInterceptClipboard.
|
---|
595 | * @param u32ClientId Identifies the RDP client that sent the reply.
|
---|
596 | * @param u32Function The cause of the callback.
|
---|
597 | * @param u32Format Bitmask of reported formats or the format of received data.
|
---|
598 | * @param pvData Reserved.
|
---|
599 | * @param cbData Reserved.
|
---|
600 | *
|
---|
601 | * @return VBox error code.
|
---|
602 | */
|
---|
603 | typedef DECLCALLBACK(int) FNVRDPCLIPBOARDCALLBACK (void *pvCallback,
|
---|
604 | uint32_t u32ClientId,
|
---|
605 | uint32_t u32Function,
|
---|
606 | uint32_t u32Format,
|
---|
607 | const void *pvData,
|
---|
608 | uint32_t cbData);
|
---|
609 |
|
---|
610 | typedef FNVRDPCLIPBOARDCALLBACK *PFNVRDPCLIPBOARDCALLBACK;
|
---|
611 |
|
---|
612 | #define VRDP_CLIENT_INTERCEPT_AUDIO (0x1)
|
---|
613 | #define VRDP_CLIENT_INTERCEPT_USB (0x2)
|
---|
614 | #define VRDP_CLIENT_INTERCEPT_CLIPBOARD (0x4)
|
---|
615 |
|
---|
616 | typedef struct _VRDPSERVERCALLBACK
|
---|
617 | {
|
---|
618 | /* A client is logging in.
|
---|
619 | *
|
---|
620 | * @param pvUser The callback specific pointer.
|
---|
621 | * @param u32ClientId An unique client identifier generated by the server.
|
---|
622 | * @param pszUser The username.
|
---|
623 | * @param pszPassword The password.
|
---|
624 | * @param pszDomain The domain.
|
---|
625 | *
|
---|
626 | * @return VBox error code.
|
---|
627 | */
|
---|
628 | DECLCALLBACKMEMBER(int, pfnClientLogon) (void *pvUser,
|
---|
629 | uint32_t u32ClientId,
|
---|
630 | const char *pszUser,
|
---|
631 | const char *pszPassword,
|
---|
632 | const char *pszDomain);
|
---|
633 | /* The client has connected.
|
---|
634 | *
|
---|
635 | * @param pvUser The callback specific pointer.
|
---|
636 | * @param u32ClientId An unique client identifier generated by the server.
|
---|
637 | */
|
---|
638 | DECLCALLBACKMEMBER(void, pfnClientConnect) (void *pvUser,
|
---|
639 | uint32_t u32ClientId);
|
---|
640 | /* The client has been disconnected.
|
---|
641 | *
|
---|
642 | * @param pvUser The callback specific pointer.
|
---|
643 | * @param u32ClientId An unique client identifier generated by the server.
|
---|
644 | * @param fu32Intercepted What was intercepted by the client (VRDP_CLIENT_INTERCEPT_*).
|
---|
645 | */
|
---|
646 | DECLCALLBACKMEMBER(void, pfnClientDisconnect) (void *pvUser,
|
---|
647 | uint32_t u32ClientId,
|
---|
648 | uint32_t fu32Intercepted);
|
---|
649 | /* The client supports audio channel.
|
---|
650 | */
|
---|
651 | DECLCALLBACKMEMBER(void, pfnInterceptAudio) (void *pvUser,
|
---|
652 | uint32_t u32ClientId);
|
---|
653 | /* The client supports USB channel.
|
---|
654 | */
|
---|
655 | DECLCALLBACKMEMBER(void, pfnInterceptUSB) (void *pvUser,
|
---|
656 | uint32_t u32ClientId,
|
---|
657 | PFNVRDPUSBCALLBACK *ppfn,
|
---|
658 | void **ppv);
|
---|
659 | /* The client supports clipboard channel.
|
---|
660 | */
|
---|
661 | DECLCALLBACKMEMBER(void, pfnInterceptClipboard) (void *pvUser,
|
---|
662 | uint32_t u32ClientId,
|
---|
663 | PFNVRDPCLIPBOARDCALLBACK *ppfn,
|
---|
664 | void **ppv);
|
---|
665 | } VRDPSERVERCALLBACK;
|
---|
666 |
|
---|
667 | /**
|
---|
668 | * Set a callback pointers table that will be called by the server in certain situations.
|
---|
669 | *
|
---|
670 | * @param hserver Handle of VRDP server instance.
|
---|
671 | * @param pCallback Pointer to VRDPSERVERCALLBACK structure with function pointers.
|
---|
672 | * @param pvUser An pointer to be passed to the callback functions.
|
---|
673 | */
|
---|
674 | VRDPR3DECL(void) VRDPSetCallback (HVRDPSERVER hserver, VRDPSERVERCALLBACK *pCallback, void *pvUser);
|
---|
675 |
|
---|
676 | /** Indexes of information values. */
|
---|
677 |
|
---|
678 | /** Whether a client is connected at the moment.
|
---|
679 | * uint32_t
|
---|
680 | */
|
---|
681 | #define VRDP_QI_ACTIVE (0)
|
---|
682 |
|
---|
683 | /** How many times a client connected up to current moment.
|
---|
684 | * uint32_t
|
---|
685 | */
|
---|
686 | #define VRDP_QI_NUMBER_OF_CLIENTS (1)
|
---|
687 |
|
---|
688 | /** When last connection was established.
|
---|
689 | * int64_t time in milliseconds since 1970-01-01 00:00:00 UTC
|
---|
690 | */
|
---|
691 | #define VRDP_QI_BEGIN_TIME (2)
|
---|
692 |
|
---|
693 | /** When last connection was terminated or current time if connection still active.
|
---|
694 | * int64_t time in milliseconds since 1970-01-01 00:00:00 UTC
|
---|
695 | */
|
---|
696 | #define VRDP_QI_END_TIME (3)
|
---|
697 |
|
---|
698 | /** How many bytes were sent in last (current) connection.
|
---|
699 | * uint64_t
|
---|
700 | */
|
---|
701 | #define VRDP_QI_BYTES_SENT (4)
|
---|
702 |
|
---|
703 | /** How many bytes were sent in all connections.
|
---|
704 | * uint64_t
|
---|
705 | */
|
---|
706 | #define VRDP_QI_BYTES_SENT_TOTAL (5)
|
---|
707 |
|
---|
708 | /** How many bytes were received in last (current) connection.
|
---|
709 | * uint64_t
|
---|
710 | */
|
---|
711 | #define VRDP_QI_BYTES_RECEIVED (6)
|
---|
712 |
|
---|
713 | /** How many bytes were received in all connections.
|
---|
714 | * uint64_t
|
---|
715 | */
|
---|
716 | #define VRDP_QI_BYTES_RECEIVED_TOTAL (7)
|
---|
717 |
|
---|
718 | /** Login user name supplied by the client.
|
---|
719 | * UTF8 nul terminated string.
|
---|
720 | */
|
---|
721 | #define VRDP_QI_USER (8)
|
---|
722 |
|
---|
723 | /** Login domain supplied by the client.
|
---|
724 | * UTF8 nul terminated string.
|
---|
725 | */
|
---|
726 | #define VRDP_QI_DOMAIN (9)
|
---|
727 |
|
---|
728 | /** The client name supplied by the client.
|
---|
729 | * UTF8 nul terminated string.
|
---|
730 | */
|
---|
731 | #define VRDP_QI_CLIENT_NAME (10)
|
---|
732 |
|
---|
733 | /** IP address of the client.
|
---|
734 | * UTF8 nul terminated string.
|
---|
735 | */
|
---|
736 | #define VRDP_QI_CLIENT_IP (11)
|
---|
737 |
|
---|
738 | /** The client software version number.
|
---|
739 | * uint32_t.
|
---|
740 | */
|
---|
741 | #define VRDP_QI_CLIENT_VERSION (12)
|
---|
742 |
|
---|
743 | /** Public key exchange method used when connection was established.
|
---|
744 | * Values: 0 - RDP4 public key exchange scheme.
|
---|
745 | * 1 - X509 sertificates were sent to client.
|
---|
746 | * uint32_t.
|
---|
747 | */
|
---|
748 | #define VRDP_QI_ENCRYPTION_STYLE (13)
|
---|
749 |
|
---|
750 | /**
|
---|
751 | * Query various information from the VRDP server.
|
---|
752 | *
|
---|
753 | * @param index VRDP_QI_* identifier of information to be returned.
|
---|
754 | * @param pvBuffer Address of memory buffer to which the information must be written.
|
---|
755 | * @param cbBuffer Size of the memory buffer in bytes.
|
---|
756 | * @param pcbOut Size in bytes of returned information value.
|
---|
757 | *
|
---|
758 | * @remark The caller must check the *pcbOut. 0 there means no information was returned.
|
---|
759 | * A value greater than cbBuffer means that information is too big to fit in the
|
---|
760 | * buffer, in that case no information was placed to the buffer.
|
---|
761 | */
|
---|
762 | VRDPR3DECL(void) VRDPQueryInfo (HVRDPSERVER hserver, uint32_t index, void *pvBuffer, uint32_t cbBuffer, uint32_t *pcbOut);
|
---|
763 |
|
---|
764 | __END_DECLS
|
---|
765 |
|
---|
766 | /** @} */
|
---|
767 |
|
---|
768 | #endif /* __VBox_vrdpapi_h__ */
|
---|
769 |
|
---|