1 | /** @file
|
---|
2 | * VBoxGuest - VirtualBox Guest Additions Driver Interface, Mixed Up Mess.
|
---|
3 | * (ADD,DEV)
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2016 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * The contents of this file may alternatively be used under the terms
|
---|
18 | * of the Common Development and Distribution License Version 1.0
|
---|
19 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | * CDDL are applicable instead of those of the GPL.
|
---|
22 | *
|
---|
23 | * You may elect to license modified versions of this file under the
|
---|
24 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | */
|
---|
26 |
|
---|
27 | #ifndef ___VBox_VBoxGuest2_h
|
---|
28 | #define ___VBox_VBoxGuest2_h
|
---|
29 |
|
---|
30 | #include <iprt/assert.h>
|
---|
31 |
|
---|
32 | #ifdef VBOX_WITH_HGCM
|
---|
33 | # include <VBox/VMMDev2.h>
|
---|
34 |
|
---|
35 | /** @addtogroup grp_vmmdev
|
---|
36 | * @{ */
|
---|
37 |
|
---|
38 | /**
|
---|
39 | * HGCM connect info structure.
|
---|
40 | *
|
---|
41 | * This is used by VBOXGUEST_IOCTL_HGCM_CONNECT and in VbglR0.
|
---|
42 | *
|
---|
43 | * @ingroup grp_vboxguest
|
---|
44 | */
|
---|
45 | # pragma pack(1) /* explicit packing for good measure. */
|
---|
46 | typedef struct VBoxGuestHGCMConnectInfo
|
---|
47 | {
|
---|
48 | int32_t result; /**< OUT */
|
---|
49 | HGCMServiceLocation Loc; /**< IN */
|
---|
50 | uint32_t u32ClientID; /**< OUT */
|
---|
51 | } VBoxGuestHGCMConnectInfo;
|
---|
52 | AssertCompileSize(VBoxGuestHGCMConnectInfo, 4+4+128+4);
|
---|
53 | # pragma pack()
|
---|
54 |
|
---|
55 |
|
---|
56 | /**
|
---|
57 | * HGCM connect info structure.
|
---|
58 | *
|
---|
59 | * This is used by VBOXGUEST_IOCTL_HGCM_DISCONNECT and in VbglR0.
|
---|
60 | *
|
---|
61 | * @ingroup grp_vboxguest
|
---|
62 | */
|
---|
63 | typedef struct VBoxGuestHGCMDisconnectInfo
|
---|
64 | {
|
---|
65 | int32_t result; /**< OUT */
|
---|
66 | uint32_t u32ClientID; /**< IN */
|
---|
67 | } VBoxGuestHGCMDisconnectInfo;
|
---|
68 | AssertCompileSize(VBoxGuestHGCMDisconnectInfo, 8);
|
---|
69 |
|
---|
70 | /**
|
---|
71 | * HGCM call info structure.
|
---|
72 | *
|
---|
73 | * This is used by VBOXGUEST_IOCTL_HGCM_CALL.
|
---|
74 | *
|
---|
75 | * @ingroup grp_vboxguest
|
---|
76 | */
|
---|
77 | typedef struct VBoxGuestHGCMCallInfo
|
---|
78 | {
|
---|
79 | int32_t result; /**< OUT Host HGCM return code.*/
|
---|
80 | uint32_t u32ClientID; /**< IN The id of the caller. */
|
---|
81 | uint32_t u32Function; /**< IN Function number. */
|
---|
82 | uint32_t cParms; /**< IN How many parms. */
|
---|
83 | /* Parameters follow in form HGCMFunctionParameter aParms[cParms] */
|
---|
84 | } VBoxGuestHGCMCallInfo;
|
---|
85 | AssertCompileSize(VBoxGuestHGCMCallInfo, 16);
|
---|
86 |
|
---|
87 | /**
|
---|
88 | * Initialize a HGCM header (VBoxGuestHGCMCallInfo).
|
---|
89 | *
|
---|
90 | * @param a_pHdr The header to initalize.
|
---|
91 | * @param a_idClient The client connection ID to call thru.
|
---|
92 | * @param a_idFunction The function we're calling
|
---|
93 | * @param a_cParameters Number of parameters.
|
---|
94 | */
|
---|
95 | # define VBGL_HGCM_HDR_INIT(a_pHdr, a_idClient, a_idFunction, a_cParameters) \
|
---|
96 | do { \
|
---|
97 | (a_pHdr)->result = VERR_INTERNAL_ERROR; \
|
---|
98 | (a_pHdr)->u32ClientID = (a_idClient); \
|
---|
99 | (a_pHdr)->u32Function = (a_idFunction); \
|
---|
100 | (a_pHdr)->cParms = (a_cParameters); \
|
---|
101 | } while (0)
|
---|
102 |
|
---|
103 |
|
---|
104 | /**
|
---|
105 | * HGCM call info structure.
|
---|
106 | *
|
---|
107 | * This is used by VBOXGUEST_IOCTL_HGCM_CALL_TIMED.
|
---|
108 | *
|
---|
109 | * @ingroup grp_vboxguest
|
---|
110 | */
|
---|
111 | # pragma pack(1) /* explicit packing for good measure. */
|
---|
112 | typedef struct VBoxGuestHGCMCallInfoTimed
|
---|
113 | {
|
---|
114 | uint32_t u32Timeout; /**< IN How long to wait for completion before cancelling the call. */
|
---|
115 | uint32_t fInterruptible; /**< IN Is this request interruptible? */
|
---|
116 | VBoxGuestHGCMCallInfo info; /**< IN/OUT The rest of the call information. Placed after the timeout
|
---|
117 | * so that the parameters follow as they would for a normal call. */
|
---|
118 | /* Parameters follow in form HGCMFunctionParameter aParms[cParms] */
|
---|
119 | } VBoxGuestHGCMCallInfoTimed;
|
---|
120 | AssertCompileSize(VBoxGuestHGCMCallInfoTimed, 8+16);
|
---|
121 | # pragma pack()
|
---|
122 |
|
---|
123 | /**
|
---|
124 | * Initialize a HGCM header (VBoxGuestHGCMCallInfo), with timeout (interruptible).
|
---|
125 | *
|
---|
126 | * @param a_pHdr The header to initalize.
|
---|
127 | * @param a_idClient The client connection ID to call thru.
|
---|
128 | * @param a_idFunction The function we're calling
|
---|
129 | * @param a_cParameters Number of parameters.
|
---|
130 | * @param a_cMsTimeout The timeout in milliseconds.
|
---|
131 | */
|
---|
132 | # define VBGL_HGCM_HDR_INIT_TIMED(a_pHdr, a_idClient, a_idFunction, a_cParameters, a_cMsTimeout) \
|
---|
133 | do { \
|
---|
134 | (a_pHdr)->u32Timeout = (a_cMsTimeout); \
|
---|
135 | (a_pHdr)->fInterruptible = true; \
|
---|
136 | (a_pHdr)->info.result = VERR_INTERNAL_ERROR; \
|
---|
137 | (a_pHdr)->info.u32ClientID = (a_idClient); \
|
---|
138 | (a_pHdr)->info.u32Function = (a_idFunction); \
|
---|
139 | (a_pHdr)->info.cParms = (a_cParameters); \
|
---|
140 | } while (0)
|
---|
141 |
|
---|
142 | /** @} */
|
---|
143 |
|
---|
144 | #endif /* VBOX_WITH_HGCM */
|
---|
145 |
|
---|
146 | #endif
|
---|
147 |
|
---|