hgcmsvc.h revision c9061bbb5f3fb704c8b803124ddcbd4c490aa1dc
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync * Host-Guest Communication Manager (HGCM) - Service library definitions.
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync * Copyright (C) 2006-2007 Oracle Corporation
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync * available from http://www.virtualbox.org. This file is free software;
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync * you can redistribute it and/or modify it under the terms of the GNU
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync * General Public License (GPL) as published by the Free Software
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync * The contents of this file may alternatively be used under the terms
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync * of the Common Development and Distribution License Version 1.0
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync * VirtualBox OSE distribution, in which case the provisions of the
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync * CDDL are applicable instead of those of the GPL.
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync * You may elect to license modified versions of this file under the
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync * terms and conditions of either the GPL or the CDDL or both.
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync/** @todo proper comments. */
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync * Service interface version.
ee4d840f54fd2dcea8a73b1b86d5ec0db370b05dvboxsync * Includes layout of both VBOXHGCMSVCFNTABLE and VBOXHGCMSVCHELPERS.
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync * A service can work with these structures if major version
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync * is equal and minor version of service is <= version of the
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync * structures.
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync * For example when a new helper is added at the end of helpers
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync * structure, then the minor version will be increased. All older
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync * services still can work because they have their old helpers
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync * unchanged.
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync * Revision history.
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync * 1.1->2.1 Because the pfnConnect now also has the pvClient parameter.
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync * 2.1->2.2 Because pfnSaveState and pfnLoadState were added
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync * 2.2->3.1 Because pfnHostCall is now synchronous, returns rc, and parameters were changed
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync * 3.1->3.2 Because pfnRegisterExtension was added
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync * 3.2->3.3 Because pfnDisconnectClient helper was added
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync * 3.3->4.1 Because the pvService entry and parameter was added
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync * 4.1->4.2 Because the VBOX_HGCM_SVC_PARM_CALLBACK parameter type was added
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync * 4.2->5.1 Removed the VBOX_HGCM_SVC_PARM_CALLBACK parameter type, as
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync * this problem is already solved by service extension callbacks
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync#define VBOX_HGCM_SVC_VERSION ((VBOX_HGCM_SVC_VERSION_MAJOR << 16) + VBOX_HGCM_SVC_VERSION_MINOR)
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync/** Typed pointer to distinguish a call to service. */
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsynctypedef struct VBOXHGCMCALLHANDLE_TYPEDEF *VBOXHGCMCALLHANDLE;
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync/** Service helpers pointers table. */
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync /** The service has processed the Call request. */
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync DECLR3CALLBACKMEMBER(void, pfnCallComplete, (VBOXHGCMCALLHANDLE callHandle, int32_t rc));
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync /** The service disconnects the client. */
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync DECLR3CALLBACKMEMBER(void, pfnDisconnectClient, (void *pvInstance, uint32_t u32ClientID));
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync /** VBOX_HGCM_SVC_PARM_* values. */
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync /** Extract a uint32_t value from an HGCM parameter structure */
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync /** Extract a uint64_t value from an HGCM parameter structure */
eb90548e8e40e597d65cdcc16ec958a3e09c1d73vboxsync /** Extract a pointer value from an HGCM parameter structure */
return VINF_SUCCESS;
return VERR_INVALID_PARAMETER;
void *pv;
return rc;
&& cb > 0)
return VINF_SUCCESS;
return VERR_INVALID_PARAMETER;
return rc;
*pcb = 0;
return rc;
return rc;
return rc;
#ifdef VBOX_TEST_HGCM_PARMS
typedef DECLCALLBACK(int) FNHGCMSVCEXT(void *pvExtension, uint32_t u32Function, void *pvParm, uint32_t cbParms);
typedef struct _VBOXHGCMSVCFNTABLE
DECLR3CALLBACKMEMBER(void, pfnCall, (void *pvService, VBOXHGCMCALLHANDLE callHandle, uint32_t u32ClientID, void *pvClient, uint32_t function, uint32_t cParms, VBOXHGCMSVCPARM paParms[]));
DECLR3CALLBACKMEMBER(int, pfnHostCall, (void *pvService, uint32_t function, uint32_t cParms, VBOXHGCMSVCPARM paParms[]));
DECLR3CALLBACKMEMBER(int, pfnSaveState, (void *pvService, uint32_t u32ClientID, void *pvClient, PSSMHANDLE pSSM));
DECLR3CALLBACKMEMBER(int, pfnLoadState, (void *pvService, uint32_t u32ClientID, void *pvClient, PSSMHANDLE pSSM));
DECLR3CALLBACKMEMBER(int, pfnRegisterExtension, (void *pvService, PFNHGCMSVCEXT pfnExtension, void *pvExtension));
void *pvService;
#pragma pack()