VirtualBox

source: vbox/trunk/include/VBox/RemoteDesktop/VRDE.h@ 34727

Last change on this file since 34727 was 34525, checked in by vboxsync, 14 years ago

VRDP: initial implementation of audio input channel in VRDP server and new interface for the channel.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 51.5 KB
Line 
1/** @file
2 * VBox Remote Desktop Extension (VRDE) - Public APIs.
3 */
4
5/*
6 * Copyright (C) 2006-2010 Oracle Corporation
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 */
25
26#ifndef ___VBox_RemoteDesktop_VRDE_h
27#define ___VBox_RemoteDesktop_VRDE_h
28
29#include <iprt/cdefs.h>
30#include <iprt/types.h>
31
32/** @defgroup grp_vrdp VRDE
33 * VirtualBox Remote Desktop Extension (VRDE) interface that lets to use
34 * a Remote Desktop server like RDP.
35 * @{
36 */
37
38RT_C_DECLS_BEGIN
39
40/* Forward declaration of the VRDE server instance handle. */
41#ifdef __cplusplus
42class VRDEServer;
43typedef class VRDEServerType *HVRDESERVER;
44#else
45struct VRDEServer;
46typedef struct VRDEServerType *HVRDESERVER;
47#endif /* __cplusplus */
48
49/* Callback based VRDE server interface declarations. */
50
51/** The color mouse pointer information. */
52typedef struct _VRDECOLORPOINTER
53{
54 uint16_t u16HotX;
55 uint16_t u16HotY;
56 uint16_t u16Width;
57 uint16_t u16Height;
58 uint16_t u16MaskLen;
59 uint16_t u16DataLen;
60 /* The 1BPP mask and the 24BPP bitmap follow. */
61} VRDECOLORPOINTER;
62
63/** Audio format information packed in a 32 bit value. */
64typedef uint32_t VRDEAUDIOFORMAT;
65
66/** Constructs 32 bit value for given frequency, number of channel and bits per sample. */
67#define VRDE_AUDIO_FMT_MAKE(freq, c, bps, s) ((((s) & 0x1) << 28) + (((bps) & 0xFF) << 20) + (((c) & 0xF) << 16) + ((freq) & 0xFFFF))
68
69/** Decode frequency. */
70#define VRDE_AUDIO_FMT_SAMPLE_FREQ(a) ((a) & 0xFFFF)
71/** Decode number of channels. */
72#define VRDE_AUDIO_FMT_CHANNELS(a) (((a) >> 16) & 0xF)
73/** Decode number signess. */
74#define VRDE_AUDIO_FMT_SIGNED(a) (((a) >> 28) & 0x1)
75/** Decode number of bits per sample. */
76#define VRDE_AUDIO_FMT_BITS_PER_SAMPLE(a) (((a) >> 20) & 0xFF)
77/** Decode number of bytes per sample. */
78#define VRDE_AUDIO_FMT_BYTES_PER_SAMPLE(a) ((VRDE_AUDIO_FMT_BITS_PER_SAMPLE(a) + 7) / 8)
79
80
81/*
82 * Audio input.
83 */
84
85/* Audion notifications. */
86#define VRDE_AUDIOIN_BEGIN 1
87#define VRDE_AUDIOIN_DATA 2
88#define VRDE_AUDIOIN_END 3
89
90
91/*
92 * Remote USB protocol.
93 */
94
95/* The initial version 1. */
96#define VRDE_USB_VERSION_1 (1)
97/* Version 2: look for VRDE_USB_VERSION_2 comments in the code. */
98#define VRDE_USB_VERSION_2 (2)
99/* Version 3: look for VRDE_USB_VERSION_3 comments in the code. */
100#define VRDE_USB_VERSION_3 (3)
101
102/* The default VRDE server version of Remote USB Protocol. */
103#define VRDE_USB_VERSION VRDE_USB_VERSION_3
104
105
106/** USB backend operations. */
107#define VRDE_USB_REQ_OPEN (0)
108#define VRDE_USB_REQ_CLOSE (1)
109#define VRDE_USB_REQ_RESET (2)
110#define VRDE_USB_REQ_SET_CONFIG (3)
111#define VRDE_USB_REQ_CLAIM_INTERFACE (4)
112#define VRDE_USB_REQ_RELEASE_INTERFACE (5)
113#define VRDE_USB_REQ_INTERFACE_SETTING (6)
114#define VRDE_USB_REQ_QUEUE_URB (7)
115#define VRDE_USB_REQ_REAP_URB (8)
116#define VRDE_USB_REQ_CLEAR_HALTED_EP (9)
117#define VRDE_USB_REQ_CANCEL_URB (10)
118
119/** USB service operations. */
120#define VRDE_USB_REQ_DEVICE_LIST (11)
121#define VRDE_USB_REQ_NEGOTIATE (12)
122
123/** An operation completion status is a byte. */
124typedef uint8_t VRDEUSBSTATUS;
125
126/** USB device identifier is an 32 bit value. */
127typedef uint32_t VRDEUSBDEVID;
128
129/** Status codes. */
130#define VRDE_USB_STATUS_SUCCESS ((VRDEUSBSTATUS)0)
131#define VRDE_USB_STATUS_ACCESS_DENIED ((VRDEUSBSTATUS)1)
132#define VRDE_USB_STATUS_DEVICE_REMOVED ((VRDEUSBSTATUS)2)
133
134/*
135 * Data structures to use with VRDEUSBRequest.
136 * The *RET* structures always represent the layout of VRDE data.
137 * The *PARM* structures normally the same as VRDE layout.
138 * However the VRDE_USB_REQ_QUEUE_URB_PARM has a pointer to
139 * URB data in place where actual data will be in VRDE layout.
140 *
141 * Since replies (*RET*) are asynchronous, the 'success'
142 * replies are not required for operations which return
143 * only the status code (VRDEUSBREQRETHDR only):
144 * VRDE_USB_REQ_OPEN
145 * VRDE_USB_REQ_RESET
146 * VRDE_USB_REQ_SET_CONFIG
147 * VRDE_USB_REQ_CLAIM_INTERFACE
148 * VRDE_USB_REQ_RELEASE_INTERFACE
149 * VRDE_USB_REQ_INTERFACE_SETTING
150 * VRDE_USB_REQ_CLEAR_HALTED_EP
151 *
152 */
153
154/* VRDE layout has no alignments. */
155#pragma pack(1)
156/* Common header for all VRDE USB packets. After the reply hdr follows *PARM* or *RET* data. */
157typedef struct _VRDEUSBPKTHDR
158{
159 /* Total length of the reply NOT including the 'length' field. */
160 uint32_t length;
161 /* The operation code for which the reply was sent by the client. */
162 uint8_t code;
163} VRDEUSBPKTHDR;
164
165/* Common header for all return structures. */
166typedef struct _VRDEUSBREQRETHDR
167{
168 /* Device status. */
169 VRDEUSBSTATUS status;
170 /* Device id. */
171 VRDEUSBDEVID id;
172} VRDEUSBREQRETHDR;
173
174
175/* VRDE_USB_REQ_OPEN
176 */
177typedef struct _VRDE_USB_REQ_OPEN_PARM
178{
179 uint8_t code;
180 VRDEUSBDEVID id;
181} VRDE_USB_REQ_OPEN_PARM;
182
183typedef struct _VRDE_USB_REQ_OPEN_RET
184{
185 VRDEUSBREQRETHDR hdr;
186} VRDE_USB_REQ_OPEN_RET;
187
188
189/* VRDE_USB_REQ_CLOSE
190 */
191typedef struct _VRDE_USB_REQ_CLOSE_PARM
192{
193 uint8_t code;
194 VRDEUSBDEVID id;
195} VRDE_USB_REQ_CLOSE_PARM;
196
197/* The close request has no returned data. */
198
199
200/* VRDE_USB_REQ_RESET
201 */
202typedef struct _VRDE_USB_REQ_RESET_PARM
203{
204 uint8_t code;
205 VRDEUSBDEVID id;
206} VRDE_USB_REQ_RESET_PARM;
207
208typedef struct _VRDE_USB_REQ_RESET_RET
209{
210 VRDEUSBREQRETHDR hdr;
211} VRDE_USB_REQ_RESET_RET;
212
213
214/* VRDE_USB_REQ_SET_CONFIG
215 */
216typedef struct _VRDE_USB_REQ_SET_CONFIG_PARM
217{
218 uint8_t code;
219 VRDEUSBDEVID id;
220 uint8_t configuration;
221} VRDE_USB_REQ_SET_CONFIG_PARM;
222
223typedef struct _VRDE_USB_REQ_SET_CONFIG_RET
224{
225 VRDEUSBREQRETHDR hdr;
226} VRDE_USB_REQ_SET_CONFIG_RET;
227
228
229/* VRDE_USB_REQ_CLAIM_INTERFACE
230 */
231typedef struct _VRDE_USB_REQ_CLAIM_INTERFACE_PARM
232{
233 uint8_t code;
234 VRDEUSBDEVID id;
235 uint8_t iface;
236} VRDE_USB_REQ_CLAIM_INTERFACE_PARM;
237
238typedef struct _VRDE_USB_REQ_CLAIM_INTERFACE_RET
239{
240 VRDEUSBREQRETHDR hdr;
241} VRDE_USB_REQ_CLAIM_INTERFACE_RET;
242
243
244/* VRDE_USB_REQ_RELEASE_INTERFACE
245 */
246typedef struct _VRDE_USB_REQ_RELEASE_INTERFACE_PARM
247{
248 uint8_t code;
249 VRDEUSBDEVID id;
250 uint8_t iface;
251} VRDE_USB_REQ_RELEASE_INTERFACE_PARM;
252
253typedef struct _VRDE_USB_REQ_RELEASE_INTERFACE_RET
254{
255 VRDEUSBREQRETHDR hdr;
256} VRDE_USB_REQ_RELEASE_INTERFACE_RET;
257
258
259/* VRDE_USB_REQ_INTERFACE_SETTING
260 */
261typedef struct _VRDE_USB_REQ_INTERFACE_SETTING_PARM
262{
263 uint8_t code;
264 VRDEUSBDEVID id;
265 uint8_t iface;
266 uint8_t setting;
267} VRDE_USB_REQ_INTERFACE_SETTING_PARM;
268
269typedef struct _VRDE_USB_REQ_INTERFACE_SETTING_RET
270{
271 VRDEUSBREQRETHDR hdr;
272} VRDE_USB_REQ_INTERFACE_SETTING_RET;
273
274
275/* VRDE_USB_REQ_QUEUE_URB
276 */
277
278#define VRDE_USB_TRANSFER_TYPE_CTRL (0)
279#define VRDE_USB_TRANSFER_TYPE_ISOC (1)
280#define VRDE_USB_TRANSFER_TYPE_BULK (2)
281#define VRDE_USB_TRANSFER_TYPE_INTR (3)
282#define VRDE_USB_TRANSFER_TYPE_MSG (4)
283
284#define VRDE_USB_DIRECTION_SETUP (0)
285#define VRDE_USB_DIRECTION_IN (1)
286#define VRDE_USB_DIRECTION_OUT (2)
287
288typedef struct _VRDE_USB_REQ_QUEUE_URB_PARM
289{
290 uint8_t code;
291 VRDEUSBDEVID id;
292 uint32_t handle; /* Distinguishes that particular URB. Later used in CancelURB and returned by ReapURB */
293 uint8_t type;
294 uint8_t ep;
295 uint8_t direction;
296 uint32_t urblen; /* Length of the URB. */
297 uint32_t datalen; /* Length of the data. */
298 void *data; /* In RDP layout the data follow. */
299} VRDE_USB_REQ_QUEUE_URB_PARM;
300
301/* The queue URB has no explicit return. The reap URB reply will be
302 * eventually the indirect result.
303 */
304
305
306/* VRDE_USB_REQ_REAP_URB
307 * Notificationg from server to client that server expects an URB
308 * from any device.
309 * Only sent if negotiated URB return method is polling.
310 * Normally, the client will send URBs back as soon as they are ready.
311 */
312typedef struct _VRDE_USB_REQ_REAP_URB_PARM
313{
314 uint8_t code;
315} VRDE_USB_REQ_REAP_URB_PARM;
316
317
318#define VRDE_USB_XFER_OK (0)
319#define VRDE_USB_XFER_STALL (1)
320#define VRDE_USB_XFER_DNR (2)
321#define VRDE_USB_XFER_CRC (3)
322/* VRDE_USB_VERSION_2: New error codes. */
323#define VRDE_USB_XFER_BS (4)
324#define VRDE_USB_XFER_DTM (5)
325#define VRDE_USB_XFER_PCF (6)
326#define VRDE_USB_XFER_UPID (7)
327#define VRDE_USB_XFER_DO (8)
328#define VRDE_USB_XFER_DU (9)
329#define VRDE_USB_XFER_BO (10)
330#define VRDE_USB_XFER_BU (11)
331#define VRDE_USB_XFER_ERR (12) /* VBox protocol error. */
332
333#define VRDE_USB_REAP_FLAG_CONTINUED (0x0)
334#define VRDE_USB_REAP_FLAG_LAST (0x1)
335/* VRDE_USB_VERSION_3: Fragmented URBs. */
336#define VRDE_USB_REAP_FLAG_FRAGMENT (0x2)
337
338#define VRDE_USB_REAP_VALID_FLAGS (VRDE_USB_REAP_FLAG_LAST)
339/* VRDE_USB_VERSION_3: Fragmented URBs. */
340#define VRDE_USB_REAP_VALID_FLAGS_3 (VRDE_USB_REAP_FLAG_LAST | VRDE_USB_REAP_FLAG_FRAGMENT)
341
342typedef struct _VRDEUSBREQREAPURBBODY
343{
344 VRDEUSBDEVID id; /* From which device the URB arrives. */
345 uint8_t flags; /* VRDE_USB_REAP_FLAG_* */
346 uint8_t error; /* VRDE_USB_XFER_* */
347 uint32_t handle; /* Handle of returned URB. Not 0. */
348 uint32_t len; /* Length of data actually transferred. */
349 /* 'len' bytes of data follow if direction of this URB was VRDE_USB_DIRECTION_IN. */
350} VRDEUSBREQREAPURBBODY;
351
352typedef struct _VRDE_USB_REQ_REAP_URB_RET
353{
354 /* The REAP URB has no header, only completed URBs are returned. */
355 VRDEUSBREQREAPURBBODY body;
356 /* Another body may follow, depending on flags. */
357} VRDE_USB_REQ_REAP_URB_RET;
358
359
360/* VRDE_USB_REQ_CLEAR_HALTED_EP
361 */
362typedef struct _VRDE_USB_REQ_CLEAR_HALTED_EP_PARM
363{
364 uint8_t code;
365 VRDEUSBDEVID id;
366 uint8_t ep;
367} VRDE_USB_REQ_CLEAR_HALTED_EP_PARM;
368
369typedef struct _VRDE_USB_REQ_CLEAR_HALTED_EP_RET
370{
371 VRDEUSBREQRETHDR hdr;
372} VRDE_USB_REQ_CLEAR_HALTED_EP_RET;
373
374
375/* VRDE_USB_REQ_CANCEL_URB
376 */
377typedef struct _VRDE_USB_REQ_CANCEL_URB_PARM
378{
379 uint8_t code;
380 VRDEUSBDEVID id;
381 uint32_t handle;
382} VRDE_USB_REQ_CANCEL_URB_PARM;
383
384/* The cancel URB request has no return. */
385
386
387/* VRDE_USB_REQ_DEVICE_LIST
388 *
389 * Server polls USB devices on client by sending this request
390 * periodically. Client sends back a list of all devices
391 * connected to it. Each device is assigned with an identifier,
392 * that is used to distinguish the particular device.
393 */
394typedef struct _VRDE_USB_REQ_DEVICE_LIST_PARM
395{
396 uint8_t code;
397} VRDE_USB_REQ_DEVICE_LIST_PARM;
398
399/* Data is a list of the following variable length structures. */
400typedef struct _VRDEUSBDEVICEDESC
401{
402 /* Offset of the next structure. 0 if last. */
403 uint16_t oNext;
404
405 /* Identifier of the device assigned by client. */
406 VRDEUSBDEVID id;
407
408 /** USB version number. */
409 uint16_t bcdUSB;
410 /** Device class. */
411 uint8_t bDeviceClass;
412 /** Device subclass. */
413 uint8_t bDeviceSubClass;
414 /** Device protocol */
415 uint8_t bDeviceProtocol;
416 /** Vendor ID. */
417 uint16_t idVendor;
418 /** Product ID. */
419 uint16_t idProduct;
420 /** Revision, integer part. */
421 uint16_t bcdRev;
422 /** Manufacturer string. */
423 uint16_t oManufacturer;
424 /** Product string. */
425 uint16_t oProduct;
426 /** Serial number string. */
427 uint16_t oSerialNumber;
428 /** Physical USB port the device is connected to. */
429 uint16_t idPort;
430
431} VRDEUSBDEVICEDESC;
432
433typedef struct _VRDE_USB_REQ_DEVICE_LIST_RET
434{
435 VRDEUSBDEVICEDESC body;
436 /* Other devices may follow.
437 * The list ends with (uint16_t)0,
438 * which means that an empty list consists of 2 zero bytes.
439 */
440} VRDE_USB_REQ_DEVICE_LIST_RET;
441
442typedef struct _VRDEUSBREQNEGOTIATEPARM
443{
444 uint8_t code;
445
446 /* Remote USB Protocol version. */
447 /* VRDE_USB_VERSION_3: the 32 bit field is splitted to 16 bit version and 16 bit flags.
448 * Version 1 and 2 servers therefore have 'flags' == 0.
449 * Version 3+ servers can send some capabilities in this field, this way it is possible to add
450 * a new capability without increasing the protocol version.
451 */
452 uint16_t version;
453 uint16_t flags;
454
455} VRDEUSBREQNEGOTIATEPARM;
456
457#define VRDE_USB_CAPS_FLAG_ASYNC (0x0)
458#define VRDE_USB_CAPS_FLAG_POLL (0x1)
459/* VRDE_USB_VERSION_2: New flag. */
460#define VRDE_USB_CAPS2_FLAG_VERSION (0x2) /* The client is negotiating the protocol version. */
461
462
463#define VRDE_USB_CAPS_VALID_FLAGS (VRDE_USB_CAPS_FLAG_POLL)
464/* VRDE_USB_VERSION_2: A set of valid flags. */
465#define VRDE_USB_CAPS2_VALID_FLAGS (VRDE_USB_CAPS_FLAG_POLL | VRDE_USB_CAPS2_FLAG_VERSION)
466
467typedef struct _VRDEUSBREQNEGOTIATERET
468{
469 uint8_t flags;
470} VRDEUSBREQNEGOTIATERET;
471
472typedef struct _VRDEUSBREQNEGOTIATERET_2
473{
474 uint8_t flags;
475 uint32_t u32Version; /* This field presents only if the VRDE_USB_CAPS2_FLAG_VERSION flag is set. */
476} VRDEUSBREQNEGOTIATERET_2;
477#pragma pack()
478
479#define VRDE_CLIPBOARD_FORMAT_NULL (0x0)
480#define VRDE_CLIPBOARD_FORMAT_UNICODE_TEXT (0x1)
481#define VRDE_CLIPBOARD_FORMAT_BITMAP (0x2)
482#define VRDE_CLIPBOARD_FORMAT_HTML (0x4)
483
484#define VRDE_CLIPBOARD_FUNCTION_FORMAT_ANNOUNCE (0)
485#define VRDE_CLIPBOARD_FUNCTION_DATA_READ (1)
486#define VRDE_CLIPBOARD_FUNCTION_DATA_WRITE (2)
487
488
489/** Indexes of information values. */
490
491/** Whether a client is connected at the moment.
492 * uint32_t
493 */
494#define VRDE_QI_ACTIVE (0)
495
496/** How many times a client connected up to current moment.
497 * uint32_t
498 */
499#define VRDE_QI_NUMBER_OF_CLIENTS (1)
500
501/** When last connection was established.
502 * int64_t time in milliseconds since 1970-01-01 00:00:00 UTC
503 */
504#define VRDE_QI_BEGIN_TIME (2)
505
506/** When last connection was terminated or current time if connection still active.
507 * int64_t time in milliseconds since 1970-01-01 00:00:00 UTC
508 */
509#define VRDE_QI_END_TIME (3)
510
511/** How many bytes were sent in last (current) connection.
512 * uint64_t
513 */
514#define VRDE_QI_BYTES_SENT (4)
515
516/** How many bytes were sent in all connections.
517 * uint64_t
518 */
519#define VRDE_QI_BYTES_SENT_TOTAL (5)
520
521/** How many bytes were received in last (current) connection.
522 * uint64_t
523 */
524#define VRDE_QI_BYTES_RECEIVED (6)
525
526/** How many bytes were received in all connections.
527 * uint64_t
528 */
529#define VRDE_QI_BYTES_RECEIVED_TOTAL (7)
530
531/** Login user name supplied by the client.
532 * UTF8 nul terminated string.
533 */
534#define VRDE_QI_USER (8)
535
536/** Login domain supplied by the client.
537 * UTF8 nul terminated string.
538 */
539#define VRDE_QI_DOMAIN (9)
540
541/** The client name supplied by the client.
542 * UTF8 nul terminated string.
543 */
544#define VRDE_QI_CLIENT_NAME (10)
545
546/** IP address of the client.
547 * UTF8 nul terminated string.
548 */
549#define VRDE_QI_CLIENT_IP (11)
550
551/** The client software version number.
552 * uint32_t.
553 */
554#define VRDE_QI_CLIENT_VERSION (12)
555
556/** Public key exchange method used when connection was established.
557 * Values: 0 - RDP4 public key exchange scheme.
558 * 1 - X509 sertificates were sent to client.
559 * uint32_t.
560 */
561#define VRDE_QI_ENCRYPTION_STYLE (13)
562
563/** TCP port where the server listens.
564 * Values: 0 - VRDE server failed to start.
565 * -1 - .
566 * int32_t.
567 */
568#define VRDE_QI_PORT (14)
569
570
571/** Hints what has been intercepted by the application. */
572#define VRDE_CLIENT_INTERCEPT_AUDIO (0x1)
573#define VRDE_CLIENT_INTERCEPT_USB (0x2)
574#define VRDE_CLIENT_INTERCEPT_CLIPBOARD (0x4)
575
576
577/** The version of the VRDE server interface. */
578#define VRDE_INTERFACE_VERSION_1 (1)
579#define VRDE_INTERFACE_VERSION_2 (2)
580#define VRDE_INTERFACE_VERSION_3 (3)
581
582/** The header that does not change when the interface changes. */
583typedef struct _VRDEINTERFACEHDR
584{
585 /** The version of the interface. */
586 uint64_t u64Version;
587
588 /** The size of the structure. */
589 uint64_t u64Size;
590
591} VRDEINTERFACEHDR;
592
593/** The VRDE server entry points. Interface version 1. */
594typedef struct _VRDEENTRYPOINTS_1
595{
596 /** The header. */
597 VRDEINTERFACEHDR header;
598
599 /** Destroy the server instance.
600 *
601 * @param hServer The server instance handle.
602 *
603 * @return IPRT status code.
604 */
605 DECLR3CALLBACKMEMBER(void, VRDEDestroy,(HVRDESERVER hServer));
606
607 /** The server should start to accept clients connections.
608 *
609 * @param hServer The server instance handle.
610 * @param fEnable Whether to enable or disable client connections.
611 * When is false, all existing clients are disconnected.
612 *
613 * @return IPRT status code.
614 */
615 DECLR3CALLBACKMEMBER(int, VRDEEnableConnections,(HVRDESERVER hServer,
616 bool fEnable));
617
618 /** The server should disconnect the client.
619 *
620 * @param hServer The server instance handle.
621 * @param u32ClientId The client identifier.
622 * @param fReconnect Whether to send a "REDIRECT to the same server" packet to the
623 * client before disconnecting.
624 *
625 * @return IPRT status code.
626 */
627 DECLR3CALLBACKMEMBER(void, VRDEDisconnect,(HVRDESERVER hServer,
628 uint32_t u32ClientId,
629 bool fReconnect));
630
631 /**
632 * Inform the server that the display was resized.
633 * The server will query information about display
634 * from the application via callbacks.
635 *
636 * @param hServer Handle of VRDE server instance.
637 */
638 DECLR3CALLBACKMEMBER(void, VRDEResize,(HVRDESERVER hServer));
639
640 /**
641 * Send a update.
642 *
643 * @param hServer Handle of VRDE server instance.
644 * @param uScreenId The screen index.
645 * @param pvUpdate Pointer to VBoxGuest.h::VRDEORDERHDR structure with extra data.
646 * @param cbUpdate Size of the update data.
647 */
648 DECLR3CALLBACKMEMBER(void, VRDEUpdate,(HVRDESERVER hServer,
649 unsigned uScreenId,
650 void *pvUpdate,
651 uint32_t cbUpdate));
652
653 /**
654 * Set the mouse pointer shape.
655 *
656 * @param hServer Handle of VRDE server instance.
657 * @param pPointer The pointer shape information.
658 */
659 DECLR3CALLBACKMEMBER(void, VRDEColorPointer,(HVRDESERVER hServer,
660 const VRDECOLORPOINTER *pPointer));
661
662 /**
663 * Hide the mouse pointer.
664 *
665 * @param hServer Handle of VRDE server instance.
666 */
667 DECLR3CALLBACKMEMBER(void, VRDEHidePointer,(HVRDESERVER hServer));
668
669 /**
670 * Queues the samples to be sent to clients.
671 *
672 * @param hServer Handle of VRDE server instance.
673 * @param pvSamples Address of samples to be sent.
674 * @param cSamples Number of samples.
675 * @param format Encoded audio format for these samples.
676 *
677 * @note Initialized to NULL when the application audio callbacks are NULL.
678 */
679 DECLR3CALLBACKMEMBER(void, VRDEAudioSamples,(HVRDESERVER hServer,
680 const void *pvSamples,
681 uint32_t cSamples,
682 VRDEAUDIOFORMAT format));
683
684 /**
685 * Sets the sound volume on clients.
686 *
687 * @param hServer Handle of VRDE server instance.
688 * @param left 0..0xFFFF volume level for left channel.
689 * @param right 0..0xFFFF volume level for right channel.
690 *
691 * @note Initialized to NULL when the application audio callbacks are NULL.
692 */
693 DECLR3CALLBACKMEMBER(void, VRDEAudioVolume,(HVRDESERVER hServer,
694 uint16_t u16Left,
695 uint16_t u16Right));
696
697 /**
698 * Sends a USB request.
699 *
700 * @param hServer Handle of VRDE server instance.
701 * @param u32ClientId An identifier that allows the server to find the corresponding client.
702 * The identifier is always passed by the server as a parameter
703 * of the FNVRDEUSBCALLBACK. Note that the value is the same as
704 * in the VRDESERVERCALLBACK functions.
705 * @param pvParm Function specific parameters buffer.
706 * @param cbParm Size of the buffer.
707 *
708 * @note Initialized to NULL when the application USB callbacks are NULL.
709 */
710 DECLR3CALLBACKMEMBER(void, VRDEUSBRequest,(HVRDESERVER hServer,
711 uint32_t u32ClientId,
712 void *pvParm,
713 uint32_t cbParm));
714
715 /**
716 * Called by the application when (VRDE_CLIPBOARD_FUNCTION_*):
717 * - (0) guest announces available clipboard formats;
718 * - (1) guest requests clipboard data;
719 * - (2) guest responds to the client's request for clipboard data.
720 *
721 * @param hServer The VRDE server handle.
722 * @param u32Function The cause of the call.
723 * @param u32Format Bitmask of announced formats or the format of data.
724 * @param pvData Points to: (1) buffer to be filled with clients data;
725 * (2) data from the host.
726 * @param cbData Size of 'pvData' buffer in bytes.
727 * @param pcbActualRead Size of the copied data in bytes.
728 *
729 * @note Initialized to NULL when the application clipboard callbacks are NULL.
730 */
731 DECLR3CALLBACKMEMBER(void, VRDEClipboard,(HVRDESERVER hServer,
732 uint32_t u32Function,
733 uint32_t u32Format,
734 void *pvData,
735 uint32_t cbData,
736 uint32_t *pcbActualRead));
737
738 /**
739 * Query various information from the VRDE server.
740 *
741 * @param hServer The VRDE server handle.
742 * @param index VRDE_QI_* identifier of information to be returned.
743 * @param pvBuffer Address of memory buffer to which the information must be written.
744 * @param cbBuffer Size of the memory buffer in bytes.
745 * @param pcbOut Size in bytes of returned information value.
746 *
747 * @remark The caller must check the *pcbOut. 0 there means no information was returned.
748 * A value greater than cbBuffer means that information is too big to fit in the
749 * buffer, in that case no information was placed to the buffer.
750 */
751 DECLR3CALLBACKMEMBER(void, VRDEQueryInfo,(HVRDESERVER hServer,
752 uint32_t index,
753 void *pvBuffer,
754 uint32_t cbBuffer,
755 uint32_t *pcbOut));
756} VRDEENTRYPOINTS_1;
757
758/** The VRDE server entry points. Interface version 2.
759 * A new entry point VRDERedirect has been added relative to version 1.
760 */
761typedef struct _VRDEENTRYPOINTS_2
762{
763 /** The header. */
764 VRDEINTERFACEHDR header;
765
766 /** Destroy the server instance.
767 *
768 * @param hServer The server instance handle.
769 *
770 * @return IPRT status code.
771 */
772 DECLR3CALLBACKMEMBER(void, VRDEDestroy,(HVRDESERVER hServer));
773
774 /** The server should start to accept clients connections.
775 *
776 * @param hServer The server instance handle.
777 * @param fEnable Whether to enable or disable client connections.
778 * When is false, all existing clients are disconnected.
779 *
780 * @return IPRT status code.
781 */
782 DECLR3CALLBACKMEMBER(int, VRDEEnableConnections,(HVRDESERVER hServer,
783 bool fEnable));
784
785 /** The server should disconnect the client.
786 *
787 * @param hServer The server instance handle.
788 * @param u32ClientId The client identifier.
789 * @param fReconnect Whether to send a "REDIRECT to the same server" packet to the
790 * client before disconnecting.
791 *
792 * @return IPRT status code.
793 */
794 DECLR3CALLBACKMEMBER(void, VRDEDisconnect,(HVRDESERVER hServer,
795 uint32_t u32ClientId,
796 bool fReconnect));
797
798 /**
799 * Inform the server that the display was resized.
800 * The server will query information about display
801 * from the application via callbacks.
802 *
803 * @param hServer Handle of VRDE server instance.
804 */
805 DECLR3CALLBACKMEMBER(void, VRDEResize,(HVRDESERVER hServer));
806
807 /**
808 * Send a update.
809 *
810 * @param hServer Handle of VRDE server instance.
811 * @param uScreenId The screen index.
812 * @param pvUpdate Pointer to VBoxGuest.h::VRDEORDERHDR structure with extra data.
813 * @param cbUpdate Size of the update data.
814 */
815 DECLR3CALLBACKMEMBER(void, VRDEUpdate,(HVRDESERVER hServer,
816 unsigned uScreenId,
817 void *pvUpdate,
818 uint32_t cbUpdate));
819
820 /**
821 * Set the mouse pointer shape.
822 *
823 * @param hServer Handle of VRDE server instance.
824 * @param pPointer The pointer shape information.
825 */
826 DECLR3CALLBACKMEMBER(void, VRDEColorPointer,(HVRDESERVER hServer,
827 const VRDECOLORPOINTER *pPointer));
828
829 /**
830 * Hide the mouse pointer.
831 *
832 * @param hServer Handle of VRDE server instance.
833 */
834 DECLR3CALLBACKMEMBER(void, VRDEHidePointer,(HVRDESERVER hServer));
835
836 /**
837 * Queues the samples to be sent to clients.
838 *
839 * @param hServer Handle of VRDE server instance.
840 * @param pvSamples Address of samples to be sent.
841 * @param cSamples Number of samples.
842 * @param format Encoded audio format for these samples.
843 *
844 * @note Initialized to NULL when the application audio callbacks are NULL.
845 */
846 DECLR3CALLBACKMEMBER(void, VRDEAudioSamples,(HVRDESERVER hServer,
847 const void *pvSamples,
848 uint32_t cSamples,
849 VRDEAUDIOFORMAT format));
850
851 /**
852 * Sets the sound volume on clients.
853 *
854 * @param hServer Handle of VRDE server instance.
855 * @param left 0..0xFFFF volume level for left channel.
856 * @param right 0..0xFFFF volume level for right channel.
857 *
858 * @note Initialized to NULL when the application audio callbacks are NULL.
859 */
860 DECLR3CALLBACKMEMBER(void, VRDEAudioVolume,(HVRDESERVER hServer,
861 uint16_t u16Left,
862 uint16_t u16Right));
863
864 /**
865 * Sends a USB request.
866 *
867 * @param hServer Handle of VRDE server instance.
868 * @param u32ClientId An identifier that allows the server to find the corresponding client.
869 * The identifier is always passed by the server as a parameter
870 * of the FNVRDEUSBCALLBACK. Note that the value is the same as
871 * in the VRDESERVERCALLBACK functions.
872 * @param pvParm Function specific parameters buffer.
873 * @param cbParm Size of the buffer.
874 *
875 * @note Initialized to NULL when the application USB callbacks are NULL.
876 */
877 DECLR3CALLBACKMEMBER(void, VRDEUSBRequest,(HVRDESERVER hServer,
878 uint32_t u32ClientId,
879 void *pvParm,
880 uint32_t cbParm));
881
882 /**
883 * Called by the application when (VRDE_CLIPBOARD_FUNCTION_*):
884 * - (0) guest announces available clipboard formats;
885 * - (1) guest requests clipboard data;
886 * - (2) guest responds to the client's request for clipboard data.
887 *
888 * @param hServer The VRDE server handle.
889 * @param u32Function The cause of the call.
890 * @param u32Format Bitmask of announced formats or the format of data.
891 * @param pvData Points to: (1) buffer to be filled with clients data;
892 * (2) data from the host.
893 * @param cbData Size of 'pvData' buffer in bytes.
894 * @param pcbActualRead Size of the copied data in bytes.
895 *
896 * @note Initialized to NULL when the application clipboard callbacks are NULL.
897 */
898 DECLR3CALLBACKMEMBER(void, VRDEClipboard,(HVRDESERVER hServer,
899 uint32_t u32Function,
900 uint32_t u32Format,
901 void *pvData,
902 uint32_t cbData,
903 uint32_t *pcbActualRead));
904
905 /**
906 * Query various information from the VRDE server.
907 *
908 * @param hServer The VRDE server handle.
909 * @param index VRDE_QI_* identifier of information to be returned.
910 * @param pvBuffer Address of memory buffer to which the information must be written.
911 * @param cbBuffer Size of the memory buffer in bytes.
912 * @param pcbOut Size in bytes of returned information value.
913 *
914 * @remark The caller must check the *pcbOut. 0 there means no information was returned.
915 * A value greater than cbBuffer means that information is too big to fit in the
916 * buffer, in that case no information was placed to the buffer.
917 */
918 DECLR3CALLBACKMEMBER(void, VRDEQueryInfo,(HVRDESERVER hServer,
919 uint32_t index,
920 void *pvBuffer,
921 uint32_t cbBuffer,
922 uint32_t *pcbOut));
923
924 /**
925 * The server should redirect the client to the specified server.
926 *
927 * @param hServer The server instance handle.
928 * @param u32ClientId The client identifier.
929 * @param pszServer The server to redirect the client to.
930 * @param pszUser The username to use for the redirection.
931 * Can be NULL.
932 * @param pszDomain The domain. Can be NULL.
933 * @param pszPassword The password. Can be NULL.
934 * @param u32SessionId The ID of the session to redirect to.
935 * @param pszCookie The routing token used by a load balancer to
936 * route the redirection. Can be NULL.
937 */
938 DECLR3CALLBACKMEMBER(void, VRDERedirect,(HVRDESERVER hServer,
939 uint32_t u32ClientId,
940 const char *pszServer,
941 const char *pszUser,
942 const char *pszDomain,
943 const char *pszPassword,
944 uint32_t u32SessionId,
945 const char *pszCookie));
946} VRDEENTRYPOINTS_2;
947
948/** The VRDE server entry points. Interface version 3.
949 * A new entry point VRDE has been added relative to version 2.
950 */
951typedef struct _VRDEENTRYPOINTS_3
952{
953 /* The header. */
954 VRDEINTERFACEHDR header;
955
956 /*
957 * Same as version 2.
958 */
959
960 DECLR3CALLBACKMEMBER(void, VRDEDestroy,(HVRDESERVER hServer));
961
962 DECLR3CALLBACKMEMBER(int, VRDEEnableConnections,(HVRDESERVER hServer,
963 bool fEnable));
964
965 DECLR3CALLBACKMEMBER(void, VRDEDisconnect,(HVRDESERVER hServer,
966 uint32_t u32ClientId,
967 bool fReconnect));
968
969 DECLR3CALLBACKMEMBER(void, VRDEResize,(HVRDESERVER hServer));
970
971 DECLR3CALLBACKMEMBER(void, VRDEUpdate,(HVRDESERVER hServer,
972 unsigned uScreenId,
973 void *pvUpdate,
974 uint32_t cbUpdate));
975
976 DECLR3CALLBACKMEMBER(void, VRDEColorPointer,(HVRDESERVER hServer,
977 const VRDECOLORPOINTER *pPointer));
978
979 DECLR3CALLBACKMEMBER(void, VRDEHidePointer,(HVRDESERVER hServer));
980
981 DECLR3CALLBACKMEMBER(void, VRDEAudioSamples,(HVRDESERVER hServer,
982 const void *pvSamples,
983 uint32_t cSamples,
984 VRDEAUDIOFORMAT format));
985
986 DECLR3CALLBACKMEMBER(void, VRDEAudioVolume,(HVRDESERVER hServer,
987 uint16_t u16Left,
988 uint16_t u16Right));
989
990 DECLR3CALLBACKMEMBER(void, VRDEUSBRequest,(HVRDESERVER hServer,
991 uint32_t u32ClientId,
992 void *pvParm,
993 uint32_t cbParm));
994
995 DECLR3CALLBACKMEMBER(void, VRDEClipboard,(HVRDESERVER hServer,
996 uint32_t u32Function,
997 uint32_t u32Format,
998 void *pvData,
999 uint32_t cbData,
1000 uint32_t *pcbActualRead));
1001
1002 DECLR3CALLBACKMEMBER(void, VRDEQueryInfo,(HVRDESERVER hServer,
1003 uint32_t index,
1004 void *pvBuffer,
1005 uint32_t cbBuffer,
1006 uint32_t *pcbOut));
1007
1008 DECLR3CALLBACKMEMBER(void, VRDERedirect,(HVRDESERVER hServer,
1009 uint32_t u32ClientId,
1010 const char *pszServer,
1011 const char *pszUser,
1012 const char *pszDomain,
1013 const char *pszPassword,
1014 uint32_t u32SessionId,
1015 const char *pszCookie));
1016
1017 /*
1018 * New for version 3.
1019 */
1020
1021 /**
1022 * Audio input open request.
1023 *
1024 * @param hServer Handle of VRDE server instance.
1025 * @param u32ClientId An identifier that allows the server to find the corresponding client.
1026 * @param pvCtx To be used in VRDECallbackAudioIn.
1027 * @param audioFormat Requested format of audio data.
1028 *
1029 * @note Initialized to NULL when the VRDECallbackAudioIn callback is NULL.
1030 */
1031 DECLR3CALLBACKMEMBER(void, VRDEAudioInOpen,(HVRDESERVER hServer,
1032 void *pvCtx,
1033 uint32_t u32ClientId,
1034 VRDEAUDIOFORMAT audioFormat));
1035
1036 /**
1037 * Audio input close request.
1038 *
1039 * @param hServer Handle of VRDE server instance.
1040 * @param u32ClientId An identifier that allows the server to find the corresponding client.
1041 *
1042 * @note Initialized to NULL when the VRDECallbackAudioIn callback is NULL.
1043 */
1044 DECLR3CALLBACKMEMBER(void, VRDEAudioInClose,(HVRDESERVER hServer,
1045 uint32_t u32ClientId));
1046} VRDEENTRYPOINTS_3;
1047
1048
1049#define VRDE_QP_NETWORK_PORT (1)
1050#define VRDE_QP_NETWORK_ADDRESS (2)
1051#define VRDE_QP_NUMBER_MONITORS (3)
1052#define VRDE_QP_NETWORK_PORT_RANGE (4)
1053#ifdef VBOX_WITH_VRDP_VIDEO_CHANNEL
1054#define VRDE_QP_VIDEO_CHANNEL (5)
1055#define VRDE_QP_VIDEO_CHANNEL_QUALITY (6)
1056#define VRDE_QP_VIDEO_CHANNEL_SUNFLSH (7)
1057#endif /* VBOX_WITH_VRDP_VIDEO_CHANNEL */
1058#define VRDE_QP_FEATURE (8)
1059
1060#define VRDE_SP_BASE 0x1000
1061#define VRDE_SP_NETWORK_BIND_PORT (VRDE_SP_BASE + 1)
1062
1063#pragma pack(1)
1064/* VRDE_QP_FEATURE data. */
1065typedef struct _VRDEFEATURE
1066{
1067 uint32_t u32ClientId;
1068 char achInfo[1]; /* UTF8 property input name and output value. */
1069} VRDEFEATURE;
1070
1071/* A framebuffer description. */
1072typedef struct _VRDEFRAMEBUFFERINFO
1073{
1074 const uint8_t *pu8Bits;
1075 int xOrigin;
1076 int yOrigin;
1077 unsigned cWidth;
1078 unsigned cHeight;
1079 unsigned cBitsPerPixel;
1080 unsigned cbLine;
1081} VRDEFRAMEBUFFERINFO;
1082
1083#define VRDE_INPUT_SCANCODE 0
1084#define VRDE_INPUT_POINT 1
1085#define VRDE_INPUT_CAD 2
1086#define VRDE_INPUT_RESET 3
1087#define VRDE_INPUT_SYNCH 4
1088
1089typedef struct _VRDEINPUTSCANCODE
1090{
1091 unsigned uScancode;
1092} VRDEINPUTSCANCODE;
1093
1094#define VRDE_INPUT_POINT_BUTTON1 0x01
1095#define VRDE_INPUT_POINT_BUTTON2 0x02
1096#define VRDE_INPUT_POINT_BUTTON3 0x04
1097#define VRDE_INPUT_POINT_WHEEL_UP 0x08
1098#define VRDE_INPUT_POINT_WHEEL_DOWN 0x10
1099
1100typedef struct _VRDEINPUTPOINT
1101{
1102 int x;
1103 int y;
1104 unsigned uButtons;
1105} VRDEINPUTPOINT;
1106
1107#define VRDE_INPUT_SYNCH_SCROLL 0x01
1108#define VRDE_INPUT_SYNCH_NUMLOCK 0x02
1109#define VRDE_INPUT_SYNCH_CAPITAL 0x04
1110
1111typedef struct _VRDEINPUTSYNCH
1112{
1113 unsigned uLockStatus;
1114} VRDEINPUTSYNCH;
1115#pragma pack()
1116
1117/** The VRDE server callbacks. Interface version 1. */
1118typedef struct _VRDECALLBACKS_1
1119{
1120 /** The header. */
1121 VRDEINTERFACEHDR header;
1122
1123 /**
1124 * Query or set various information, on how the VRDE server operates, from or to the application.
1125 *
1126 *
1127 * @param pvCallback The callback specific pointer.
1128 * @param index VRDE_[Q|S]P_* identifier of information to be returned or set.
1129 * @param pvBuffer Address of memory buffer to which the information must be written or read.
1130 * @param cbBuffer Size of the memory buffer in bytes.
1131 * @param pcbOut Size in bytes of returned information value.
1132 *
1133 * @return IPRT status code. VINF_BUFFER_OVERFLOW if the buffer is too small for the value.
1134 */
1135 DECLR3CALLBACKMEMBER(int, VRDECallbackProperty,(void *pvCallback,
1136 uint32_t index,
1137 void *pvBuffer,
1138 uint32_t cbBuffer,
1139 uint32_t *pcbOut));
1140
1141 /* A client is logging in, the application must decide whether
1142 * to let to connect the client. The server will drop the connection,
1143 * when an error code is returned by the callback.
1144 *
1145 * @param pvCallback The callback specific pointer.
1146 * @param u32ClientId An unique client identifier generated by the server.
1147 * @param pszUser The username.
1148 * @param pszPassword The password.
1149 * @param pszDomain The domain.
1150 *
1151 * @return IPRT status code.
1152 */
1153 DECLR3CALLBACKMEMBER(int, VRDECallbackClientLogon,(void *pvCallback,
1154 uint32_t u32ClientId,
1155 const char *pszUser,
1156 const char *pszPassword,
1157 const char *pszDomain));
1158
1159 /* The client has been successfully connected.
1160 *
1161 * @param pvCallback The callback specific pointer.
1162 * @param u32ClientId An unique client identifier generated by the server.
1163 */
1164 DECLR3CALLBACKMEMBER(void, VRDECallbackClientConnect,(void *pvCallback,
1165 uint32_t u32ClientId));
1166
1167 /* The client has been disconnected.
1168 *
1169 * @param pvCallback The callback specific pointer.
1170 * @param u32ClientId An unique client identifier generated by the server.
1171 * @param fu32Intercepted What was intercepted by the client (VRDE_CLIENT_INTERCEPT_*).
1172 */
1173 DECLR3CALLBACKMEMBER(void, VRDECallbackClientDisconnect,(void *pvCallback,
1174 uint32_t u32ClientId,
1175 uint32_t fu32Intercepted));
1176 /* The client supports one of RDP channels.
1177 *
1178 * @param pvCallback The callback specific pointer.
1179 * @param u32ClientId An unique client identifier generated by the server.
1180 * @param fu32Intercept What the client wants to intercept. One of VRDE_CLIENT_INTERCEPT_* flags.
1181 * @param ppvIntercept The value to be passed to the channel specific callback.
1182 *
1183 * @return IPRT status code.
1184 */
1185 DECLR3CALLBACKMEMBER(int, VRDECallbackIntercept,(void *pvCallback,
1186 uint32_t u32ClientId,
1187 uint32_t fu32Intercept,
1188 void **ppvIntercept));
1189
1190 /**
1191 * Called by the server when a reply is received from a client.
1192 *
1193 * @param pvCallback The callback specific pointer.
1194 * @param ppvIntercept The value returned by VRDECallbackIntercept for the VRDE_CLIENT_INTERCEPT_USB.
1195 * @param u32ClientId Identifies the client that sent the reply.
1196 * @param u8Code The operation code VRDE_USB_REQ_*.
1197 * @param pvRet Points to data received from the client.
1198 * @param cbRet Size of the data in bytes.
1199 *
1200 * @return IPRT status code.
1201 */
1202 DECLR3CALLBACKMEMBER(int, VRDECallbackUSB,(void *pvCallback,
1203 void *pvIntercept,
1204 uint32_t u32ClientId,
1205 uint8_t u8Code,
1206 const void *pvRet,
1207 uint32_t cbRet));
1208
1209 /**
1210 * Called by the server when (VRDE_CLIPBOARD_FUNCTION_*):
1211 * - (0) client announces available clipboard formats;
1212 * - (1) client requests clipboard data.
1213 *
1214 * @param pvCallback The callback specific pointer.
1215 * @param ppvIntercept The value returned by VRDECallbackIntercept for the VRDE_CLIENT_INTERCEPT_CLIPBOARD.
1216 * @param u32ClientId Identifies the RDP client that sent the reply.
1217 * @param u32Function The cause of the callback.
1218 * @param u32Format Bitmask of reported formats or the format of received data.
1219 * @param pvData Reserved.
1220 * @param cbData Reserved.
1221 *
1222 * @return IPRT status code.
1223 */
1224 DECLR3CALLBACKMEMBER(int, VRDECallbackClipboard,(void *pvCallback,
1225 void *pvIntercept,
1226 uint32_t u32ClientId,
1227 uint32_t u32Function,
1228 uint32_t u32Format,
1229 const void *pvData,
1230 uint32_t cbData));
1231
1232 /* The framebuffer information is queried.
1233 *
1234 * @param pvCallback The callback specific pointer.
1235 * @param uScreenId The framebuffer index.
1236 * @param pInfo The information structure to ber filled.
1237 *
1238 * @return Whether the framebuffer is available.
1239 */
1240 DECLR3CALLBACKMEMBER(bool, VRDECallbackFramebufferQuery,(void *pvCallback,
1241 unsigned uScreenId,
1242 VRDEFRAMEBUFFERINFO *pInfo));
1243
1244 /* The framebuffer is locked.
1245 *
1246 * @param pvCallback The callback specific pointer.
1247 * @param uScreenId The framebuffer index.
1248 */
1249 DECLR3CALLBACKMEMBER(void, VRDECallbackFramebufferLock,(void *pvCallback,
1250 unsigned uScreenId));
1251
1252 /* The framebuffer is unlocked.
1253 *
1254 * @param pvCallback The callback specific pointer.
1255 * @param uScreenId The framebuffer index.
1256 */
1257 DECLR3CALLBACKMEMBER(void, VRDECallbackFramebufferUnlock,(void *pvCallback,
1258 unsigned uScreenId));
1259
1260 /* Input from the client.
1261 *
1262 * @param pvCallback The callback specific pointer.
1263 * @param pvInput The input information.
1264 * @param cbInput The size of the input information.
1265 */
1266 DECLR3CALLBACKMEMBER(void, VRDECallbackInput,(void *pvCallback,
1267 int type,
1268 const void *pvInput,
1269 unsigned cbInput));
1270
1271 /* Video mode hint from the client.
1272 *
1273 * @param pvCallback The callback specific pointer.
1274 * @param cWidth Requested width.
1275 * @param cHeight Requested height.
1276 * @param cBitsPerPixel Requested color depth.
1277 * @param uScreenId The framebuffer index.
1278 */
1279 DECLR3CALLBACKMEMBER(void, VRDECallbackVideoModeHint,(void *pvCallback,
1280 unsigned cWidth,
1281 unsigned cHeight,
1282 unsigned cBitsPerPixel,
1283 unsigned uScreenId));
1284
1285} VRDECALLBACKS_1;
1286
1287/* Callbacks are the same for the version 1 and version 2 interfaces. */
1288typedef VRDECALLBACKS_1 VRDECALLBACKS_2;
1289
1290/** The VRDE server callbacks. Interface version 3. */
1291typedef struct _VRDECALLBACKS_3
1292{
1293 /* The header. */
1294 VRDEINTERFACEHDR header;
1295
1296 /*
1297 * Same as in version 2.
1298 */
1299 DECLR3CALLBACKMEMBER(int, VRDECallbackProperty,(void *pvCallback,
1300 uint32_t index,
1301 void *pvBuffer,
1302 uint32_t cbBuffer,
1303 uint32_t *pcbOut));
1304
1305 DECLR3CALLBACKMEMBER(int, VRDECallbackClientLogon,(void *pvCallback,
1306 uint32_t u32ClientId,
1307 const char *pszUser,
1308 const char *pszPassword,
1309 const char *pszDomain));
1310
1311 DECLR3CALLBACKMEMBER(void, VRDECallbackClientConnect,(void *pvCallback,
1312 uint32_t u32ClientId));
1313
1314 DECLR3CALLBACKMEMBER(void, VRDECallbackClientDisconnect,(void *pvCallback,
1315 uint32_t u32ClientId,
1316 uint32_t fu32Intercepted));
1317 DECLR3CALLBACKMEMBER(int, VRDECallbackIntercept,(void *pvCallback,
1318 uint32_t u32ClientId,
1319 uint32_t fu32Intercept,
1320 void **ppvIntercept));
1321
1322 DECLR3CALLBACKMEMBER(int, VRDECallbackUSB,(void *pvCallback,
1323 void *pvIntercept,
1324 uint32_t u32ClientId,
1325 uint8_t u8Code,
1326 const void *pvRet,
1327 uint32_t cbRet));
1328
1329 DECLR3CALLBACKMEMBER(int, VRDECallbackClipboard,(void *pvCallback,
1330 void *pvIntercept,
1331 uint32_t u32ClientId,
1332 uint32_t u32Function,
1333 uint32_t u32Format,
1334 const void *pvData,
1335 uint32_t cbData));
1336
1337 DECLR3CALLBACKMEMBER(bool, VRDECallbackFramebufferQuery,(void *pvCallback,
1338 unsigned uScreenId,
1339 VRDEFRAMEBUFFERINFO *pInfo));
1340
1341 DECLR3CALLBACKMEMBER(void, VRDECallbackFramebufferLock,(void *pvCallback,
1342 unsigned uScreenId));
1343
1344 DECLR3CALLBACKMEMBER(void, VRDECallbackFramebufferUnlock,(void *pvCallback,
1345 unsigned uScreenId));
1346
1347 DECLR3CALLBACKMEMBER(void, VRDECallbackInput,(void *pvCallback,
1348 int type,
1349 const void *pvInput,
1350 unsigned cbInput));
1351
1352 DECLR3CALLBACKMEMBER(void, VRDECallbackVideoModeHint,(void *pvCallback,
1353 unsigned cWidth,
1354 unsigned cHeight,
1355 unsigned cBitsPerPixel,
1356 unsigned uScreenId));
1357
1358 /*
1359 * New for version 3.
1360 */
1361
1362 /**
1363 * Called by the server when something happens with audio input.
1364 *
1365 * @param pvCallback The callback specific pointer.
1366 * @param pvCtx The value passed in VRDEAudioInOpen.
1367 * @param u32ClientId Identifies the client that sent the reply.
1368 * @param u32Event The event code VRDE_AUDIOIN_*.
1369 * @param pvData Points to data received from the client.
1370 * @param cbData Size of the data in bytes.
1371 */
1372 DECLR3CALLBACKMEMBER(void, VRDECallbackAudioIn,(void *pvCallback,
1373 void *pvCtx,
1374 uint32_t u32ClientId,
1375 uint32_t u32Event,
1376 const void *pvData,
1377 uint32_t cbData));
1378} VRDECALLBACKS_3;
1379
1380/**
1381 * Create a new VRDE server instance. The instance is fully functional but refuses
1382 * client connections until the entry point VRDEEnableConnections is called by the application.
1383 *
1384 * The caller prepares the VRDECALLBACKS_* structure. The header.u64Version field of the
1385 * structure must be initialized with the version of the interface to use.
1386 * The server will return pointer to VRDEENTRYPOINTS_* table in *ppEntryPoints
1387 * to match the requested interface.
1388 * That is if pCallbacks->header.u64Version == VRDE_INTERFACE_VERSION_1, then the server
1389 * expects pCallbacks to point to VRDECALLBACKS_1 and will return a pointer to VRDEENTRYPOINTS_1.
1390 *
1391 * @param pCallback Pointer to the application callbacks which let the server to fetch
1392 * the configuration data and to access the desktop.
1393 * @param pvCallback The callback specific pointer to be passed back to the application.
1394 * @param ppEntryPoints Where to store the pointer to the VRDE entry points structure.
1395 * @param phServer Pointer to the created server instance handle.
1396 *
1397 * @return IPRT status code.
1398 */
1399DECLEXPORT(int) VRDECreateServer (const VRDEINTERFACEHDR *pCallbacks,
1400 void *pvCallback,
1401 VRDEINTERFACEHDR **ppEntryPoints,
1402 HVRDESERVER *phServer);
1403
1404typedef DECLCALLBACK(int) FNVRDECREATESERVER (const VRDEINTERFACEHDR *pCallbacks,
1405 void *pvCallback,
1406 VRDEINTERFACEHDR **ppEntryPoints,
1407 HVRDESERVER *phServer);
1408typedef FNVRDECREATESERVER *PFNVRDECREATESERVER;
1409
1410RT_C_DECLS_END
1411
1412/** @} */
1413
1414#endif
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette