~ubuntu-branches/ubuntu/gutsy/virtualbox-ose/gutsy

« back to all changes in this revision

Viewing changes to include/VBox/pdmifs.h

  • Committer: Bazaar Package Importer
  • Author(s): Steve Kowalik
  • Date: 2007-09-08 16:44:58 UTC
  • Revision ID: james.westby@ubuntu.com-20070908164458-wao29470vqtr8ksy
Tags: upstream-1.5.0-dfsg2
ImportĀ upstreamĀ versionĀ 1.5.0-dfsg2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/** @file
 
2
 * PDM - Pluggable Device Manager, Interfaces.
 
3
 */
 
4
 
 
5
/*
 
6
 * Copyright (C) 2006-2007 innotek GmbH
 
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 as published by the Free Software Foundation,
 
12
 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
 
13
 * distribution. VirtualBox OSE is distributed in the hope that it will
 
14
 * be useful, but WITHOUT ANY WARRANTY of any kind.
 
15
 */
 
16
 
 
17
#ifndef ___VBox_pdmifs_h
 
18
#define ___VBox_pdmifs_h
 
19
 
 
20
#include <VBox/types.h>
 
21
#include <VBox/hgcmsvc.h>
 
22
 
 
23
__BEGIN_DECLS
 
24
 
 
25
/** @defgroup grp_pdm_interfaces    Interfaces
 
26
 * @ingroup grp_pdm
 
27
 * @{
 
28
 */
 
29
 
 
30
/**
 
31
 * Driver interface identficators.
 
32
 *
 
33
 * @remark  All interfaces have to be declared here. There is no such thing as
 
34
 *          private interface identifiers since they must be unique.
 
35
 *
 
36
 *          That said, interface structures and other stuff can be put elsewhere,
 
37
 *          actually, it is best if this file is not flooded with structures that
 
38
 *          could be put closer to home.
 
39
 */
 
40
typedef enum PDMINTERFACE
 
41
{
 
42
    /** PDMIBASE                - The interface everyone supports. */
 
43
    PDMINTERFACE_BASE = 1,
 
44
    /** PDMIMOUSEPORT           - The mouse port interface.             (Down)  Coupled with PDMINTERFACE_MOUSE_CONNECTOR. */
 
45
    PDMINTERFACE_MOUSE_PORT,
 
46
    /** PDMIMOUSECONNECTOR      - The mouse connector interface.        (Up)    Coupled with PDMINTERFACE_MOUSE_PORT. */
 
47
    PDMINTERFACE_MOUSE_CONNECTOR,
 
48
    /** PDMIKEYBOARDPORT        - The keyboard port interface.          (Down)  Coupled with PDMINTERFACE_KEYBOARD_CONNECTOR. */
 
49
    PDMINTERFACE_KEYBOARD_PORT,
 
50
    /** PDMIKEYBOARDCONNECTOR   - The keyboard connector interface.     (Up)    Coupled with PDMINTERFACE_KEYBOARD_PORT. */
 
51
    PDMINTERFACE_KEYBOARD_CONNECTOR,
 
52
    /** PDMIDISPLAYPORT         - The display port interface.           (Down)  Coupled with PDMINTERFACE_DISPLAY_CONNECTOR. */
 
53
    PDMINTERFACE_DISPLAY_PORT,
 
54
    /** PDMIDISPLAYCONNECTOR    - The display connector interface.      (Up)    Coupled with PDMINTERFACE_DISPLAY_PORT. */
 
55
    PDMINTERFACE_DISPLAY_CONNECTOR,
 
56
    /** PDMICHARPORT            - The char notify interface.            (Down)  Coupled with PDMINTERFACE_CHAR. */
 
57
    PDMINTERFACE_CHAR_PORT,
 
58
    /** PDMICHAR                - The char driver interface.            (Up)    Coupled with PDMINTERFACE_CHAR_PORT. */
 
59
    PDMINTERFACE_CHAR,
 
60
    /** PDMISTREAM              - The stream driver interface           (Up)    No coupling.
 
61
     * Used by a char driver to implement PDMINTERFACE_CHAR. */
 
62
    PDMINTERFACE_STREAM,
 
63
    /** PDMIBLOCKPORT           - The block notify interface            (Down)  Coupled with PDMINTERFACE_BLOCK. */
 
64
    PDMINTERFACE_BLOCK_PORT,
 
65
    /** PDMIBLOCK               - The block driver interface            (Up)    Coupled with PDMINTERFACE_BLOCK_PORT. */
 
66
    PDMINTERFACE_BLOCK,
 
67
    /** PDMIBLOCKBIOS           - The block bios interface.             (External) */
 
68
    PDMINTERFACE_BLOCK_BIOS,
 
69
    /** PDMIMOUNTNOTIFY         - The mountable notification interface. (Down)  Coupled with PDMINTERFACE_MOUNT. */
 
70
    PDMINTERFACE_MOUNT_NOTIFY,
 
71
    /** PDMIMOUNT               - The mountable interface.              (Up)    Coupled with PDMINTERFACE_MOUNT_NOTIFY. */
 
72
    PDMINTERFACE_MOUNT,
 
73
    /** PDMIMEDIA               - The media interface.                  (Up)    No coupling.
 
74
     * Used by a block unit driver to implement PDMINTERFACE_BLOCK and PDMINTERFACE_BLOCK_BIOS. */
 
75
    PDMINTERFACE_MEDIA,
 
76
    /** PDMIISCSITRANSPORT      - The iSCSI transport interface         (Up)    No coupling.
 
77
     * used by the iSCSI media driver.  */
 
78
    PDMINTERFACE_ISCSITRANSPORT,
 
79
 
 
80
    /** PDMINETWORKPORT         - The network port interface.           (Down)  Coupled with PDMINTERFACE_NETWORK_CONNECTOR. */
 
81
    PDMINTERFACE_NETWORK_PORT,
 
82
    /** PDMINETWORKPORT         - The network connector interface.      (Up)    Coupled with PDMINTERFACE_NETWORK_PORT. */
 
83
    PDMINTERFACE_NETWORK_CONNECTOR,
 
84
    /** PDMINETWORKCONFIG       - The network configuartion interface.  (Main)  Used by the managment api. */
 
85
    PDMINTERFACE_NETWORK_CONFIG,
 
86
 
 
87
    /** PDMIAUDIOCONNECTOR      - The audio driver interface.           (Up)    No coupling. */
 
88
    PDMINTERFACE_AUDIO_CONNECTOR,
 
89
 
 
90
    /** PDMIAUDIOSNIFFERPORT    - The Audio Sniffer Device port interface. */
 
91
    PDMINTERFACE_AUDIO_SNIFFER_PORT,
 
92
    /** PDMIAUDIOSNIFFERCONNECTOR - The Audio Sniffer Driver connector interface. */
 
93
    PDMINTERFACE_AUDIO_SNIFFER_CONNECTOR,
 
94
 
 
95
    /** PDMIVMMDEVPORT          - The VMM Device port interface. */
 
96
    PDMINTERFACE_VMMDEV_PORT,
 
97
    /** PDMIVMMDEVCONNECTOR     - The VMM Device connector interface. */
 
98
    PDMINTERFACE_VMMDEV_CONNECTOR,
 
99
 
 
100
    /** PDMILEDPORTS            - The generic LED port interface.       (Down)  Coupled with PDMINTERFACE_LED_CONNECTORS. */
 
101
    PDMINTERFACE_LED_PORTS,
 
102
    /** PDMILEDCONNECTORS       - The generic LED connector interface.  (Up)    Coupled with PDMINTERFACE_LED_PORTS.  */
 
103
    PDMINTERFACE_LED_CONNECTORS,
 
104
 
 
105
    /** PDMIACPIPORT            - ACPI port interface.                  (Down)   Coupled with PDMINTERFACE_ACPI_CONNECTOR. */
 
106
    PDMINTERFACE_ACPI_PORT,
 
107
    /** PDMIACPICONNECTOR       - ACPI connector interface.             (Up)     Coupled with PDMINTERFACE_ACPI_PORT. */
 
108
    PDMINTERFACE_ACPI_CONNECTOR,
 
109
 
 
110
    /** PDMIHGCMPORT            - The Host-Guest communication manager port interface. Normally implemented by VMMDev. */
 
111
    PDMINTERFACE_HGCM_PORT,
 
112
    /** PDMIHGCMCONNECTOR       - The Host-Guest communication manager connector interface. Normally implemented by Main::VMMDevInterface. */
 
113
    PDMINTERFACE_HGCM_CONNECTOR,
 
114
 
 
115
    /** VUSBIROOTHUBPORT        - VUSB RootHub port interface.          (Down)   Coupled with PDMINTERFACE_USB_RH_CONNECTOR. */
 
116
    PDMINTERFACE_VUSB_RH_PORT,
 
117
    /** VUSBIROOTHUBCONNECTOR   - VUSB RootHub connector interface.     (Up)     Coupled with PDMINTERFACE_USB_RH_PORT. */
 
118
    PDMINTERFACE_VUSB_RH_CONNECTOR,
 
119
    /** VUSBIRHCONFIG           - VUSB RootHub configuration interface. (Main)   Used by the managment api. */
 
120
    PDMINTERFACE_VUSB_RH_CONFIG,
 
121
 
 
122
    /** VUSBROOTHUBCONNECTOR    - VUSB Device interface.                (Up)     No coupling. */
 
123
    PDMINTERFACE_VUSB_DEVICE,
 
124
 
 
125
    /** PDMIHOSTDEVICEPORT      - The Host Device port interface.       (Down)   Coupled with PDMINTERFACE_HOST_DEVICE_CONNECTOR. */
 
126
    PDMINTERFACE_HOST_DEVICE_PORT,
 
127
    /** PDMIHOSTDEVICECONNECTOR - The Host device connector interface   (Up)     Coupled with PDMINTERFACE_HOST_DEVICE_PORT. */
 
128
    PDMINTERFACE_HOST_DEVICE_CONNECTOR,
 
129
 
 
130
    /** Maximum interface number. */
 
131
    PDMINTERFACE_MAX
 
132
} PDMINTERFACE;
 
133
 
 
134
 
 
135
/**
 
136
 * PDM Driver Base Interface.
 
137
 */
 
138
typedef struct PDMIBASE
 
139
{
 
140
    /**
 
141
     * Queries an interface to the driver.
 
142
     *
 
143
     * @returns Pointer to interface.
 
144
     * @returns NULL if the interface was not supported by the driver.
 
145
     * @param   pInterface          Pointer to this interface structure.
 
146
     * @param   enmInterface        The requested interface identification.
 
147
     * @thread  Any thread.
 
148
     */
 
149
    DECLR3CALLBACKMEMBER(void *, pfnQueryInterface,(struct PDMIBASE *pInterface, PDMINTERFACE enmInterface));
 
150
} PDMIBASE;
 
151
 
 
152
 
 
153
/**
 
154
 * Dummy interface.
 
155
 *
 
156
 * This is used to typedef other dummy interfaces. The purpose of a dummy
 
157
 * interface is to validate the logical function of a driver/device and
 
158
 * full a natural interface pair.
 
159
 */
 
160
typedef struct PDMIDUMMY
 
161
{
 
162
    RTHCPTR pvDummy;
 
163
} PDMIDUMMY;
 
164
 
 
165
 
 
166
/** Pointer to a mouse port interface. */
 
167
typedef struct PDMIMOUSEPORT *PPDMIMOUSEPORT;
 
168
/**
 
169
 * Mouse port interface.
 
170
 * Pair with PDMIMOUSECONNECTOR.
 
171
 */
 
172
typedef struct PDMIMOUSEPORT
 
173
{
 
174
    /**
 
175
     * Puts a mouse event.
 
176
     * This is called by the source of mouse events. The event will be passed up until the
 
177
     * topmost driver, which then calls the registered event handler.
 
178
     *
 
179
     * @returns VBox status code.
 
180
     * @param   pInterface          Pointer to this interface structure.
 
181
     * @param   i32DeltaX       The X delta.
 
182
     * @param   i32DeltaY       The Y delta.
 
183
     * @param   i32DeltaZ       The Z delta.
 
184
     * @param   fButtonStates   The button states, see the PDMIMOUSEPORT_BUTTON_* \#defines.
 
185
     * @thread  The emulation thread.
 
186
     */
 
187
    DECLR3CALLBACKMEMBER(int, pfnPutEvent,(PPDMIMOUSEPORT pInterface, int32_t i32DeltaX, int32_t i32DeltaY, int32_t i32DeltaZ, uint32_t fButtonStates));
 
188
} PDMIMOUSEPORT;
 
189
 
 
190
/** Mouse button defines for PDMIMOUSEPORT::pfnPutEvent.
 
191
 * @{ */
 
192
#define PDMIMOUSEPORT_BUTTON_LEFT   BIT(0)
 
193
#define PDMIMOUSEPORT_BUTTON_RIGHT  BIT(1)
 
194
#define PDMIMOUSEPORT_BUTTON_MIDDLE BIT(2)
 
195
/** @} */
 
196
 
 
197
 
 
198
/**
 
199
 * Mouse connector interface.
 
200
 * Pair with PDMIMOUSEPORT.
 
201
 */
 
202
typedef PDMIDUMMY PDMIMOUSECONNECTOR;
 
203
 /** Pointer to a mouse connector interface. */
 
204
typedef PDMIMOUSECONNECTOR *PPDMIMOUSECONNECTOR;
 
205
 
 
206
 
 
207
/** Pointer to a keyboard port interface. */
 
208
typedef struct PDMIKEYBOARDPORT *PPDMIKEYBOARDPORT;
 
209
/**
 
210
 * Keyboard port interface.
 
211
 * Pair with PDMIKEYBOARDCONNECTOR.
 
212
 */
 
213
typedef struct PDMIKEYBOARDPORT
 
214
{
 
215
    /**
 
216
     * Puts a keyboard event.
 
217
     * This is called by the source of keyboard events. The event will be passed up until the
 
218
     * topmost driver, which then calls the registered event handler.
 
219
     *
 
220
     * @returns VBox status code.
 
221
     * @param   pInterface          Pointer to this interface structure.
 
222
     * @param   u8KeyCode           The keycode to queue.
 
223
     * @thread  The emulation thread.
 
224
     */
 
225
    DECLR3CALLBACKMEMBER(int, pfnPutEvent,(PPDMIKEYBOARDPORT pInterface, uint8_t u8KeyCode));
 
226
} PDMIKEYBOARDPORT;
 
227
 
 
228
/**
 
229
 * Keyboard LEDs.
 
230
 */
 
231
typedef enum PDMKEYBLEDS
 
232
{
 
233
    /** No leds. */
 
234
    PDMKEYBLEDS_NONE             = 0x0000,
 
235
    /** Num Lock */
 
236
    PDMKEYBLEDS_NUMLOCK          = 0x0001,
 
237
    /** Caps Lock */
 
238
    PDMKEYBLEDS_CAPSLOCK         = 0x0002,
 
239
    /** Scroll Lock */
 
240
    PDMKEYBLEDS_SCROLLLOCK       = 0x0004
 
241
} PDMKEYBLEDS;
 
242
 
 
243
/** Pointer to keyboard connector interface. */
 
244
typedef struct PDMIKEYBOARDCONNECTOR *PPDMIKEYBOARDCONNECTOR;
 
245
 
 
246
 
 
247
/**
 
248
 * Keyboard connector interface.
 
249
 * Pair with PDMIKEYBOARDPORT
 
250
 */
 
251
typedef struct PDMIKEYBOARDCONNECTOR
 
252
{
 
253
    /**
 
254
     * Notifies the the downstream driver about an LED change initiated by the guest.
 
255
     *
 
256
     * @param   pInterface      Pointer to the this interface.
 
257
     * @param   enmLeds         The new led mask.
 
258
     */
 
259
    DECLR3CALLBACKMEMBER(void, pfnLedStatusChange,(PPDMIKEYBOARDCONNECTOR pInterface, PDMKEYBLEDS enmLeds));
 
260
 
 
261
} PDMIKEYBOARDCONNECTOR;
 
262
 
 
263
 
 
264
 
 
265
/** Pointer to a display port interface. */
 
266
typedef struct PDMIDISPLAYPORT *PPDMIDISPLAYPORT;
 
267
/**
 
268
 * Display port interface.
 
269
 * Pair with PDMIDISPLAYCONNECTOR.
 
270
 */
 
271
typedef struct PDMIDISPLAYPORT
 
272
{
 
273
    /**
 
274
     * Update the display with any changed regions.
 
275
     *
 
276
     * Flushes any display changes to the memory pointed to by the
 
277
     * PDMIDISPLAYCONNECTOR interface and calles PDMIDISPLAYCONNECTOR::pfnUpdateRect()
 
278
     * while doing so.
 
279
     *
 
280
     * @returns VBox status code.
 
281
     * @param   pInterface          Pointer to this interface.
 
282
     * @thread  The emulation thread.
 
283
     */
 
284
    DECLR3CALLBACKMEMBER(int, pfnUpdateDisplay,(PPDMIDISPLAYPORT pInterface));
 
285
 
 
286
    /**
 
287
     * Update the entire display.
 
288
     *
 
289
     * Flushes the entire display content to the memory pointed to by the
 
290
     * PDMIDISPLAYCONNECTOR interface and calles PDMIDISPLAYCONNECTOR::pfnUpdateRect().
 
291
     *
 
292
     * @returns VBox status code.
 
293
     * @param   pInterface          Pointer to this interface.
 
294
     * @thread  The emulation thread.
 
295
     */
 
296
    DECLR3CALLBACKMEMBER(int, pfnUpdateDisplayAll,(PPDMIDISPLAYPORT pInterface));
 
297
 
 
298
    /**
 
299
     * Return the current guest color depth in bits per pixel (bpp).
 
300
     *
 
301
     * As the graphics card is able to provide display updates with the bpp
 
302
     * requested by the host, this method can be used to query the actual
 
303
     * guest color depth.
 
304
     *
 
305
     * @returns VBox status code.
 
306
     * @param   pInterface         Pointer to this interface.
 
307
     * @param   pcBits             Where to store the current guest color depth.
 
308
     * @thread  Any thread.
 
309
     */
 
310
    DECLR3CALLBACKMEMBER(int, pfnQueryColorDepth,(PPDMIDISPLAYPORT pInterface, uint32_t *pcBits));
 
311
 
 
312
    /**
 
313
     * Sets the refresh rate and restart the timer.
 
314
     * The rate is defined as the minimum interval between the return of
 
315
     * one PDMIDISPLAYPORT::pfnRefresh() call to the next one.
 
316
     *
 
317
     * The interval timer will be restarted by this call. So at VM startup
 
318
     * this function must be called to start the refresh cycle. The refresh
 
319
     * rate is not saved, but have to be when resuming a loaded VM state.
 
320
     *
 
321
     * @returns VBox status code.
 
322
     * @param   pInterface          Pointer to this interface.
 
323
     * @param   cMilliesInterval    Number of millies between two refreshes.
 
324
     * @thread  Any thread.
 
325
     */
 
326
    DECLR3CALLBACKMEMBER(int, pfnSetRefreshRate,(PPDMIDISPLAYPORT pInterface, uint32_t cMilliesInterval));
 
327
 
 
328
    /**
 
329
     * Create a 32-bbp snapshot of the display.
 
330
     *
 
331
     * This will create a 32-bbp bitmap with dword aligned scanline length. Because
 
332
     * of a wish for no locks in the graphics device, this must be called from the
 
333
     * emulation thread.
 
334
     *
 
335
     * @param   pInterface          Pointer to this interface.
 
336
     * @param   pvData              Pointer the buffer to copy the bits to.
 
337
     * @param   cbData              Size of the buffer.
 
338
     * @param   pcx                 Where to store the width of the bitmap. (optional)
 
339
     * @param   pcy                 Where to store the height of the bitmap. (optional)
 
340
     * @param   pcbData             Where to store the actual size of the bitmap. (optional)
 
341
     * @thread  The emulation thread.
 
342
     */
 
343
    DECLR3CALLBACKMEMBER(int, pfnSnapshot,(PPDMIDISPLAYPORT pInterface, void *pvData, size_t cbData, uint32_t *pcx, uint32_t *pcy, size_t *pcbData));
 
344
 
 
345
    /**
 
346
     * Copy bitmap to the display.
 
347
     *
 
348
     * This will convert and copy a 32-bbp bitmap (with dword aligned scanline length) to
 
349
     * the memory pointed to by the PDMIDISPLAYCONNECTOR interface.
 
350
     *
 
351
     * @param   pInterface          Pointer to this interface.
 
352
     * @param   pvData              Pointer to the bitmap bits.
 
353
     * @param   x                   The upper left corner x coordinate of the destination rectangle.
 
354
     * @param   y                   The upper left corner y coordinate of the destination rectangle.
 
355
     * @param   cx                  The width of the source and destination rectangles.
 
356
     * @param   cy                  The height of the source and destination rectangles.
 
357
     * @thread  The emulation thread.
 
358
     * @remark  This is just a convenience for using the bitmap conversions of the
 
359
     *          graphics device.
 
360
     */
 
361
    DECLR3CALLBACKMEMBER(int, pfnDisplayBlt,(PPDMIDISPLAYPORT pInterface, const void *pvData, uint32_t x, uint32_t y, uint32_t cx, uint32_t cy));
 
362
 
 
363
    /**
 
364
     * Render a rectangle from guest VRAM to Framebuffer.
 
365
     *
 
366
     * @param   pInterface          Pointer to this interface.
 
367
     * @param   x                   The upper left corner x coordinate of the rectangle to be updated.
 
368
     * @param   y                   The upper left corner y coordinate of the rectangle to be updated.
 
369
     * @param   cx                  The width of the rectangle to be updated.
 
370
     * @param   cy                  The height of the rectangle to be updated.
 
371
     * @thread  The emulation thread.
 
372
     */
 
373
    DECLR3CALLBACKMEMBER(void, pfnUpdateDisplayRect,(PPDMIDISPLAYPORT pInterface, int32_t x, int32_t y, uint32_t cx, uint32_t cy));
 
374
 
 
375
    /**
 
376
     * Inform the VGA device whether the Display is directly using the guest VRAM and there is no need
 
377
     * to render the VRAM to the framebuffer memory.
 
378
     *
 
379
     * @param   pInterface          Pointer to this interface.
 
380
     * @param   fRender             Whether the VRAM content must be rendered to the framebuffer.
 
381
     * @thread  The emulation thread.
 
382
     */
 
383
    DECLR3CALLBACKMEMBER(void, pfnSetRenderVRAM,(PPDMIDISPLAYPORT pInterface, bool fRender));
 
384
 
 
385
} PDMIDISPLAYPORT;
 
386
 
 
387
 
 
388
/** Pointer to a display connector interface. */
 
389
typedef struct PDMIDISPLAYCONNECTOR *PPDMIDISPLAYCONNECTOR;
 
390
/**
 
391
 * Display connector interface.
 
392
 * Pair with PDMIDISPLAYPORT.
 
393
 */
 
394
typedef struct PDMIDISPLAYCONNECTOR
 
395
{
 
396
    /**
 
397
     * Resize the display.
 
398
     * This is called when the resolution changes. This usually happens on
 
399
     * request from the guest os, but may also happen as the result of a reset.
 
400
     * If the callback returns VINF_VGA_RESIZE_IN_PROGRESS, the caller (VGA device)
 
401
     * must not access the connector and return.
 
402
     *
 
403
     * @returns VINF_SUCCESS if the framebuffer resize was completed,
 
404
     *          VINF_VGA_RESIZE_IN_PROGRESS if resize takes time and not yet finished.
 
405
     * @param   pInterface          Pointer to this interface.
 
406
     * @param   cBits               Color depth (bits per pixel) of the new video mode.
 
407
     * @param   pvVRAM              Address of the guest VRAM.
 
408
     * @param   cbLine              Size in bytes of a single scan line.
 
409
     * @param   cx                  New display width.
 
410
     * @param   cy                  New display height.
 
411
     * @thread  The emulation thread.
 
412
     */
 
413
    DECLR3CALLBACKMEMBER(int, pfnResize,(PPDMIDISPLAYCONNECTOR pInterface, uint32_t cBits, void *pvVRAM, uint32_t cbLine, uint32_t cx, uint32_t cy));
 
414
 
 
415
    /**
 
416
     * Update a rectangle of the display.
 
417
     * PDMIDISPLAYPORT::pfnUpdateDisplay is the caller.
 
418
     *
 
419
     * @param   pInterface          Pointer to this interface.
 
420
     * @param   x                   The upper left corner x coordinate of the rectangle.
 
421
     * @param   y                   The upper left corner y coordinate of the rectangle.
 
422
     * @param   cx                  The width of the rectangle.
 
423
     * @param   cy                  The height of the rectangle.
 
424
     * @thread  The emulation thread.
 
425
     */
 
426
    DECLR3CALLBACKMEMBER(void, pfnUpdateRect,(PPDMIDISPLAYCONNECTOR pInterface, uint32_t x, uint32_t y, uint32_t cx, uint32_t cy));
 
427
 
 
428
    /**
 
429
     * Refresh the display.
 
430
     *
 
431
     * The interval between these calls is set by
 
432
     * PDMIDISPLAYPORT::pfnSetRefreshRate(). The driver should call
 
433
     * PDMIDISPLAYPORT::pfnUpdateDisplay() if it wishes to refresh the
 
434
     * display. PDMIDISPLAYPORT::pfnUpdateDisplay calls pfnUpdateRect with
 
435
     * the changed rectangles.
 
436
     *
 
437
     * @param   pInterface          Pointer to this interface.
 
438
     * @thread  The emulation thread.
 
439
     */
 
440
    DECLR3CALLBACKMEMBER(void, pfnRefresh,(PPDMIDISPLAYCONNECTOR pInterface));
 
441
 
 
442
    /**
 
443
     * Reset the display.
 
444
     *
 
445
     * Notification message when the graphics card has been reset.
 
446
     *
 
447
     * @param   pInterface          Pointer to this interface.
 
448
     * @thread  The emulation thread.
 
449
     */
 
450
    DECLR3CALLBACKMEMBER(void, pfnReset,(PPDMIDISPLAYCONNECTOR pInterface));
 
451
 
 
452
    /**
 
453
     * LFB video mode enter/exit.
 
454
     *
 
455
     * Notification message when LinearFrameBuffer video mode is enabled/disabled.
 
456
     *
 
457
     * @param   pInterface          Pointer to this interface.
 
458
     * @param   fEnabled            false - LFB mode was disabled,
 
459
     *                              true -  an LFB mode was disabled
 
460
     * @thread  The emulation thread.
 
461
     */
 
462
    DECLR3CALLBACKMEMBER(void, pfnLFBModeChange, (PPDMIDISPLAYCONNECTOR pInterface, bool fEnabled));
 
463
 
 
464
    /**
 
465
     * Process the guest graphics adapter information.
 
466
     *
 
467
     * Direct notification from guest to the display connector.
 
468
     *
 
469
     * @param   pInterface          Pointer to this interface.
 
470
     * @param   pvVRAM              Address of the guest VRAM.
 
471
     * @param   u32VRAMSize         Size of the guest VRAM.
 
472
     * @thread  The emulation thread.
 
473
     */
 
474
    DECLR3CALLBACKMEMBER(void, pfnProcessAdapterData, (PPDMIDISPLAYCONNECTOR pInterface, void *pvVRAM, uint32_t u32VRAMSize));
 
475
 
 
476
    /**
 
477
     * Process the guest display information.
 
478
     *
 
479
     * Direct notification from guest to the display connector.
 
480
     *
 
481
     * @param   pInterface          Pointer to this interface.
 
482
     * @param   pvVRAM              Address of the guest VRAM.
 
483
     * @param   uScreenId           The index of the guest display to be processed.
 
484
     * @thread  The emulation thread.
 
485
     */
 
486
    DECLR3CALLBACKMEMBER(void, pfnProcessDisplayData, (PPDMIDISPLAYCONNECTOR pInterface, void *pvVRAM, unsigned uScreenId));
 
487
 
 
488
 
 
489
    /** Read-only attributes.
 
490
     * For preformance reasons some readonly attributes are kept in the interface.
 
491
     * We trust the interface users to respect the readonlyness of these.
 
492
     * @{
 
493
     */
 
494
    /** Pointer to the display data buffer. */
 
495
    uint8_t        *pu8Data;
 
496
    /** Size of a scanline in the data buffer. */
 
497
    uint32_t        cbScanline;
 
498
    /** The color depth (in bits) the graphics card is supposed to provide. */
 
499
    uint32_t        cBits;
 
500
    /** The display width. */
 
501
    uint32_t        cx;
 
502
    /** The display height. */
 
503
    uint32_t        cy;
 
504
    /** @} */
 
505
} PDMIDISPLAYCONNECTOR;
 
506
 
 
507
 
 
508
 
 
509
/**
 
510
 * Block drive type.
 
511
 */
 
512
typedef enum PDMBLOCKTYPE
 
513
{
 
514
    /** Error (for the query function). */
 
515
    PDMBLOCKTYPE_ERROR = 1,
 
516
    /** 360KB 5 1/4" floppy drive. */
 
517
    PDMBLOCKTYPE_FLOPPY_360,
 
518
    /** 720KB 3 1/2" floppy drive. */
 
519
    PDMBLOCKTYPE_FLOPPY_720,
 
520
    /** 1.2MB 5 1/4" floppy drive. */
 
521
    PDMBLOCKTYPE_FLOPPY_1_20,
 
522
    /** 1.44MB 3 1/2" floppy drive. */
 
523
    PDMBLOCKTYPE_FLOPPY_1_44,
 
524
    /** 2.88MB 3 1/2" floppy drive. */
 
525
    PDMBLOCKTYPE_FLOPPY_2_88,
 
526
    /** CDROM drive. */
 
527
    PDMBLOCKTYPE_CDROM,
 
528
    /** DVD drive. */
 
529
    PDMBLOCKTYPE_DVD,
 
530
    /** Hard disk drive. */
 
531
    PDMBLOCKTYPE_HARD_DISK
 
532
} PDMBLOCKTYPE;
 
533
 
 
534
 
 
535
/**
 
536
 * Block raw command data transfer direction.
 
537
 */
 
538
typedef enum PDMBLOCKTXDIR
 
539
{
 
540
    PDMBLOCKTXDIR_NONE = 0,
 
541
    PDMBLOCKTXDIR_FROM_DEVICE,
 
542
    PDMBLOCKTXDIR_TO_DEVICE
 
543
} PDMBLOCKTXDIR;
 
544
 
 
545
/**
 
546
 * Block notify interface.
 
547
 * Pair with PDMIBLOCK.
 
548
 */
 
549
typedef PDMIDUMMY PDMIBLOCKPORT;
 
550
/** Pointer to a block notify interface (dummy). */
 
551
typedef PDMIBLOCKPORT *PPDMIBLOCKPORT;
 
552
 
 
553
/** Pointer to a block interface. */
 
554
typedef struct PDMIBLOCK *PPDMIBLOCK;
 
555
/**
 
556
 * Block interface.
 
557
 * Pair with PDMIBLOCKPORT.
 
558
 */
 
559
typedef struct PDMIBLOCK
 
560
{
 
561
    /**
 
562
     * Read bits.
 
563
     *
 
564
     * @returns VBox status code.
 
565
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
566
     * @param   off             Offset to start reading from.
 
567
     * @param   pvBuf           Where to store the read bits.
 
568
     * @param   cbRead          Number of bytes to read.
 
569
     * @thread  Any thread.
 
570
     */
 
571
    DECLR3CALLBACKMEMBER(int, pfnRead,(PPDMIBLOCK pInterface, uint64_t off, void *pvBuf, size_t cbRead));
 
572
 
 
573
    /**
 
574
     * Write bits.
 
575
     *
 
576
     * @returns VBox status code.
 
577
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
578
     * @param   off             Offset to start writing at.
 
579
     * @param   pvBuf           Where to store the write bits.
 
580
     * @param   cbWrite         Number of bytes to write.
 
581
     * @thread  Any thread.
 
582
     */
 
583
    DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMIBLOCK pInterface, uint64_t off, const void *pvBuf, size_t cbWrite));
 
584
 
 
585
    /**
 
586
     * Make sure that the bits written are actually on the storage medium.
 
587
     *
 
588
     * @returns VBox status code.
 
589
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
590
     * @thread  Any thread.
 
591
     */
 
592
    DECLR3CALLBACKMEMBER(int, pfnFlush,(PPDMIBLOCK pInterface));
 
593
 
 
594
    /**
 
595
     * Send a raw command to the underlying device (CDROM).
 
596
     * This method is optional (i.e. the function pointer may be NULL).
 
597
     *
 
598
     * @returns VBox status code.
 
599
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
600
     * @param   pbCmd           Offset to start reading from.
 
601
     * @param   enmTxDir        Direction of transfer.
 
602
     * @param   pvBuf           Pointer tp the transfer buffer.
 
603
     * @param   cbBuf           Size of the transfer buffer.
 
604
     * @param   pbSenseKey      Status of the command (when return value is VERR_DEV_IO_ERROR).
 
605
     * @param   cTimeoutMillies Command timeout in milliseconds.
 
606
     * @thread  Any thread.
 
607
     */
 
608
    DECLR3CALLBACKMEMBER(int, pfnSendCmd,(PPDMIBLOCK pInterface, const uint8_t *pbCmd, PDMBLOCKTXDIR enmTxDir, void *pvBuf, size_t *pcbBuf, uint8_t *pbSenseKey, uint32_t cTimeoutMillies));
 
609
 
 
610
    /**
 
611
     * Check if the media is readonly or not.
 
612
     *
 
613
     * @returns true if readonly.
 
614
     * @returns false if read/write.
 
615
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
616
     * @thread  Any thread.
 
617
     */
 
618
    DECLR3CALLBACKMEMBER(bool, pfnIsReadOnly,(PPDMIBLOCK pInterface));
 
619
 
 
620
    /**
 
621
     * Gets the media size in bytes.
 
622
     *
 
623
     * @returns Media size in bytes.
 
624
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
625
     * @thread  Any thread.
 
626
     */
 
627
    DECLR3CALLBACKMEMBER(uint64_t, pfnGetSize,(PPDMIBLOCK pInterface));
 
628
 
 
629
    /**
 
630
     * Gets the block drive type.
 
631
     *
 
632
     * @returns block drive type.
 
633
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
634
     * @thread  Any thread.
 
635
     */
 
636
    DECLR3CALLBACKMEMBER(PDMBLOCKTYPE, pfnGetType,(PPDMIBLOCK pInterface));
 
637
 
 
638
    /**
 
639
     * Gets the UUID of the block drive.
 
640
     * Don't return the media UUID if it's removable.
 
641
     *
 
642
     * @returns VBox status code.
 
643
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
644
     * @param   pUuid           Where to store the UUID on success.
 
645
     * @thread  Any thread.
 
646
     */
 
647
    DECLR3CALLBACKMEMBER(int, pfnGetUuid,(PPDMIBLOCK pInterface, PRTUUID pUuid));
 
648
} PDMIBLOCK;
 
649
 
 
650
 
 
651
/** Pointer to a mount interface. */
 
652
typedef struct PDMIMOUNTNOTIFY *PPDMIMOUNTNOTIFY;
 
653
/**
 
654
 * Block interface.
 
655
 * Pair with PDMIMOUNT.
 
656
 */
 
657
typedef struct PDMIMOUNTNOTIFY
 
658
{
 
659
    /**
 
660
     * Called when a media is mounted.
 
661
     *
 
662
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
663
     * @thread  The emulation thread.
 
664
     */
 
665
    DECLR3CALLBACKMEMBER(void, pfnMountNotify,(PPDMIMOUNTNOTIFY pInterface));
 
666
 
 
667
    /**
 
668
     * Called when a media is unmounted
 
669
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
670
     * @thread  The emulation thread.
 
671
     */
 
672
    DECLR3CALLBACKMEMBER(void, pfnUnmountNotify,(PPDMIMOUNTNOTIFY pInterface));
 
673
} PDMIMOUNTNOTIFY;
 
674
 
 
675
 
 
676
/* Pointer to mount interface. */
 
677
typedef struct PDMIMOUNT *PPDMIMOUNT;
 
678
/**
 
679
 * Mount interface.
 
680
 * Pair with PDMIMOUNTNOTIFY.
 
681
 */
 
682
typedef struct PDMIMOUNT
 
683
{
 
684
    /**
 
685
     * Mount a media.
 
686
     *
 
687
     * This will not unmount any currently mounted media!
 
688
     *
 
689
     * @returns VBox status code.
 
690
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
691
     * @param   pszFilename     Pointer to filename. If this is NULL it assumed that the caller have
 
692
     *                          constructed a configuration which can be attached to the bottom driver.
 
693
     * @param   pszCoreDriver   Core driver name. NULL will cause autodetection. Ignored if pszFilanem is NULL.
 
694
     * @thread  The emulation thread.
 
695
     */
 
696
    DECLR3CALLBACKMEMBER(int, pfnMount,(PPDMIMOUNT pInterface, const char *pszFilename, const char *pszCoreDriver));
 
697
 
 
698
    /**
 
699
     * Unmount the media.
 
700
     *
 
701
     * The driver will validate and pass it on. On the rebounce it will decide whether or not to detach it self.
 
702
     *
 
703
     * @returns VBox status code.
 
704
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
705
     * @thread  The emulation thread.
 
706
     * @param   fForce          Force the unmount, even for locked media.
 
707
     * @thread  The emulation thread.
 
708
     */
 
709
    DECLR3CALLBACKMEMBER(int, pfnUnmount,(PPDMIMOUNT pInterface, bool fForce));
 
710
 
 
711
    /**
 
712
     * Checks if a media is mounted.
 
713
     *
 
714
     * @returns true if mounted.
 
715
     * @returns false if not mounted.
 
716
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
717
     * @thread  Any thread.
 
718
     */
 
719
    DECLR3CALLBACKMEMBER(bool, pfnIsMounted,(PPDMIMOUNT pInterface));
 
720
 
 
721
    /**
 
722
     * Locks the media, preventing any unmounting of it.
 
723
     *
 
724
     * @returns VBox status code.
 
725
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
726
     * @thread  The emulation thread.
 
727
     */
 
728
    DECLR3CALLBACKMEMBER(int, pfnLock,(PPDMIMOUNT pInterface));
 
729
 
 
730
    /**
 
731
     * Unlocks the media, canceling previous calls to pfnLock().
 
732
     *
 
733
     * @returns VBox status code.
 
734
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
735
     * @thread  The emulation thread.
 
736
     */
 
737
    DECLR3CALLBACKMEMBER(int, pfnUnlock,(PPDMIMOUNT pInterface));
 
738
 
 
739
    /**
 
740
     * Checks if a media is locked.
 
741
     *
 
742
     * @returns true if locked.
 
743
     * @returns false if not locked.
 
744
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
745
     * @thread  Any thread.
 
746
     */
 
747
    DECLR3CALLBACKMEMBER(bool, pfnIsLocked,(PPDMIMOUNT pInterface));
 
748
} PDMIBLOCKMOUNT;
 
749
 
 
750
/**
 
751
 * BIOS translation mode.
 
752
 */
 
753
typedef enum PDMBIOSTRANSLATION
 
754
{
 
755
    /** No translation. */
 
756
    PDMBIOSTRANSLATION_NONE = 1,
 
757
    /** LBA translation. */
 
758
    PDMBIOSTRANSLATION_LBA,
 
759
    /** Automatic select mode. */
 
760
    PDMBIOSTRANSLATION_AUTO
 
761
} PDMBIOSTRANSLATION;
 
762
 
 
763
/** Pointer to BIOS translation mode. */
 
764
typedef PDMBIOSTRANSLATION *PPDMBIOSTRANSLATION;
 
765
 
 
766
/** Pointer to a media interface. */
 
767
typedef struct PDMIMEDIA *PPDMIMEDIA;
 
768
/**
 
769
 * Media interface.
 
770
 * Makes up the fundation for PDMIBLOCK and PDMIBLOCKBIOS.
 
771
 */
 
772
typedef struct PDMIMEDIA
 
773
{
 
774
    /**
 
775
     * Read bits.
 
776
     *
 
777
     * @returns VBox status code.
 
778
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
779
     * @param   off             Offset to start reading from.
 
780
     * @param   pvBuf           Where to store the read bits.
 
781
     * @param   cbRead          Number of bytes to read.
 
782
     * @thread  Any thread.
 
783
     */
 
784
    DECLR3CALLBACKMEMBER(int, pfnRead,(PPDMIMEDIA pInterface, uint64_t off, void *pvBuf, size_t cbRead));
 
785
 
 
786
    /**
 
787
     * Write bits.
 
788
     *
 
789
     * @returns VBox status code.
 
790
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
791
     * @param   off             Offset to start writing at.
 
792
     * @param   pvBuf           Where to store the write bits.
 
793
     * @param   cbWrite         Number of bytes to write.
 
794
     * @thread  Any thread.
 
795
     */
 
796
    DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMIMEDIA pInterface, uint64_t off, const void *pvBuf, size_t cbWrite));
 
797
 
 
798
    /**
 
799
     * Make sure that the bits written are actually on the storage medium.
 
800
     *
 
801
     * @returns VBox status code.
 
802
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
803
     * @thread  Any thread.
 
804
     */
 
805
    DECLR3CALLBACKMEMBER(int, pfnFlush,(PPDMIMEDIA pInterface));
 
806
 
 
807
    /**
 
808
     * Get the media size in bytes.
 
809
     *
 
810
     * @returns Media size in bytes.
 
811
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
812
     * @thread  Any thread.
 
813
     */
 
814
    DECLR3CALLBACKMEMBER(uint64_t, pfnGetSize,(PPDMIMEDIA pInterface));
 
815
 
 
816
    /**
 
817
     * Check if the media is readonly or not.
 
818
     *
 
819
     * @returns true if readonly.
 
820
     * @returns false if read/write.
 
821
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
822
     * @thread  Any thread.
 
823
     */
 
824
    DECLR3CALLBACKMEMBER(bool, pfnIsReadOnly,(PPDMIMEDIA pInterface));
 
825
 
 
826
    /**
 
827
     * Get stored media geometry - BIOS property.
 
828
     * This is an optional feature of a media.
 
829
     *
 
830
     * @returns VBox status code.
 
831
     * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
 
832
     * @returns VERR_PDM_GEOMETRY_NOT_SET if the geometry hasn't been set using pfnBiosSetGeometry() yet.
 
833
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
834
     * @param   pcCylinders     Number of cylinders.
 
835
     * @param   pcHeads         Number of heads.
 
836
     * @param   pcSectors       Number of sectors. This number is 1-based.
 
837
     * @remark  This have no influence on the read/write operations.
 
838
     * @thread  Any thread.
 
839
     */
 
840
    DECLR3CALLBACKMEMBER(int, pfnBiosGetGeometry,(PPDMIMEDIA pInterface, uint32_t *pcCylinders, uint32_t *pcHeads, uint32_t *pcSectors));
 
841
 
 
842
    /**
 
843
     * Store the media geometry - BIOS property.
 
844
     * This is an optional feature of a media.
 
845
     *
 
846
     * @returns VBox status code.
 
847
     * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
 
848
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
849
     * @param   cCylinders      Number of cylinders.
 
850
     * @param   cHeads          Number of heads.
 
851
     * @param   cSectors        Number of sectors. This number is 1-based.
 
852
     * @remark  This have no influence on the read/write operations.
 
853
     * @thread  The emulation thread.
 
854
     */
 
855
    DECLR3CALLBACKMEMBER(int, pfnBiosSetGeometry,(PPDMIMEDIA pInterface, uint32_t cCylinders, uint32_t cHeads, uint32_t cSectors));
 
856
 
 
857
    /**
 
858
     * Get stored geometry translation mode - BIOS property.
 
859
     * This is an optional feature of a media.
 
860
     *
 
861
     * @returns VBox status code.
 
862
     * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry translation mode.
 
863
     * @returns VERR_PDM_TRANSLATION_NOT_SET if the translation hasn't been set using pfnBiosSetTranslation() yet.
 
864
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
865
     * @param   penmTranslation Where to store the translation type.
 
866
     * @remark  This have no influence on the read/write operations.
 
867
     * @thread  Any thread.
 
868
     */
 
869
    DECLR3CALLBACKMEMBER(int, pfnBiosGetTranslation,(PPDMIMEDIA pInterface, PPDMBIOSTRANSLATION penmTranslation));
 
870
 
 
871
    /**
 
872
     * Store media geometry - BIOS property.
 
873
     * This is an optional feature of a media.
 
874
     *
 
875
     * @returns VBox status code.
 
876
     * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
 
877
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
878
     * @param   enmTranslation  The translation type.
 
879
     * @remark  This have no influence on the read/write operations.
 
880
     * @thread  The emulation thread.
 
881
     */
 
882
    DECLR3CALLBACKMEMBER(int, pfnBiosSetTranslation,(PPDMIMEDIA pInterface, PDMBIOSTRANSLATION enmTranslation));
 
883
 
 
884
    /**
 
885
     * Gets the UUID of the media drive.
 
886
     *
 
887
     * @returns VBox status code.
 
888
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
889
     * @param   pUuid           Where to store the UUID on success.
 
890
     * @thread  Any thread.
 
891
     */
 
892
    DECLR3CALLBACKMEMBER(int, pfnGetUuid,(PPDMIMEDIA pInterface, PRTUUID pUuid));
 
893
 
 
894
} PDMIMEDIA;
 
895
 
 
896
 
 
897
/** Pointer to a block BIOS interface. */
 
898
typedef struct PDMIBLOCKBIOS *PPDMIBLOCKBIOS;
 
899
/**
 
900
 * Media BIOS interface.
 
901
 * The interface the getting and setting properties which the BIOS/CMOS care about.
 
902
 */
 
903
typedef struct PDMIBLOCKBIOS
 
904
{
 
905
    /**
 
906
     * Get stored media geometry - BIOS property.
 
907
     * This is an optional feature of a media.
 
908
     *
 
909
     * @returns VBox status code.
 
910
     * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
 
911
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
912
     * @param   pcCylinders     Number of cylinders.
 
913
     * @param   pcHeads         Number of heads.
 
914
     * @param   pcSectors       Number of sectors. This number is 1-based.
 
915
     * @remark  This have no influence on the read/write operations.
 
916
     * @thread  Any thread.
 
917
     */
 
918
    DECLR3CALLBACKMEMBER(int, pfnGetGeometry,(PPDMIBLOCKBIOS pInterface, uint32_t *pcCylinders, uint32_t *pcHeads, uint32_t *pcSectors));
 
919
 
 
920
    /**
 
921
     * Store the media geometry - BIOS property.
 
922
     * This is an optional feature of a media.
 
923
     *
 
924
     * @returns VBox status code.
 
925
     * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
 
926
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
927
     * @param   cCylinders      Number of cylinders.
 
928
     * @param   cHeads          Number of heads.
 
929
     * @param   cSectors        Number of sectors. This number is 1-based.
 
930
     * @remark  This have no influence on the read/write operations.
 
931
     * @thread  The emulation thread.
 
932
     */
 
933
    DECLR3CALLBACKMEMBER(int, pfnSetGeometry,(PPDMIBLOCKBIOS pInterface, uint32_t cCylinders, uint32_t cHeads, uint32_t cSectors));
 
934
 
 
935
    /**
 
936
     * Get stored geometry translation mode - BIOS property.
 
937
     * This is an optional feature of a media.
 
938
     *
 
939
     * @returns VBox status code.
 
940
     * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry translation mode.
 
941
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
942
     * @param   penmTranslation Where to store the translation type.
 
943
     * @remark  This have no influence on the read/write operations.
 
944
     * @thread  Any thread.
 
945
     */
 
946
    DECLR3CALLBACKMEMBER(int, pfnGetTranslation,(PPDMIBLOCKBIOS pInterface, PPDMBIOSTRANSLATION penmTranslation));
 
947
 
 
948
    /**
 
949
     * Store media geometry - BIOS property.
 
950
     * This is an optional feature of a media.
 
951
     *
 
952
     * @returns VBox status code.
 
953
     * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
 
954
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
955
     * @param   enmTranslation  The translation type.
 
956
     * @remark  This have no influence on the read/write operations.
 
957
     * @thread  The emulation thread.
 
958
     */
 
959
    DECLR3CALLBACKMEMBER(int, pfnSetTranslation,(PPDMIBLOCKBIOS pInterface, PDMBIOSTRANSLATION enmTranslation));
 
960
 
 
961
    /**
 
962
     * Checks if the device should be visible to the BIOS or not.
 
963
     *
 
964
     * @returns true if the device is visible to the BIOS.
 
965
     * @returns false if the device is not visible to the BIOS.
 
966
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
967
     * @thread  Any thread.
 
968
     */
 
969
    DECLR3CALLBACKMEMBER(bool, pfnIsVisible,(PPDMIBLOCKBIOS pInterface));
 
970
 
 
971
    /**
 
972
     * Gets the block drive type.
 
973
     *
 
974
     * @returns block drive type.
 
975
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
976
     * @thread  Any thread.
 
977
     */
 
978
    DECLR3CALLBACKMEMBER(PDMBLOCKTYPE, pfnGetType,(PPDMIBLOCKBIOS pInterface));
 
979
 
 
980
} PDMIBLOCKBIOS;
 
981
 
 
982
 
 
983
/** Pointer to a static block core driver interface. */
 
984
typedef struct PDMIMEDIASTATIC *PPDMIMEDIASTATIC;
 
985
/**
 
986
 * Static block core driver interface.
 
987
 */
 
988
typedef struct PDMIMEDIASTATIC
 
989
{
 
990
    /**
 
991
     * Check if the specified file is a format which the core driver can handle.
 
992
     *
 
993
     * @returns true / false accordingly.
 
994
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
995
     * @param   pszFilename     Name of the file to probe.
 
996
     */
 
997
    DECLR3CALLBACKMEMBER(bool, pfnCanHandle,(PPDMIMEDIASTATIC pInterface, const char *pszFilename));
 
998
} PDMIMEDIASTATIC;
 
999
 
 
1000
 
 
1001
/** Pointer to an iSCSI Request PDU buffer. */
 
1002
typedef struct ISCSIREQ *PISCSIREQ;
 
1003
/**
 
1004
 * iSCSI Request PDU buffer (gather).
 
1005
 */
 
1006
typedef struct ISCSIREQ
 
1007
{
 
1008
    /** Length of PDU segment in bytes. */
 
1009
    size_t cbSeg;
 
1010
    /** Pointer to PDU segment. */
 
1011
    const void *pcvSeg;
 
1012
} ISCSIREQ;
 
1013
 
 
1014
/** Pointer to an iSCSI Response PDU buffer. */
 
1015
typedef struct ISCSIRES *PISCSIRES;
 
1016
/**
 
1017
 * iSCSI Response PDU buffer (scatter).
 
1018
 */
 
1019
typedef struct ISCSIRES
 
1020
{
 
1021
    /** Length of PDU segment. */
 
1022
    size_t cbSeg;
 
1023
    /** Pointer to PDU segment. */
 
1024
    void *pvSeg;
 
1025
} ISCSIRES;
 
1026
 
 
1027
/** Pointer to an iSCSI transport driver interface. */
 
1028
typedef struct PDMIISCSITRANSPORT *PPDMIISCSITRANSPORT;
 
1029
/**
 
1030
 * iSCSI transport driver interface.
 
1031
 */
 
1032
typedef struct PDMIISCSITRANSPORT
 
1033
{
 
1034
    /**
 
1035
     * Read bytes from an iSCSI transport stream. If the connection fails, it is automatically
 
1036
     * reopened on the next call after the error is signalled. Error recovery in this case is
 
1037
     * the duty of the caller.
 
1038
     *
 
1039
     * @returns VBox status code.
 
1040
     * @param   pTransport      Pointer to the interface structure containing the called function pointer.
 
1041
     * @param   pvBuf           Where to store the read bits.
 
1042
     * @param   cbBuf           Number of bytes to read.
 
1043
     * @param   pcbRead         Actual number of bytes read.
 
1044
     * @thread  Any thread.
 
1045
     * @todo    Correct the docs.
 
1046
     */
 
1047
    DECLR3CALLBACKMEMBER(int, pfnRead,(PPDMIISCSITRANSPORT pTransport, PISCSIRES prgResponse, unsigned int cnResponse));
 
1048
 
 
1049
    /**
 
1050
     * Write bytes to an iSCSI transport stream. Padding is performed when necessary. If the connection
 
1051
     * fails, it is automatically reopened on the next call after the error is signalled. Error recovery
 
1052
     * in this case is the duty of the caller.
 
1053
     *
 
1054
     * @returns VBox status code.
 
1055
     * @param   pTransport      Pointer to the interface structure containing the called function pointer.
 
1056
     * @param   pvBuf           Where the write bits are stored.
 
1057
     * @param   cbWrite         Number of bytes to write.
 
1058
     * @thread  Any thread.
 
1059
     * @todo    Correct the docs.
 
1060
     */
 
1061
    DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMIISCSITRANSPORT pTransport, PISCSIREQ prgRequest, unsigned int cnRequest));
 
1062
 
 
1063
    /**
 
1064
     * Open the iSCSI transport stream.
 
1065
     *
 
1066
     * @returns VBox status code.
 
1067
     * @param   pTransport       Pointer to the interface structure containing the called function pointer.
 
1068
     * @param   pszTargetAddress Pointer to string of the format address:port.
 
1069
     * @thread  Any thread.
 
1070
     */
 
1071
    DECLR3CALLBACKMEMBER(int, pfnOpen,(PPDMIISCSITRANSPORT pTransport, const char *pszTargetAddress));
 
1072
 
 
1073
    /**
 
1074
     * Close the iSCSI transport stream.
 
1075
     *
 
1076
     * @returns VBox status code.
 
1077
     * @param   pTransport      Pointer to the interface structure containing the called function pointer.
 
1078
     * @thread  Any thread.
 
1079
     */
 
1080
    DECLR3CALLBACKMEMBER(int, pfnClose,(PPDMIISCSITRANSPORT pTransport));
 
1081
} PDMIISCSITRANSPORT;
 
1082
 
 
1083
 
 
1084
/** Pointer to a char port interface. */
 
1085
typedef struct PDMICHARPORT *PPDMICHARPORT;
 
1086
/**
 
1087
 * Char port interface.
 
1088
 * Pair with PDMICHAR.
 
1089
 */
 
1090
typedef struct PDMICHARPORT
 
1091
{
 
1092
    /**
 
1093
     * Deliver data read to the device/driver.
 
1094
     *
 
1095
     * @returns VBox status code.
 
1096
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
1097
     * @param   pvBuf           Where the read bits are stored.
 
1098
     * @param   pcbRead         Number of bytes available for reading/having been read.
 
1099
     * @thread  Any thread.
 
1100
     */
 
1101
    DECLR3CALLBACKMEMBER(int, pfnNotifyRead,(PPDMICHARPORT pInterface, const void *pvBuf, size_t *pcbRead));
 
1102
} PDMICHARPORT;
 
1103
 
 
1104
/** Pointer to a char interface. */
 
1105
typedef struct PDMICHAR *PPDMICHAR;
 
1106
/**
 
1107
 * Char interface.
 
1108
 * Pair with PDMICHARPORT.
 
1109
 */
 
1110
typedef struct PDMICHAR
 
1111
{
 
1112
    /**
 
1113
     * Write bits.
 
1114
     *
 
1115
     * @returns VBox status code.
 
1116
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
1117
     * @param   pvBuf           Where to store the write bits.
 
1118
     * @param   cbWrite         Number of bytes to write.
 
1119
     * @thread  Any thread.
 
1120
     */
 
1121
    DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMICHAR pInterface, const void *pvBuf, size_t cbWrite));
 
1122
 
 
1123
    /**
 
1124
     * Set device parameters.
 
1125
     *
 
1126
     * @returns VBox status code.
 
1127
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
1128
     * @param   Bps             Speed of the serial connection. (bits per second)
 
1129
     * @param   chParity        Parity method: 'E' - even, 'O' - odd, 'N' - none.
 
1130
     * @param   cDataBits       Number of data bits.
 
1131
     * @param   cStopBits       Number of stop bits.
 
1132
     * @thread  Any thread.
 
1133
     */
 
1134
    DECLR3CALLBACKMEMBER(int, pfnSetParameters,(PPDMICHAR pInterface, unsigned Bps, char chParity, unsigned cDataBits, unsigned cStopBits));
 
1135
 
 
1136
} PDMICHAR;
 
1137
 
 
1138
 
 
1139
/** Pointer to a stream interface. */
 
1140
typedef struct PDMISTREAM *PPDMISTREAM;
 
1141
/**
 
1142
 * Stream interface.
 
1143
 * Makes up the fundation for PDMICHAR.
 
1144
 */
 
1145
typedef struct PDMISTREAM
 
1146
{
 
1147
    /**
 
1148
     * Read bits.
 
1149
     *
 
1150
     * @returns VBox status code.
 
1151
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
1152
     * @param   pvBuf           Where to store the read bits.
 
1153
     * @param   cbRead          Number of bytes to read/bytes actually read.
 
1154
     * @thread  Any thread.
 
1155
     */
 
1156
    DECLR3CALLBACKMEMBER(int, pfnRead,(PPDMISTREAM pInterface, void *pvBuf, size_t *cbRead));
 
1157
 
 
1158
    /**
 
1159
     * Write bits.
 
1160
     *
 
1161
     * @returns VBox status code.
 
1162
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
1163
     * @param   pvBuf           Where to store the write bits.
 
1164
     * @param   cbWrite         Number of bytes to write/bytes actually written.
 
1165
     * @thread  Any thread.
 
1166
     */
 
1167
    DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMISTREAM pInterface, const void *pvBuf, size_t *cbWrite));
 
1168
} PDMISTREAM;
 
1169
 
 
1170
 
 
1171
/** Pointer to a host device port interface. */
 
1172
typedef struct PDMIHOSTDEVICEPORT *PPDMIHOSTDEVICEPORT;
 
1173
 
 
1174
/**
 
1175
 * Char port interface.
 
1176
 * Pair with PDMIHOSTDEVICECONNECTOR.
 
1177
 */
 
1178
typedef struct PDMIHOSTDEVICEPORT
 
1179
{
 
1180
    /**
 
1181
     * Deliver data read to the device/driver.
 
1182
     *
 
1183
     * @returns VBox status code.
 
1184
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
1185
     * @param   pvBuf           Where the read bits are stored.
 
1186
     * @param   pcbRead         Number of bytes available for reading/having been read.
 
1187
     * @thread  Any thread.
 
1188
     */
 
1189
    DECLR3CALLBACKMEMBER(int, pfnNotifyRead,(PPDMIHOSTDEVICEPORT pInterface, const void *pvBuf, size_t *pcbRead));
 
1190
} PDMIHOSTDEVICEPORT;
 
1191
 
 
1192
/** Pointer to a Host Device connector interface. */
 
1193
typedef struct PDMIHOSTDEVICECONNECTOR *PPDMIHOSTDEVICECONNECTOR;
 
1194
 
 
1195
/**
 
1196
 * Host device connector interface
 
1197
 * Pair with PDMIHOSTDEVICEPORT.
 
1198
 */
 
1199
typedef struct PDMIHOSTDEVICECONNECTOR
 
1200
{
 
1201
    /**
 
1202
     * Write bits.
 
1203
     *
 
1204
     * @returns VBox status code.
 
1205
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
1206
     * @param   pvBuf           Where to store the write bits.
 
1207
     * @param   pcbWrite        Number of bytes to write/bytes actually written.
 
1208
     * @thread  Any thread.
 
1209
     */
 
1210
    DECLR3CALLBACKMEMBER(int, pfnWrite,(PPDMIHOSTDEVICECONNECTOR pInterface, const void *pvBuf, size_t *pcbWrite));
 
1211
 
 
1212
    /**
 
1213
     * Read bits.
 
1214
     *
 
1215
     * @returns VBox status code.
 
1216
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
1217
     * @param   pvBuf           Where to store the read bits.
 
1218
     * @param   pcbRead         Number of bytes to read/bytes actually read.
 
1219
     * @thread  Any thread.
 
1220
     */
 
1221
    DECLR3CALLBACKMEMBER(int, pfnRead,(PPDMIHOSTDEVICECONNECTOR pInterface, void *pvBuf, size_t *pcbRead));
 
1222
 
 
1223
    /**
 
1224
     * Perform IO control on the host device.
 
1225
     *
 
1226
     * @returns VBox status code.
 
1227
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
1228
     * @param   uCommand        The number of the command to set or get data
 
1229
     * @param   pvData          Where to store the command data.
 
1230
     * @thread  Any thread.
 
1231
     */
 
1232
    DECLR3CALLBACKMEMBER(int, pfnIOCtl,(PPDMIHOSTDEVICECONNECTOR pInterface, RTUINT uCommand, void *pvData));
 
1233
} PDMIHOSTDEVICECONNECTOR;
 
1234
 
 
1235
 
 
1236
/** ACPI power source identifier */
 
1237
typedef enum PDMACPIPOWERSOURCE
 
1238
{
 
1239
    PDM_ACPI_POWER_SOURCE_UNKNOWN  =   0,
 
1240
    PDM_ACPI_POWER_SOURCE_OUTLET,
 
1241
    PDM_ACPI_POWER_SOURCE_BATTERY
 
1242
} PDMACPIPOWERSOURCE;
 
1243
/** Pointer to ACPI battery state. */
 
1244
typedef PDMACPIPOWERSOURCE *PPDMACPIPOWERSOURCE;
 
1245
 
 
1246
/** ACPI battey capacity */
 
1247
typedef enum PDMACPIBATCAPACITY
 
1248
{
 
1249
    PDM_ACPI_BAT_CAPACITY_MIN      =   0,
 
1250
    PDM_ACPI_BAT_CAPACITY_MAX      = 100,
 
1251
    PDM_ACPI_BAT_CAPACITY_UNKNOWN  = 255
 
1252
} PDMACPIBATCAPACITY;
 
1253
/** Pointer to ACPI battery capacity. */
 
1254
typedef PDMACPIBATCAPACITY *PPDMACPIBATCAPACITY;
 
1255
 
 
1256
/** ACPI battery state. See ACPI 3.0 spec '_BST (Battery Status)' */
 
1257
typedef enum PDMACPIBATSTATE
 
1258
{
 
1259
    PDM_ACPI_BAT_STATE_CHARGED     = 0x00,
 
1260
    PDM_ACPI_BAT_STATE_CHARGING    = 0x01,
 
1261
    PDM_ACPI_BAT_STATE_DISCHARGING = 0x02,
 
1262
    PDM_ACPI_BAT_STATE_CRITICAL    = 0x04
 
1263
} PDMACPIBATSTATE;
 
1264
/** Pointer to ACPI battery state. */
 
1265
typedef PDMACPIBATSTATE *PPDMACPIBATSTATE;
 
1266
 
 
1267
/** Pointer to an ACPI port interface. */
 
1268
typedef struct PDMIACPIPORT *PPDMIACPIPORT;
 
1269
/**
 
1270
 * ACPI port interface.
 
1271
 */
 
1272
typedef struct PDMIACPIPORT
 
1273
{
 
1274
    /**
 
1275
     * Send an ACPI power off event.
 
1276
     *
 
1277
     * @returns VBox status code
 
1278
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
1279
     */
 
1280
    DECLR3CALLBACKMEMBER(int, pfnPowerButtonPress,(PPDMIACPIPORT pInterface));
 
1281
} PDMIACPIPORT;
 
1282
 
 
1283
/** Pointer to an ACPI connector interface. */
 
1284
typedef struct PDMIACPICONNECTOR *PPDMIACPICONNECTOR;
 
1285
/**
 
1286
 * ACPI connector interface.
 
1287
 */
 
1288
typedef struct PDMIACPICONNECTOR
 
1289
{
 
1290
    /**
 
1291
     * Get the current power source of the host system.
 
1292
     *
 
1293
     * @returns VBox status code
 
1294
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
1295
     * @param   penmPowerSource Pointer to the power source result variable.
 
1296
     */
 
1297
    DECLR3CALLBACKMEMBER(int, pfnQueryPowerSource,(PPDMIACPICONNECTOR, PPDMACPIPOWERSOURCE penmPowerSource));
 
1298
 
 
1299
    /**
 
1300
     * Query the current battery status of the host system.
 
1301
     *
 
1302
     * @returns VBox status code?
 
1303
     * @param   pInterface              Pointer to the interface structure containing the called function pointer.
 
1304
     * @param   pfPresent               Is set to true if battery is present, false otherwise.
 
1305
     * @param   penmRemainingCapacity   Pointer to the battery remaining capacity (0 - 100 or 255 for unknown).
 
1306
     * @param   penmBatteryState        Pointer to the battery status.
 
1307
     * @param   pu32PresentRate         Pointer to the present rate (0..1000 of the total capacity).
 
1308
     */
 
1309
    DECLR3CALLBACKMEMBER(int, pfnQueryBatteryStatus,(PPDMIACPICONNECTOR, bool *pfPresent, PPDMACPIBATCAPACITY penmRemainingCapacity,
 
1310
                                                     PPDMACPIBATSTATE penmBatteryState, uint32_t *pu32PresentRate));
 
1311
} PDMIACPICONNECTOR;
 
1312
 
 
1313
 
 
1314
/** Pointer to a VMMDevice port interface. */
 
1315
typedef struct PDMIVMMDEVPORT *PPDMIVMMDEVPORT;
 
1316
/**
 
1317
 * VMMDevice port interface.
 
1318
 */
 
1319
typedef struct PDMIVMMDEVPORT
 
1320
{
 
1321
    /**
 
1322
     * Return the current absolute mouse position in pixels
 
1323
     *
 
1324
     * @returns VBox status code
 
1325
     * @param   pAbsX   Pointer of result value, can be NULL
 
1326
     * @param   pAbsY   Pointer of result value, can be NULL
 
1327
     */
 
1328
    DECLR3CALLBACKMEMBER(int, pfnQueryAbsoluteMouse,(PPDMIVMMDEVPORT pInterface, uint32_t *pAbsX, uint32_t *pAbsY));
 
1329
 
 
1330
    /**
 
1331
     * Set the new absolute mouse position in pixels
 
1332
     *
 
1333
     * @returns VBox status code
 
1334
     * @param   absX   New absolute X position
 
1335
     * @param   absY   New absolute Y position
 
1336
     */
 
1337
    DECLR3CALLBACKMEMBER(int, pfnSetAbsoluteMouse,(PPDMIVMMDEVPORT pInterface, uint32_t absX, uint32_t absY));
 
1338
 
 
1339
    /**
 
1340
     * Return the current mouse capability flags
 
1341
     *
 
1342
     * @returns VBox status code
 
1343
     * @param   pCapabilities  Pointer of result value
 
1344
     */
 
1345
    DECLR3CALLBACKMEMBER(int, pfnQueryMouseCapabilities,(PPDMIVMMDEVPORT pInterface, uint32_t *pCapabilities));
 
1346
 
 
1347
    /**
 
1348
     * Set the current mouse capability flag (host side)
 
1349
     *
 
1350
     * @returns VBox status code
 
1351
     * @param   capabilities  Capability mask
 
1352
     */
 
1353
    DECLR3CALLBACKMEMBER(int, pfnSetMouseCapabilities,(PPDMIVMMDEVPORT pInterface, uint32_t capabilities));
 
1354
 
 
1355
    /**
 
1356
     * Issue a display resolution change request.
 
1357
     *
 
1358
     * Note that there can only one request in the queue and that in case the guest does
 
1359
     * not process it, issuing another request will overwrite the previous.
 
1360
     *
 
1361
     * @returns VBox status code
 
1362
     * @param   cx          Horizontal pixel resolution (0 = do not change).
 
1363
     * @param   cy          Vertical pixel resolution (0 = do not change).
 
1364
     * @param   cBits       Bits per pixel (0 = do not change).
 
1365
     * @param   display     The display index.
 
1366
     */
 
1367
    DECLR3CALLBACKMEMBER(int, pfnRequestDisplayChange,(PPDMIVMMDEVPORT pInterface, uint32_t cx, uint32_t cy, uint32_t cBits, uint32_t display));
 
1368
 
 
1369
    /**
 
1370
     * Pass credentials to guest.
 
1371
     *
 
1372
     * Note that there can only be one set of credentials and the guest may or may not
 
1373
     * query them and may do whatever it wants with them.
 
1374
     *
 
1375
     * @returns VBox status code
 
1376
     * @param   pszUsername            User name, may be empty (UTF-8)
 
1377
     * @param   pszPassword            Password, may be empty (UTF-8)
 
1378
     * @param   pszDomain              Domain name, may be empty (UTF-8)
 
1379
     * @param   fFlags                 Bitflags
 
1380
     */
 
1381
    DECLR3CALLBACKMEMBER(int, pfnSetCredentials,(PPDMIVMMDEVPORT pInterface, const char *pszUsername,
 
1382
                                                 const char *pszPassword, const char *pszDomain,
 
1383
                                                 uint32_t fFlags));
 
1384
 
 
1385
    /**
 
1386
     * Notify the driver about a VBVA status change.
 
1387
     *
 
1388
     * @returns Nothing. Because it is informational callback.
 
1389
     * @param   fEnabled    Current VBVA status.
 
1390
     */
 
1391
    DECLR3CALLBACKMEMBER(void, pfnVBVAChange, (PPDMIVMMDEVPORT pInterface, bool fEnabled));
 
1392
 
 
1393
    /**
 
1394
     * Issue a seamless mode change request.
 
1395
     *
 
1396
     * Note that there can only one request in the queue and that in case the guest does
 
1397
     * not process it, issuing another request will overwrite the previous.
 
1398
     *
 
1399
     * @returns VBox status code
 
1400
     * @param   fEnabled       Seamless mode enabled or not
 
1401
     */
 
1402
    DECLR3CALLBACKMEMBER(int, pfnRequestSeamlessChange,(PPDMIVMMDEVPORT pInterface, bool fEnabled));
 
1403
 
 
1404
} PDMIVMMDEVPORT;
 
1405
 
 
1406
/** Forward declaration of the video accelerator command memory. */
 
1407
struct _VBVAMEMORY;
 
1408
/** Forward declaration of the guest information structure. */
 
1409
struct VBoxGuestInfo;
 
1410
/** Pointer to video accelerator command memory. */
 
1411
typedef struct _VBVAMEMORY *PVBVAMEMORY;
 
1412
 
 
1413
/** Pointer to a VMMDev connector interface. */
 
1414
typedef struct PDMIVMMDEVCONNECTOR *PPDMIVMMDEVCONNECTOR;
 
1415
/**
 
1416
 * VMMDev connector interface.
 
1417
 * Pair with PDMIVMMDEVPORT.
 
1418
 */
 
1419
typedef struct PDMIVMMDEVCONNECTOR
 
1420
{
 
1421
    /**
 
1422
     * Report guest OS version.
 
1423
     * Called whenever the Additions issue a guest version report request.
 
1424
     *
 
1425
     * @param   pInterface          Pointer to this interface.
 
1426
     * @param   pGuestInfo          Pointer to guest information structure
 
1427
     * @thread  The emulation thread.
 
1428
     */
 
1429
    DECLR3CALLBACKMEMBER(void, pfnUpdateGuestVersion,(PPDMIVMMDEVCONNECTOR pInterface, struct VBoxGuestInfo *pGuestInfo));
 
1430
 
 
1431
    /**
 
1432
     * Update the guest additions capabilities.
 
1433
     * This is called when the guest additions capabilities change. The new capabilities
 
1434
     * are given and the connector should update its internal state.
 
1435
     *
 
1436
     * @param   pInterface          Pointer to this interface.
 
1437
     * @param   newCapabilities     New capabilities.
 
1438
     * @thread  The emulation thread.
 
1439
     */
 
1440
    DECLR3CALLBACKMEMBER(void, pfnUpdateGuestCapabilities,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t newCapabilities));
 
1441
 
 
1442
    /**
 
1443
     * Update the mouse capabilities.
 
1444
     * This is called when the mouse capabilities change. The new capabilities
 
1445
     * are given and the connector should update its internal state.
 
1446
     *
 
1447
     * @param   pInterface          Pointer to this interface.
 
1448
     * @param   newCapabilities     New capabilities.
 
1449
     * @thread  The emulation thread.
 
1450
     */
 
1451
    DECLR3CALLBACKMEMBER(void, pfnUpdateMouseCapabilities,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t newCapabilities));
 
1452
 
 
1453
    /**
 
1454
     * Update the pointer shape.
 
1455
     * This is called when the mouse pointer shape changes. The new shape
 
1456
     * is passed as a caller allocated buffer that will be freed after returning
 
1457
     *
 
1458
     * @param   pInterface          Pointer to this interface.
 
1459
     * @param   fVisible            Visibility indicator (if false, the other parameters are undefined).
 
1460
     * @param   fAlpha              Flag whether alpha channel is being passed.
 
1461
     * @param   xHot                Pointer hot spot x coordinate.
 
1462
     * @param   yHot                Pointer hot spot y coordinate.
 
1463
     * @param   x                   Pointer new x coordinate on screen.
 
1464
     * @param   y                   Pointer new y coordinate on screen.
 
1465
     * @param   cx                  Pointer width in pixels.
 
1466
     * @param   cy                  Pointer height in pixels.
 
1467
     * @param   cbScanline          Size of one scanline in bytes.
 
1468
     * @param   pvShape             New shape buffer.
 
1469
     * @thread  The emulation thread.
 
1470
     */
 
1471
    DECLR3CALLBACKMEMBER(void, pfnUpdatePointerShape,(PPDMIVMMDEVCONNECTOR pInterface, bool fVisible, bool fAlpha,
 
1472
                                                      uint32_t xHot, uint32_t yHot,
 
1473
                                                      uint32_t cx, uint32_t cy,
 
1474
                                                      void *pvShape));
 
1475
 
 
1476
    /**
 
1477
     * Enable or disable video acceleration on behalf of guest.
 
1478
     *
 
1479
     * @param   pInterface          Pointer to this interface.
 
1480
     * @param   fEnable             Whether to enable acceleration.
 
1481
     * @param   pVbvaMemory         Video accelerator memory.
 
1482
 
 
1483
     * @return  VBox rc. VINF_SUCCESS if VBVA was enabled.
 
1484
     * @thread  The emulation thread.
 
1485
     */
 
1486
    DECLR3CALLBACKMEMBER(int, pfnVideoAccelEnable,(PPDMIVMMDEVCONNECTOR pInterface, bool fEnable, PVBVAMEMORY pVbvaMemory));
 
1487
 
 
1488
    /**
 
1489
     * Force video queue processing.
 
1490
     *
 
1491
     * @param   pInterface          Pointer to this interface.
 
1492
     * @thread  The emulation thread.
 
1493
     */
 
1494
    DECLR3CALLBACKMEMBER(void, pfnVideoAccelFlush,(PPDMIVMMDEVCONNECTOR pInterface));
 
1495
 
 
1496
    /**
 
1497
     * Return whether the given video mode is supported/wanted by the host.
 
1498
     *
 
1499
     * @returns VBox status code
 
1500
     * @param   pInterface      Pointer to this interface.
 
1501
     * @param   cy              Video mode horizontal resolution in pixels.
 
1502
     * @param   cx              Video mode vertical resolution in pixels.
 
1503
     * @param   cBits           Video mode bits per pixel.
 
1504
     * @param   pfSupported     Where to put the indicator for whether this mode is supported. (output)
 
1505
     * @thread  The emulation thread.
 
1506
     */
 
1507
    DECLR3CALLBACKMEMBER(int, pfnVideoModeSupported,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t cx, uint32_t cy, uint32_t cBits, bool *pfSupported));
 
1508
 
 
1509
    /**
 
1510
     * Queries by how many pixels the height should be reduced when calculating video modes
 
1511
     *
 
1512
     * @returns VBox status code
 
1513
     * @param   pInterface          Pointer to this interface.
 
1514
     * @param   pcyReduction        Pointer to the result value.
 
1515
     * @thread  The emulation thread.
 
1516
     */
 
1517
    DECLR3CALLBACKMEMBER(int, pfnGetHeightReduction,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pcyReduction));
 
1518
 
 
1519
    /**
 
1520
     * Informs about a credentials judgement result from the guest.
 
1521
     *
 
1522
     * @returns VBox status code
 
1523
     * @param   pInterface          Pointer to this interface.
 
1524
     * @param   fFlags              Judgement result flags.
 
1525
     * @thread  The emulation thread.
 
1526
     */
 
1527
     DECLR3CALLBACKMEMBER(int, pfnSetCredentialsJudgementResult,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t fFlags));
 
1528
 
 
1529
    /**
 
1530
     * Set the visible region of the display
 
1531
     *
 
1532
     * @returns VBox status code.
 
1533
     * @param   pInterface          Pointer to this interface.
 
1534
     * @param   cRect               Number of rectangles in pRect
 
1535
     * @param   pRect               Rectangle array
 
1536
     * @thread  The emulation thread.
 
1537
     */
 
1538
    DECLR3CALLBACKMEMBER(int, pfnSetVisibleRegion,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t cRect, PRTRECT pRect));
 
1539
 
 
1540
    /**
 
1541
     * Query the visible region of the display
 
1542
     *
 
1543
     * @returns VBox status code.
 
1544
     * @param   pInterface          Pointer to this interface.
 
1545
     * @param   pcRect              Number of rectangles in pRect
 
1546
     * @param   pRect               Rectangle array (set to NULL to query the number of rectangles)
 
1547
     * @thread  The emulation thread.
 
1548
     */
 
1549
    DECLR3CALLBACKMEMBER(int, pfnQueryVisibleRegion,(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pcRect, PRTRECT pRect));
 
1550
 
 
1551
} PDMIVMMDEVCONNECTOR;
 
1552
 
 
1553
 
 
1554
/**
 
1555
 * MAC address.
 
1556
 * (The first 24 bits are the 'company id', where the first bit seems to have a special meaning if set.)
 
1557
 */
 
1558
typedef union PDMMAC
 
1559
{
 
1560
    /** 8-bit view. */
 
1561
    uint8_t     au8[6];
 
1562
    /** 16-bit view. */
 
1563
    uint16_t    au16[3];
 
1564
} PDMMAC;
 
1565
/** Pointer to a MAC address. */
 
1566
typedef PDMMAC *PPDMMAC;
 
1567
/** Pointer to a const MAC address. */
 
1568
typedef const PDMMAC *PCPDMMAC;
 
1569
 
 
1570
 
 
1571
/** Pointer to a network port interface */
 
1572
typedef struct PDMINETWORKPORT *PPDMINETWORKPORT;
 
1573
/**
 
1574
 * Network port interface.
 
1575
 */
 
1576
typedef struct PDMINETWORKPORT
 
1577
{
 
1578
    /**
 
1579
     * Check how much data the device/driver can receive data now.
 
1580
     * This must be called before the pfnRecieve() method is called.
 
1581
     *
 
1582
     * @returns Number of bytes the device can receive now.
 
1583
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
1584
     * @thread  EMT
 
1585
     */
 
1586
    DECLR3CALLBACKMEMBER(size_t, pfnCanReceive,(PPDMINETWORKPORT pInterface));
 
1587
 
 
1588
    /**
 
1589
     * Receive data from the network.
 
1590
     *
 
1591
     * @returns VBox status code.
 
1592
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
1593
     * @param   pvBuf           The available data.
 
1594
     * @param   cb              Number of bytes available in the buffer.
 
1595
     * @thread  EMT
 
1596
     */
 
1597
    DECLR3CALLBACKMEMBER(int, pfnReceive,(PPDMINETWORKPORT pInterface, const void *pvBuf, size_t cb));
 
1598
 
 
1599
} PDMINETWORKPORT;
 
1600
 
 
1601
 
 
1602
/**
 
1603
 * Network link state.
 
1604
 */
 
1605
typedef enum PDMNETWORKLINKSTATE
 
1606
{
 
1607
    /** Invalid state. */
 
1608
    PDMNETWORKLINKSTATE_INVALID = 0,
 
1609
    /** The link is up. */
 
1610
    PDMNETWORKLINKSTATE_UP,
 
1611
    /** The link is down. */
 
1612
    PDMNETWORKLINKSTATE_DOWN,
 
1613
    /** The link is temporarily down while resuming. */
 
1614
    PDMNETWORKLINKSTATE_DOWN_RESUME
 
1615
} PDMNETWORKLINKSTATE;
 
1616
 
 
1617
 
 
1618
/** Pointer to a network connector interface */
 
1619
typedef struct PDMINETWORKCONNECTOR *PPDMINETWORKCONNECTOR;
 
1620
/**
 
1621
 * Network connector interface.
 
1622
 */
 
1623
typedef struct PDMINETWORKCONNECTOR
 
1624
{
 
1625
    /**
 
1626
     * Send data to the network.
 
1627
     *
 
1628
     * @returns VBox status code.
 
1629
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
1630
     * @param   pvBuf           Data to send.
 
1631
     * @param   cb              Number of bytes to send.
 
1632
     * @thread  EMT
 
1633
     */
 
1634
    DECLR3CALLBACKMEMBER(int, pfnSend,(PPDMINETWORKCONNECTOR pInterface, const void *pvBuf, size_t cb));
 
1635
 
 
1636
    /**
 
1637
     * Set promiscuous mode.
 
1638
     *
 
1639
     * This is called when the promiscuous mode is set. This means that there doesn't have
 
1640
     * to be a mode change when it's called.
 
1641
     *
 
1642
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
1643
     * @param   fPromiscuous    Set if the adaptor is now in promiscuous mode. Clear if it is not.
 
1644
     * @thread  EMT
 
1645
     */
 
1646
    DECLR3CALLBACKMEMBER(void, pfnSetPromiscuousMode,(PPDMINETWORKCONNECTOR pInterface, bool fPromiscuous));
 
1647
 
 
1648
    /**
 
1649
     * Notification on link status changes.
 
1650
     *
 
1651
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
1652
     * @param   enmLinkState    The new link state.
 
1653
     * @thread  EMT
 
1654
     */
 
1655
    DECLR3CALLBACKMEMBER(void, pfnNotifyLinkChanged,(PPDMINETWORKCONNECTOR pInterface, PDMNETWORKLINKSTATE enmLinkState));
 
1656
 
 
1657
    /**
 
1658
     * More receive buffer has become available.
 
1659
     *
 
1660
     * This is called when the NIC frees up receive buffers.
 
1661
     *
 
1662
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
1663
     * @thread  EMT
 
1664
     */
 
1665
    DECLR3CALLBACKMEMBER(void, pfnNotifyCanReceive,(PPDMINETWORKCONNECTOR pInterface));
 
1666
 
 
1667
} PDMINETWORKCONNECTOR;
 
1668
 
 
1669
 
 
1670
/** Pointer to a network config port interface */
 
1671
typedef struct PDMINETWORKCONFIG *PPDMINETWORKCONFIG;
 
1672
/**
 
1673
 * Network config port interface.
 
1674
 */
 
1675
typedef struct PDMINETWORKCONFIG
 
1676
{
 
1677
    /**
 
1678
     * Gets the current Media Access Control (MAC) address.
 
1679
     *
 
1680
     * @returns VBox status code.
 
1681
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
1682
     * @param   pMac            Where to store the MAC address.
 
1683
     * @thread  EMT
 
1684
     */
 
1685
    DECLR3CALLBACKMEMBER(int, pfnGetMac,(PPDMINETWORKCONFIG pInterface, PPDMMAC *pMac));
 
1686
 
 
1687
    /**
 
1688
     * Gets the new link state.
 
1689
     *
 
1690
     * @returns The current link state.
 
1691
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
1692
     * @thread  EMT
 
1693
     */
 
1694
    DECLR3CALLBACKMEMBER(PDMNETWORKLINKSTATE, pfnGetLinkState,(PPDMINETWORKCONFIG pInterface));
 
1695
 
 
1696
    /**
 
1697
     * Sets the new link state.
 
1698
     *
 
1699
     * @returns VBox status code.
 
1700
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
1701
     * @param   enmState        The new link state
 
1702
     * @thread  EMT
 
1703
     */
 
1704
    DECLR3CALLBACKMEMBER(int, pfnSetLinkState,(PPDMINETWORKCONFIG pInterface, PDMNETWORKLINKSTATE enmState));
 
1705
 
 
1706
} PDMINETWORKCONFIG;
 
1707
 
 
1708
 
 
1709
/** Pointer to a network connector interface */
 
1710
typedef struct PDMIAUDIOCONNECTOR *PPDMIAUDIOCONNECTOR;
 
1711
/**
 
1712
 * Audio connector interface.
 
1713
 */
 
1714
typedef struct PDMIAUDIOCONNECTOR
 
1715
{
 
1716
    DECLR3CALLBACKMEMBER(void, pfnRun,(PPDMIAUDIOCONNECTOR pInterface));
 
1717
 
 
1718
/*    DECLR3CALLBACKMEMBER(int,  pfnSetRecordSource,(PPDMIAUDIOINCONNECTOR pInterface, AUDIORECSOURCE)); */
 
1719
 
 
1720
} PDMIAUDIOCONNECTOR;
 
1721
 
 
1722
 
 
1723
/** @todo r=bird: the two following interfaces are hacks to work around the missing audio driver
 
1724
 * interface. This should be addressed rather than making more temporary hacks. */
 
1725
 
 
1726
/** Pointer to a Audio Sniffer Device port interface. */
 
1727
typedef struct PDMIAUDIOSNIFFERPORT *PPDMIAUDIOSNIFFERPORT;
 
1728
 
 
1729
/**
 
1730
 * Audio Sniffer port interface.
 
1731
 */
 
1732
typedef struct PDMIAUDIOSNIFFERPORT
 
1733
{
 
1734
    /**
 
1735
     * Enables or disables sniffing. If sniffing is being enabled also sets a flag
 
1736
     * whether the audio must be also left on the host.
 
1737
     *
 
1738
     * @returns VBox status code
 
1739
     * @param pInterface      Pointer to this interface.
 
1740
     * @param fEnable         'true' for enable sniffing, 'false' to disable.
 
1741
     * @param fKeepHostAudio  Indicates whether host audio should also present
 
1742
     *                        'true' means that sound should not be played
 
1743
     *                        by the audio device.
 
1744
     */
 
1745
    DECLR3CALLBACKMEMBER(int, pfnSetup,(PPDMIAUDIOSNIFFERPORT pInterface, bool fEnable, bool fKeepHostAudio));
 
1746
 
 
1747
} PDMIAUDIOSNIFFERPORT;
 
1748
 
 
1749
/** Pointer to a Audio Sniffer connector interface. */
 
1750
typedef struct PDMIAUDIOSNIFFERCONNECTOR *PPDMIAUDIOSNIFFERCONNECTOR;
 
1751
 
 
1752
/**
 
1753
 * Audio Sniffer connector interface.
 
1754
 * Pair with PDMIAUDIOSNIFFERPORT.
 
1755
 */
 
1756
typedef struct PDMIAUDIOSNIFFERCONNECTOR
 
1757
{
 
1758
    /**
 
1759
     * AudioSniffer device calls this method when audio samples
 
1760
     * are about to be played and sniffing is enabled.
 
1761
     *
 
1762
     * @param   pInterface          Pointer to this interface.
 
1763
     * @param   pvSamples           Audio samples buffer.
 
1764
     * @param   cSamples            How many complete samples are in the buffer.
 
1765
     * @param   iSampleHz           The sample frequency in Hz.
 
1766
     * @param   cChannels           Number of channels. 1 for mono, 2 for stereo.
 
1767
     * @param   cBits               How many bits a sample for a single channel has. Normally 8 or 16.
 
1768
     * @param   fUnsigned           Whether samples are unsigned values.
 
1769
     * @thread  The emulation thread.
 
1770
     */
 
1771
    DECLR3CALLBACKMEMBER(void, pfnAudioSamplesOut,(PPDMIAUDIOSNIFFERCONNECTOR pInterface, void *pvSamples, uint32_t cSamples,
 
1772
                                                   int iSampleHz, int cChannels, int cBits, bool fUnsigned));
 
1773
 
 
1774
    /**
 
1775
     * AudioSniffer device calls this method when output volume is changed.
 
1776
     *
 
1777
     * @param   pInterface          Pointer to this interface.
 
1778
     * @param   u16LeftVolume       0..0xFFFF volume level for left channel.
 
1779
     * @param   u16RightVolume      0..0xFFFF volume level for right channel.
 
1780
     * @thread  The emulation thread.
 
1781
     */
 
1782
    DECLR3CALLBACKMEMBER(void, pfnAudioVolumeOut,(PPDMIAUDIOSNIFFERCONNECTOR pInterface, uint16_t u16LeftVolume, uint16_t u16RightVolume));
 
1783
 
 
1784
} PDMIAUDIOSNIFFERCONNECTOR;
 
1785
 
 
1786
 
 
1787
/**
 
1788
 * Generic status LED core.
 
1789
 * Note that a unit doesn't have to support all the indicators.
 
1790
 */
 
1791
typedef union PDMLEDCORE
 
1792
{
 
1793
    /** 32-bit view. */
 
1794
    uint32_t volatile u32;
 
1795
    /** Bit view. */
 
1796
    struct
 
1797
    {
 
1798
        /** Reading/Receiving indicator. */
 
1799
        uint32_t    fReading : 1;
 
1800
        /** Writing/Sending indicator. */
 
1801
        uint32_t    fWriting : 1;
 
1802
        /** Busy indicator. */
 
1803
        uint32_t    fBusy : 1;
 
1804
        /** Error indicator. */
 
1805
        uint32_t    fError : 1;
 
1806
    }           s;
 
1807
} PDMLEDCORE;
 
1808
 
 
1809
/** LED bit masks for the u32 view.
 
1810
 * @{ */
 
1811
/** Reading/Receiving indicator. */
 
1812
#define PDMLED_READING  BIT(0)
 
1813
/** Writing/Sending indicator. */
 
1814
#define PDMLED_WRITING  BIT(1)
 
1815
/** Busy indicator. */
 
1816
#define PDMLED_BUSY     BIT(2)
 
1817
/** Error indicator. */
 
1818
#define PDMLED_ERROR    BIT(3)
 
1819
/** @} */
 
1820
 
 
1821
 
 
1822
/**
 
1823
 * Generic status LED.
 
1824
 * Note that a unit doesn't have to support all the indicators.
 
1825
 */
 
1826
typedef struct PDMLED
 
1827
{
 
1828
    /** Just a magic for sanity checking. */
 
1829
    uint32_t    u32Magic;
 
1830
    uint32_t    u32Alignment;           /**< structure size alignment. */
 
1831
    /** The actual LED status.
 
1832
     * Only the device is allowed to change this. */
 
1833
    PDMLEDCORE  Actual;
 
1834
    /** The asserted LED status which is cleared by the reader.
 
1835
     * The device will assert the bits but never clear them.
 
1836
     * The driver clears them as it sees fit. */
 
1837
    PDMLEDCORE  Asserted;
 
1838
} PDMLED;
 
1839
 
 
1840
/** Pointer to an LED. */
 
1841
typedef PDMLED *PPDMLED;
 
1842
/** Pointer to a const LED. */
 
1843
typedef const PDMLED *PCPDMLED;
 
1844
 
 
1845
#define PDMLED_MAGIC ( 0x11335577 )
 
1846
 
 
1847
/** Pointer to an LED ports interface. */
 
1848
typedef struct PDMILEDPORTS      *PPDMILEDPORTS;
 
1849
/**
 
1850
 * Interface for exporting LEDs.
 
1851
 */
 
1852
typedef struct PDMILEDPORTS
 
1853
{
 
1854
    /**
 
1855
     * Gets the pointer to the status LED of a unit.
 
1856
     *
 
1857
     * @returns VBox status code.
 
1858
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
1859
     * @param   iLUN            The unit which status LED we desire.
 
1860
     * @param   ppLed           Where to store the LED pointer.
 
1861
     */
 
1862
    DECLR3CALLBACKMEMBER(int, pfnQueryStatusLed,(PPDMILEDPORTS pInterface, unsigned iLUN, PPDMLED *ppLed));
 
1863
 
 
1864
} PDMILEDPORTS;
 
1865
 
 
1866
 
 
1867
/** Pointer to an LED connectors interface. */
 
1868
typedef struct PDMILEDCONNECTORS *PPDMILEDCONNECTORS;
 
1869
/**
 
1870
 * Interface for reading LEDs.
 
1871
 */
 
1872
typedef struct PDMILEDCONNECTORS
 
1873
{
 
1874
    /**
 
1875
     * Notification about a unit which have been changed.
 
1876
     *
 
1877
     * The driver must discard any pointers to data owned by
 
1878
     * the unit and requery it.
 
1879
     *
 
1880
     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
 
1881
     * @param   iLUN            The unit number.
 
1882
     */
 
1883
    DECLR3CALLBACKMEMBER(void, pfnUnitChanged,(PPDMILEDCONNECTORS pInterface, unsigned iLUN));
 
1884
} PDMILEDCONNECTORS;
 
1885
 
 
1886
 
 
1887
/** The special status unit number */
 
1888
#define PDM_STATUS_LUN      999
 
1889
 
 
1890
 
 
1891
#ifdef VBOX_HGCM
 
1892
 
 
1893
/** Abstract HGCM command structure. Used only to define a typed pointer. */
 
1894
struct VBOXHGCMCMD;
 
1895
 
 
1896
/** Pointer to HGCM command structure. This pointer is unique and identifies
 
1897
 *  the command being processed. The pointer is passed to HGCM connector methods,
 
1898
 *  and must be passed back to HGCM port when command is completed.
 
1899
 */
 
1900
typedef struct VBOXHGCMCMD *PVBOXHGCMCMD;
 
1901
 
 
1902
/** Pointer to a HGCM port interface. */
 
1903
typedef struct PDMIHGCMPORT *PPDMIHGCMPORT;
 
1904
 
 
1905
/**
 
1906
 * HGCM port interface. Normally implemented by VMMDev.
 
1907
 */
 
1908
typedef struct PDMIHGCMPORT
 
1909
{
 
1910
    /**
 
1911
     * Notify the guest on a command completion.
 
1912
     *
 
1913
     * @param   pInterface          Pointer to this interface.
 
1914
     * @param   rc                  The return code (VBox error code).
 
1915
     * @param   pCmd                A pointer that identifies the completed command.
 
1916
     *
 
1917
     * @returns VBox status code
 
1918
     */
 
1919
    DECLR3CALLBACKMEMBER(void, pfnCompleted,(PPDMIHGCMPORT pInterface, int32_t rc, PVBOXHGCMCMD pCmd));
 
1920
 
 
1921
} PDMIHGCMPORT;
 
1922
 
 
1923
 
 
1924
/** Pointer to a HGCM connector interface. */
 
1925
typedef struct PDMIHGCMCONNECTOR *PPDMIHGCMCONNECTOR;
 
1926
 
 
1927
/** Pointer to a HGCM service location structure. */
 
1928
typedef struct HGCMSERVICELOCATION *PHGCMSERVICELOCATION;
 
1929
 
 
1930
/**
 
1931
 * HGCM connector interface.
 
1932
 * Pair with PDMIHGCMPORT.
 
1933
 */
 
1934
typedef struct PDMIHGCMCONNECTOR
 
1935
{
 
1936
    /**
 
1937
     * Locate a service and inform it about a client connection.
 
1938
     *
 
1939
     * @param   pInterface          Pointer to this interface.
 
1940
     * @param   pCmd                A pointer that identifies the command.
 
1941
     * @param   pServiceLocation    Pointer to the service location structure.
 
1942
     * @param   pu32ClientID        Where to store the client id for the connection.
 
1943
     * @return  VBox status code.
 
1944
     * @thread  The emulation thread.
 
1945
     */
 
1946
    DECLR3CALLBACKMEMBER(int, pfnConnect,(PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, PHGCMSERVICELOCATION pServiceLocation, uint32_t *pu32ClientID));
 
1947
 
 
1948
    /**
 
1949
     * Disconnect from service.
 
1950
     *
 
1951
     * @param   pInterface          Pointer to this interface.
 
1952
     * @param   pCmd                A pointer that identifies the command.
 
1953
     * @param   u32ClientID         The client id returned by the pfnConnect call.
 
1954
     * @return  VBox status code.
 
1955
     * @thread  The emulation thread.
 
1956
     */
 
1957
    DECLR3CALLBACKMEMBER(int, pfnDisconnect,(PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, uint32_t u32ClientID));
 
1958
 
 
1959
    /**
 
1960
     * Process a guest issued command.
 
1961
     *
 
1962
     * @param   pInterface          Pointer to this interface.
 
1963
     * @param   pCmd                A pointer that identifies the command.
 
1964
     * @param   u32ClientID         The client id returned by the pfnConnect call.
 
1965
     * @param   u32Function         Function to be performed by the service.
 
1966
     * @param   cParms              Number of parameters in the array pointed to by paParams.
 
1967
     * @param   paParms             Pointer to an array of parameters.
 
1968
     * @return  VBox status code.
 
1969
     * @thread  The emulation thread.
 
1970
     */
 
1971
    DECLR3CALLBACKMEMBER(int, pfnCall,(PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, uint32_t u32ClientID, uint32_t u32Function,
 
1972
                                       uint32_t cParms, PVBOXHGCMSVCPARM paParms));
 
1973
 
 
1974
} PDMIHGCMCONNECTOR;
 
1975
 
 
1976
#endif
 
1977
 
 
1978
/** @} */
 
1979
 
 
1980
__END_DECLS
 
1981
 
 
1982
#endif