VirtualBox

source: vbox/trunk/include/VBox/hgcmsvc.h@ 76463

Last change on this file since 76463 was 76387, checked in by vboxsync, 6 years ago

VBoxGuest does not need hgcmsvc.h (linux). bugref:9344

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 20.3 KB
Line 
1/** @file
2 * Host-Guest Communication Manager (HGCM) - Service library definitions.
3 */
4
5/*
6 * Copyright (C) 2006-2017 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_hgcm_h
27#define ___VBox_hgcm_h
28
29#include <iprt/assert.h>
30#include <iprt/stdarg.h>
31#include <iprt/string.h>
32#include <VBox/cdefs.h>
33#include <VBox/types.h>
34#include <iprt/err.h>
35#ifdef IN_RING3
36# include <VBox/vmm/stam.h>
37# include <VBox/vmm/dbgf.h>
38#endif
39#ifdef VBOX_TEST_HGCM_PARMS
40# include <iprt/test.h>
41#endif
42
43/** @todo proper comments. */
44
45/**
46 * Service interface version.
47 *
48 * Includes layout of both VBOXHGCMSVCFNTABLE and VBOXHGCMSVCHELPERS.
49 *
50 * A service can work with these structures if major version
51 * is equal and minor version of service is <= version of the
52 * structures.
53 *
54 * For example when a new helper is added at the end of helpers
55 * structure, then the minor version will be increased. All older
56 * services still can work because they have their old helpers
57 * unchanged.
58 *
59 * Revision history.
60 * 1.1->2.1 Because the pfnConnect now also has the pvClient parameter.
61 * 2.1->2.2 Because pfnSaveState and pfnLoadState were added
62 * 2.2->3.1 Because pfnHostCall is now synchronous, returns rc, and parameters were changed
63 * 3.1->3.2 Because pfnRegisterExtension was added
64 * 3.2->3.3 Because pfnDisconnectClient helper was added
65 * 3.3->4.1 Because the pvService entry and parameter was added
66 * 4.1->4.2 Because the VBOX_HGCM_SVC_PARM_CALLBACK parameter type was added
67 * 4.2->5.1 Removed the VBOX_HGCM_SVC_PARM_CALLBACK parameter type, as
68 * this problem is already solved by service extension callbacks
69 * 5.1->6.1 Because pfnCall got a new parameter. Also new helpers. (VBox 6.0)
70 * 6.1->6.2 Because pfnCallComplete starts returning a status code (VBox 6.0).
71 * 6.2->6.3 Because pfnGetRequestor was added (VBox 6.0).
72 * 6.3->6.4 Bacause pfnConnect got an additional parameter (VBox 6.0).
73 * 6.4->6.5 Bacause pfnGetVMMDevSessionId was added pfnLoadState got the version
74 * parameter (VBox 6.0).
75 * 6.5->7.1 Because pfnNotify was added (VBox 6.0).
76 * 7.1->8.1 Because pfnCancelled & pfnIsCallCancelled were added (VBox 6.0).
77 */
78#define VBOX_HGCM_SVC_VERSION_MAJOR (0x0008)
79#define VBOX_HGCM_SVC_VERSION_MINOR (0x0001)
80#define VBOX_HGCM_SVC_VERSION ((VBOX_HGCM_SVC_VERSION_MAJOR << 16) + VBOX_HGCM_SVC_VERSION_MINOR)
81
82
83/** Typed pointer to distinguish a call to service. */
84struct VBOXHGCMCALLHANDLE_TYPEDEF;
85typedef struct VBOXHGCMCALLHANDLE_TYPEDEF *VBOXHGCMCALLHANDLE;
86
87/** Service helpers pointers table. */
88typedef struct VBOXHGCMSVCHELPERS
89{
90 /** The service has processed the Call request. */
91 DECLR3CALLBACKMEMBER(int, pfnCallComplete, (VBOXHGCMCALLHANDLE callHandle, int32_t rc));
92
93 void *pvInstance;
94
95 /** The service disconnects the client. */
96 DECLR3CALLBACKMEMBER(void, pfnDisconnectClient, (void *pvInstance, uint32_t u32ClientID));
97
98 /**
99 * Check if the @a callHandle is for a call restored and re-submitted from saved state.
100 *
101 * @returns true if restored, false if not.
102 * @param callHandle The call we're checking up on.
103 */
104 DECLR3CALLBACKMEMBER(bool, pfnIsCallRestored, (VBOXHGCMCALLHANDLE callHandle));
105
106 /**
107 * Check if the @a callHandle is for a cancelled call.
108 *
109 * @returns true if cancelled, false if not.
110 * @param callHandle The call we're checking up on.
111 */
112 DECLR3CALLBACKMEMBER(bool, pfnIsCallCancelled, (VBOXHGCMCALLHANDLE callHandle));
113
114 /** Access to STAMR3RegisterV. */
115 DECLR3CALLBACKMEMBER(int, pfnStamRegisterV,(void *pvInstance, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility,
116 STAMUNIT enmUnit, const char *pszDesc, const char *pszName, va_list va)
117 RT_IPRT_FORMAT_ATTR(7, 0));
118 /** Access to STAMR3DeregisterV. */
119 DECLR3CALLBACKMEMBER(int, pfnStamDeregisterV,(void *pvInstance, const char *pszPatFmt, va_list va) RT_IPRT_FORMAT_ATTR(2, 0));
120
121 /** Access to DBGFR3InfoRegisterExternal. */
122 DECLR3CALLBACKMEMBER(int, pfnInfoRegister,(void *pvInstance, const char *pszName, const char *pszDesc,
123 PFNDBGFHANDLEREXT pfnHandler, void *pvUser));
124 /** Access to DBGFR3InfoDeregisterExternal. */
125 DECLR3CALLBACKMEMBER(int, pfnInfoDeregister,(void *pvInstance, const char *pszName));
126
127 /**
128 * Retrieves the VMMDevRequestHeader::fRequestor value.
129 *
130 * @returns The field value, VMMDEV_REQUESTOR_LEGACY if not supported by the
131 * guest, VMMDEV_REQUESTOR_LOWEST if invalid call.
132 * @param hCall The call we're checking up on.
133 */
134 DECLR3CALLBACKMEMBER(uint32_t, pfnGetRequestor, (VBOXHGCMCALLHANDLE hCall));
135
136 /**
137 * Retrieves VMMDevState::idSession.
138 *
139 * @returns current VMMDev session ID value.
140 */
141 DECLR3CALLBACKMEMBER(uint64_t, pfnGetVMMDevSessionId, (void *pvInstance));
142
143} VBOXHGCMSVCHELPERS;
144
145typedef VBOXHGCMSVCHELPERS *PVBOXHGCMSVCHELPERS;
146
147#if defined(IN_RING3) || defined(IN_SLICKEDIT)
148
149/** Wrapper around STAMR3RegisterF. */
150DECLINLINE(int) RT_IPRT_FORMAT_ATTR(7, 8)
151HGCMSvcHlpStamRegister(PVBOXHGCMSVCHELPERS pHlp, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility,
152 STAMUNIT enmUnit, const char *pszDesc, const char *pszName, ...)
153{
154 int rc;
155 va_list va;
156 va_start(va, pszName);
157 rc = pHlp->pfnStamRegisterV(pHlp->pvInstance, pvSample, enmType, enmVisibility, enmUnit, pszDesc, pszName, va);
158 va_end(va);
159 return rc;
160}
161
162/** Wrapper around STAMR3RegisterV. */
163DECLINLINE(int) RT_IPRT_FORMAT_ATTR(7, 0)
164HGCMSvcHlpStamRegisterV(PVBOXHGCMSVCHELPERS pHlp, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility,
165 STAMUNIT enmUnit, const char *pszDesc, const char *pszName, va_list va)
166{
167 return pHlp->pfnStamRegisterV(pHlp->pvInstance, pvSample, enmType, enmVisibility, enmUnit, pszDesc, pszName, va);
168}
169
170/** Wrapper around STAMR3DeregisterF. */
171DECLINLINE(int) RT_IPRT_FORMAT_ATTR(2, 3) HGCMSvcHlpStamDeregister(PVBOXHGCMSVCHELPERS pHlp, const char *pszPatFmt, ...)
172{
173 int rc;
174 va_list va;
175 va_start(va, pszPatFmt);
176 rc = pHlp->pfnStamDeregisterV(pHlp->pvInstance, pszPatFmt, va);
177 va_end(va);
178 return rc;
179}
180
181/** Wrapper around STAMR3DeregisterV. */
182DECLINLINE(int) RT_IPRT_FORMAT_ATTR(2, 0) HGCMSvcHlpStamDeregisterV(PVBOXHGCMSVCHELPERS pHlp, const char *pszPatFmt, va_list va)
183{
184 return pHlp->pfnStamDeregisterV(pHlp->pvInstance, pszPatFmt, va);
185}
186
187/** Wrapper around DBGFR3InfoRegisterExternal. */
188DECLINLINE(int) HGCMSvcHlpInfoRegister(PVBOXHGCMSVCHELPERS pHlp, const char *pszName, const char *pszDesc,
189 PFNDBGFHANDLEREXT pfnHandler, void *pvUser)
190{
191 return pHlp->pfnInfoRegister(pHlp->pvInstance, pszName, pszDesc, pfnHandler, pvUser);
192}
193
194/** Wrapper around DBGFR3InfoDeregisterExternal. */
195DECLINLINE(int) HGCMSvcHlpInfoDeregister(PVBOXHGCMSVCHELPERS pHlp, const char *pszName)
196{
197 return pHlp->pfnInfoDeregister(pHlp->pvInstance, pszName);
198}
199
200#endif /* IN_RING3 */
201
202
203#define VBOX_HGCM_SVC_PARM_INVALID (0U)
204#define VBOX_HGCM_SVC_PARM_32BIT (1U)
205#define VBOX_HGCM_SVC_PARM_64BIT (2U)
206#define VBOX_HGCM_SVC_PARM_PTR (3U)
207
208typedef struct VBOXHGCMSVCPARM
209{
210 /** VBOX_HGCM_SVC_PARM_* values. */
211 uint32_t type;
212
213 union
214 {
215 uint32_t uint32;
216 uint64_t uint64;
217 struct
218 {
219 uint32_t size;
220 void *addr;
221 } pointer;
222 } u;
223} VBOXHGCMSVCPARM;
224
225/** Extract an uint32_t value from an HGCM parameter structure. */
226DECLINLINE(int) HGCMSvcGetU32(VBOXHGCMSVCPARM *pParm, uint32_t *pu32)
227{
228 int rc = VINF_SUCCESS;
229 AssertPtrReturn(pParm, VERR_INVALID_POINTER);
230 AssertPtrReturn(pParm, VERR_INVALID_POINTER);
231 AssertPtrReturn(pu32, VERR_INVALID_POINTER);
232 if (pParm->type != VBOX_HGCM_SVC_PARM_32BIT)
233 rc = VERR_INVALID_PARAMETER;
234 if (RT_SUCCESS(rc))
235 *pu32 = pParm->u.uint32;
236 return rc;
237}
238
239/** Extract an uint64_t value from an HGCM parameter structure. */
240DECLINLINE(int) HGCMSvcGetU64(VBOXHGCMSVCPARM *pParm, uint64_t *pu64)
241{
242 int rc = VINF_SUCCESS;
243 AssertPtrReturn(pParm, VERR_INVALID_POINTER);
244 AssertPtrReturn(pParm, VERR_INVALID_POINTER);
245 AssertPtrReturn(pu64, VERR_INVALID_POINTER);
246 if (pParm->type != VBOX_HGCM_SVC_PARM_64BIT)
247 rc = VERR_INVALID_PARAMETER;
248 if (RT_SUCCESS(rc))
249 *pu64 = pParm->u.uint64;
250 return rc;
251}
252
253/** Extract an pointer value from an HGCM parameter structure. */
254DECLINLINE(int) HGCMSvcGetPv(VBOXHGCMSVCPARM *pParm, void **ppv, uint32_t *pcb)
255{
256 AssertPtrReturn(pParm, VERR_INVALID_POINTER);
257 AssertPtrReturn(ppv, VERR_INVALID_POINTER);
258 AssertPtrReturn(pcb, VERR_INVALID_POINTER);
259 if (pParm->type == VBOX_HGCM_SVC_PARM_PTR)
260 {
261 *ppv = pParm->u.pointer.addr;
262 *pcb = pParm->u.pointer.size;
263 return VINF_SUCCESS;
264 }
265
266 return VERR_INVALID_PARAMETER;
267}
268
269/** Extract a constant pointer value from an HGCM parameter structure. */
270DECLINLINE(int) HGCMSvcGetPcv(VBOXHGCMSVCPARM *pParm, const void **ppv, uint32_t *pcb)
271{
272 AssertPtrReturn(pParm, VERR_INVALID_POINTER);
273 AssertPtrReturn(ppv, VERR_INVALID_POINTER);
274 AssertPtrReturn(pcb, VERR_INVALID_POINTER);
275 if (pParm->type == VBOX_HGCM_SVC_PARM_PTR)
276 {
277 *ppv = (const void *)pParm->u.pointer.addr;
278 *pcb = pParm->u.pointer.size;
279 return VINF_SUCCESS;
280 }
281
282 return VERR_INVALID_PARAMETER;
283}
284
285/** Extract a valid pointer to a non-empty buffer from an HGCM parameter
286 * structure. */
287DECLINLINE(int) HGCMSvcGetBuf(VBOXHGCMSVCPARM *pParm, void **ppv, uint32_t *pcb)
288{
289 AssertPtrReturn(pParm, VERR_INVALID_POINTER);
290 AssertPtrReturn(ppv, VERR_INVALID_POINTER);
291 AssertPtrReturn(pcb, VERR_INVALID_POINTER);
292 if ( pParm->type == VBOX_HGCM_SVC_PARM_PTR
293 && VALID_PTR(pParm->u.pointer.addr)
294 && pParm->u.pointer.size > 0)
295 {
296 *ppv = pParm->u.pointer.addr;
297 *pcb = pParm->u.pointer.size;
298 return VINF_SUCCESS;
299 }
300
301 return VERR_INVALID_PARAMETER;
302}
303
304/** Extract a valid pointer to a non-empty constant buffer from an HGCM
305 * parameter structure. */
306DECLINLINE(int) HGCMSvcGetCBuf(VBOXHGCMSVCPARM *pParm, const void **ppv, uint32_t *pcb)
307{
308 AssertPtrReturn(pParm, VERR_INVALID_POINTER);
309 AssertPtrReturn(ppv, VERR_INVALID_POINTER);
310 AssertPtrReturn(pcb, VERR_INVALID_POINTER);
311 if ( pParm->type == VBOX_HGCM_SVC_PARM_PTR
312 && VALID_PTR(pParm->u.pointer.addr)
313 && pParm->u.pointer.size > 0)
314 {
315 *ppv = (const void *)pParm->u.pointer.addr;
316 *pcb = pParm->u.pointer.size;
317 return VINF_SUCCESS;
318 }
319
320 return VERR_INVALID_PARAMETER;
321}
322
323/** Extract a string value from an HGCM parameter structure. */
324DECLINLINE(int) HGCMSvcGetStr(VBOXHGCMSVCPARM *pParm, char **ppch, uint32_t *pcb)
325{
326 AssertPtrReturn(pParm, VERR_INVALID_POINTER);
327 AssertPtrReturn(ppch, VERR_INVALID_POINTER);
328 AssertPtrReturn(pcb, VERR_INVALID_POINTER);
329 if ( pParm->type == VBOX_HGCM_SVC_PARM_PTR
330 && VALID_PTR(pParm->u.pointer.addr)
331 && pParm->u.pointer.size > 0)
332 {
333 int rc = RTStrValidateEncodingEx((char *)pParm->u.pointer.addr,
334 pParm->u.pointer.size,
335 RTSTR_VALIDATE_ENCODING_ZERO_TERMINATED);
336 if (RT_FAILURE(rc))
337 return rc;
338 *ppch = (char *)pParm->u.pointer.addr;
339 *pcb = pParm->u.pointer.size;
340 return VINF_SUCCESS;
341 }
342
343 return VERR_INVALID_PARAMETER;
344}
345
346/** Extract a constant string value from an HGCM parameter structure. */
347DECLINLINE(int) HGCMSvcGetCStr(VBOXHGCMSVCPARM *pParm, const char **ppch, uint32_t *pcb)
348{
349 AssertPtrReturn(pParm, VERR_INVALID_POINTER);
350 AssertPtrReturn(ppch, VERR_INVALID_POINTER);
351 AssertPtrReturn(pcb, VERR_INVALID_POINTER);
352 if ( pParm->type == VBOX_HGCM_SVC_PARM_PTR
353 && VALID_PTR(pParm->u.pointer.addr)
354 && pParm->u.pointer.size > 0)
355 {
356 int rc = RTStrValidateEncodingEx((char *)pParm->u.pointer.addr,
357 pParm->u.pointer.size,
358 RTSTR_VALIDATE_ENCODING_ZERO_TERMINATED);
359 if (RT_FAILURE(rc))
360 return rc;
361 *ppch = (char *)pParm->u.pointer.addr;
362 *pcb = pParm->u.pointer.size;
363 return VINF_SUCCESS;
364 }
365
366 return VERR_INVALID_PARAMETER;
367}
368
369/** Extract a constant string value from an HGCM parameter structure. */
370DECLINLINE(int) HGCMSvcGetPsz(VBOXHGCMSVCPARM *pParm, const char **ppch, uint32_t *pcb)
371{
372 AssertPtrReturn(pParm, VERR_INVALID_POINTER);
373 AssertPtrReturn(ppch, VERR_INVALID_POINTER);
374 AssertPtrReturn(pcb, VERR_INVALID_POINTER);
375 if ( pParm->type == VBOX_HGCM_SVC_PARM_PTR
376 && VALID_PTR(pParm->u.pointer.addr)
377 && pParm->u.pointer.size > 0)
378 {
379 int rc = RTStrValidateEncodingEx((const char *)pParm->u.pointer.addr,
380 pParm->u.pointer.size,
381 RTSTR_VALIDATE_ENCODING_ZERO_TERMINATED);
382 if (RT_FAILURE(rc))
383 return rc;
384 *ppch = (const char *)pParm->u.pointer.addr;
385 *pcb = pParm->u.pointer.size;
386 return VINF_SUCCESS;
387 }
388
389 return VERR_INVALID_PARAMETER;
390}
391
392/** Set a uint32_t value to an HGCM parameter structure */
393DECLINLINE(void) HGCMSvcSetU32(VBOXHGCMSVCPARM *pParm, uint32_t u32)
394{
395 AssertPtr(pParm);
396 pParm->type = VBOX_HGCM_SVC_PARM_32BIT;
397 pParm->u.uint32 = u32;
398}
399
400/** Set a uint64_t value to an HGCM parameter structure */
401DECLINLINE(void) HGCMSvcSetU64(VBOXHGCMSVCPARM *pParm, uint64_t u64)
402{
403 AssertPtr(pParm);
404 pParm->type = VBOX_HGCM_SVC_PARM_64BIT;
405 pParm->u.uint64 = u64;
406}
407
408/** Set a pointer value to an HGCM parameter structure */
409DECLINLINE(void) HGCMSvcSetPv(VBOXHGCMSVCPARM *pParm, void *pv, uint32_t cb)
410{
411 AssertPtr(pParm);
412 pParm->type = VBOX_HGCM_SVC_PARM_PTR;
413 pParm->u.pointer.addr = pv;
414 pParm->u.pointer.size = cb;
415}
416
417/** Set a pointer value to an HGCM parameter structure */
418DECLINLINE(void) HGCMSvcSetStr(VBOXHGCMSVCPARM *pParm, const char *psz)
419{
420 AssertPtr(pParm);
421 pParm->type = VBOX_HGCM_SVC_PARM_PTR;
422 pParm->u.pointer.addr = (void *)psz;
423 pParm->u.pointer.size = (uint32_t)strlen(psz) + 1;
424}
425
426#ifdef __cplusplus
427# ifdef ___iprt_cpp_ministring_h
428/** Set a const string value to an HGCM parameter structure */
429DECLINLINE(void) HGCMSvcSetRTCStr(VBOXHGCMSVCPARM *pParm, const RTCString &rString)
430{
431 AssertPtr(pParm);
432 pParm->type = VBOX_HGCM_SVC_PARM_PTR;
433 pParm->u.pointer.addr = (void *)rString.c_str();
434 pParm->u.pointer.size = (uint32_t)rString.length() + 1;
435}
436# endif
437#endif
438
439typedef VBOXHGCMSVCPARM *PVBOXHGCMSVCPARM;
440
441#ifdef VBOX_WITH_CRHGSMI
442typedef void * HGCMCVSHANDLE;
443
444typedef DECLCALLBACK(void) HGCMHOSTFASTCALLCB (int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext);
445typedef HGCMHOSTFASTCALLCB *PHGCMHOSTFASTCALLCB;
446#endif
447
448
449/** Service specific extension callback.
450 * This callback is called by the service to perform service specific operation.
451 *
452 * @param pvExtension The extension pointer.
453 * @param u32Function What the callback is supposed to do.
454 * @param pvParm The function parameters.
455 * @param cbParm The size of the function parameters.
456 */
457typedef DECLCALLBACK(int) FNHGCMSVCEXT(void *pvExtension, uint32_t u32Function, void *pvParm, uint32_t cbParms);
458typedef FNHGCMSVCEXT *PFNHGCMSVCEXT;
459
460/**
461 * Notification event.
462 */
463typedef enum HGCMNOTIFYEVENT
464{
465 HGCMNOTIFYEVENT_INVALID = 0,
466 HGCMNOTIFYEVENT_POWER_ON,
467 HGCMNOTIFYEVENT_RESUME,
468 HGCMNOTIFYEVENT_SUSPEND,
469 HGCMNOTIFYEVENT_RESET,
470 HGCMNOTIFYEVENT_POWER_OFF,
471 HGCMNOTIFYEVENT_END,
472 HGCMNOTIFYEVENT_32BIT_HACK = 0x7fffffff
473} HGCMNOTIFYEVENT;
474
475
476/** The Service DLL entry points.
477 *
478 * HGCM will call the DLL "VBoxHGCMSvcLoad"
479 * function and the DLL must fill in the VBOXHGCMSVCFNTABLE
480 * with function pointers.
481 *
482 * @note The structure is used in separately compiled binaries so an explicit
483 * packing is required.
484 */
485typedef struct VBOXHGCMSVCFNTABLE
486{
487 /** @name Filled by HGCM
488 * @{ */
489
490 /** Size of the structure. */
491 uint32_t cbSize;
492
493 /** Version of the structure, including the helpers. */
494 uint32_t u32Version;
495
496 PVBOXHGCMSVCHELPERS pHelpers;
497 /** @} */
498
499 /** @name Filled in by the service.
500 * @{ */
501
502 /** Size of client information the service want to have. */
503 uint32_t cbClient;
504#if ARCH_BITS == 64
505 /** Ensure that the following pointers are properly aligned on 64-bit system. */
506 uint32_t u32Alignment0;
507#endif
508
509 /** Uninitialize service */
510 DECLR3CALLBACKMEMBER(int, pfnUnload, (void *pvService));
511
512 /** Inform the service about a client connection. */
513 DECLR3CALLBACKMEMBER(int, pfnConnect, (void *pvService, uint32_t u32ClientID, void *pvClient, uint32_t fRequestor, bool fRestoring));
514
515 /** Inform the service that the client wants to disconnect. */
516 DECLR3CALLBACKMEMBER(int, pfnDisconnect, (void *pvService, uint32_t u32ClientID, void *pvClient));
517
518 /** Service entry point.
519 * Return code is passed to pfnCallComplete callback.
520 */
521 DECLR3CALLBACKMEMBER(void, pfnCall, (void *pvService, VBOXHGCMCALLHANDLE callHandle, uint32_t u32ClientID, void *pvClient,
522 uint32_t function, uint32_t cParms, VBOXHGCMSVCPARM paParms[], uint64_t tsArrival));
523 /** Informs the service that a call was cancelled by the guest (optional).
524 *
525 * This is called for guest calls, connect requests and disconnect requests.
526 * There is unfortunately no way of obtaining the call handle for a guest call
527 * or otherwise identify the request, so that's left to the service to figure
528 * out using VBOXHGCMSVCHELPERS::pfnIsCallCancelled. Because this is an
529 * asynchronous call, the service may have completed the request already.
530 */
531 DECLR3CALLBACKMEMBER(void, pfnCancelled, (void *pvService, uint32_t idClient, void *pvClient));
532
533 /** Host Service entry point meant for privileged features invisible to the guest.
534 * Return code is passed to pfnCallComplete callback.
535 */
536 DECLR3CALLBACKMEMBER(int, pfnHostCall, (void *pvService, uint32_t function, uint32_t cParms, VBOXHGCMSVCPARM paParms[]));
537
538 /** Inform the service about a VM save operation. */
539 DECLR3CALLBACKMEMBER(int, pfnSaveState, (void *pvService, uint32_t u32ClientID, void *pvClient, PSSMHANDLE pSSM));
540
541 /** Inform the service about a VM load operation. */
542 DECLR3CALLBACKMEMBER(int, pfnLoadState, (void *pvService, uint32_t u32ClientID, void *pvClient, PSSMHANDLE pSSM,
543 uint32_t uVersion));
544
545 /** Register a service extension callback. */
546 DECLR3CALLBACKMEMBER(int, pfnRegisterExtension, (void *pvService, PFNHGCMSVCEXT pfnExtension, void *pvExtension));
547
548 /** Notification (VM state). */
549 DECLR3CALLBACKMEMBER(void, pfnNotify, (void *pvService, HGCMNOTIFYEVENT enmEvent));
550
551 /** User/instance data pointer for the service. */
552 void *pvService;
553
554 /** @} */
555} VBOXHGCMSVCFNTABLE;
556
557
558/** @name HGCM saved state
559 * @note Need to be here so we can add saved to service which doesn't have it.
560 * @{ */
561/** HGCM saved state version. */
562#define HGCM_SAVED_STATE_VERSION 3
563/** HGCM saved state version w/o client state indicators. */
564#define HGCM_SAVED_STATE_VERSION_V2 2
565/** @} */
566
567
568/** Service initialization entry point. */
569typedef DECLCALLBACK(int) VBOXHGCMSVCLOAD(VBOXHGCMSVCFNTABLE *ptable);
570typedef VBOXHGCMSVCLOAD *PFNVBOXHGCMSVCLOAD;
571#define VBOX_HGCM_SVCLOAD_NAME "VBoxHGCMSvcLoad"
572
573#endif
574
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