VirtualBox

source: vbox/trunk/src/VBox/HostDrivers/Support/SUPDrvIDC.h@ 10264

Last change on this file since 10264 was 10264, checked in by vboxsync, 16 years ago

bad constant.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.4 KB
Line 
1/* $Id: SUPDrvIDC.h 10264 2008-07-05 00:38:39Z vboxsync $ */
2/** @file
3 * VirtualBox Support Driver - Inter-Driver Communciation (IDC) definitions.
4 */
5
6/*
7 * Copyright (C) 2008 Sun Microsystems, Inc.
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 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
27 * Clara, CA 95054 USA or visit http://www.sun.com if you need
28 * additional information or have any questions.
29 */
30
31#ifndef ___SUPDrvIDC_h___
32#define ___SUPDrvIDC_h___
33
34#include <VBox/types.h>
35
36/** @def SUP_IDC_CODE
37 * Creates IDC function code.
38 *
39 * @param Function The function number to encode, 1..255.
40 *
41 * @remarks We can take a sligtly more relaxed attitude wrt to size encoding
42 * here since only windows will use standard I/O control function code.
43 */
44#ifdef RT_OS_WINDOWS
45# define SUP_IDC_CODE(Function) CTL_CODE(FILE_DEVICE_UNKNOWN, (Function) + 2542, METHOD_BUFFERED, FILE_WRITE_ACCESS)
46#else
47# define SUP_IDC_CODE(Function) ( UINT32_C(0xc0ffee00) | (uint32_t)(0x000000ff & (Function)) )
48#endif
49
50
51/*******************************************************************************
52* Structures and Typedefs *
53*******************************************************************************/
54#ifdef RT_ARCH_AMD64
55# pragma pack(8) /* paranoia. */
56#else
57# pragma pack(4) /* paranoia. */
58#endif
59
60
61/**
62 * An IDC request packet header.
63 *
64 * The main purpose of this header is to pass the session handle
65 * and status code in a generic manner in order to make things
66 * easier on the receiving end.
67 */
68typedef struct SUPDRVIDCREQHDR
69{
70 /** IN: The size of the request. */
71 uint32_t cb;
72 /** OUT: Status code of the request. */
73 int32_t rc;
74 /** IN: Pointer to the session handle. */
75 PSUPDRVSESSION pSession;
76#if ARCH_BITS == 32
77 /** Padding the structure to 16-bytes. */
78 uint32_t u32Padding;
79#endif
80} SUPDRVIDCREQHDR;
81/** Pointer to an IDC request packet header. */
82typedef SUPDRVIDCREQHDR *PSUPDRVIDCREQHDR;
83/** Pointer to a const IDC request packet header. */
84typedef SUPDRVIDCREQHDR const *PCSUPDRVIDCREQHDR;
85
86
87/**
88 * SUPDRV IDC: Connect request.
89 * This request takes a SUPDRVIDCREQCONNECT packet.
90 */
91#define SUPDRV_IDC_REQ_CONNECT SUP_IDC_CODE(1)
92/** A SUPDRV IDC connect request packet. */
93typedef struct SUPDRVIDCREQCONNECT
94{
95 /** The request header. */
96 SUPDRVIDCREQHDR Hdr;
97 /** The payload union. */
98 union
99 {
100 /** The input. */
101 struct SUPDRVIDCREQCONNECTIN
102 {
103 /** The magic cookie (SUPDRVIDCREQ_CONNECT_MAGIC_COOKIE). */
104 uint32_t u32MagicCookie;
105 /** The desired version of the IDC interface. */
106 uint32_t uReqVersion;
107 /** The minimum version of the IDC interface. */
108 uint32_t uMinVersion;
109 } In;
110
111 /** The output. */
112 struct SUPDRVIDCREQCONNECTOUT
113 {
114 /** The version of the IDC interface for this session. */
115 uint32_t uVersion;
116 /** The support driver session. (An opaque.) */
117 PSUPDRVSESSION pSession;
118 } Out;
119 } u;
120} SUPDRVIDCREQCONNECT;
121/** Pointer to a SUPDRV IDC connect request. */
122typedef SUPDRVIDCREQCONNECT *PSUPDRVIDCREQCONNECT;
123/** Magic cookie value (SUPDRVIDCREQCONNECT::In.u32MagicCookie). ('tori') */
124#define SUPDRVIDCREQ_CONNECT_MAGIC_COOKIE UINT32_C(0x69726f74)
125
126
127/**
128 * SUPDRV IDC: Disconnect request.
129 * This request only requires a SUPDRVIDCREQHDR.
130 */
131#define SUPDRV_IDC_REQ_DISCONNECT SUP_IDC_CODE(2)
132
133
134/**
135 * SUPDRV IDC: Query a symbol address.
136 * This request takes a SUPDRVIDCREQGETSYM packet.
137 */
138#define SUPDRV_IDC_REQ_GET_SYMBOL SUP_IDC_CODE(3)
139/** A SUPDRV IDC get symbol request packet. */
140typedef struct SUPDRVIDCREQGETSYM
141{
142 /** The request header. */
143 SUPDRVIDCREQHDR Hdr;
144 /** The payload union. */
145 union
146 {
147 /** The input. */
148 struct SUPDRVIDCREQGETSYMIN
149 {
150 /** The module name.
151 * NULL is an alias for the support driver. */
152 const char *pszModule;
153 /** The symbol name. */
154 const char *pszSymbol;
155 } In;
156
157 /** The output. */
158 struct SUPDRVIDCREQGETSYMOUT
159 {
160 /** The symbol address. */
161 PFNRT pfnSymbol;
162 } Out;
163 } u;
164} SUPDRVIDCREQGETSYM;
165/** Pointer to a SUPDRV IDC get symbol request. */
166typedef SUPDRVIDCREQGETSYM *PSUPDRVIDCREQGETSYM;
167
168
169/**
170 * SUPDRV IDC: Request the registration of a component factory.
171 * This request takes a SUPDRVIDCREQCOMPREGFACTORY packet.
172 */
173#define SUPDRV_IDC_REQ_COMPONENT_REGISTER_FACTORY SUP_IDC_CODE(10)
174/** A SUPDRV IDC register component factory request packet. */
175typedef struct SUPDRVIDCREQCOMPREGFACTORY
176{
177 /** The request header. */
178 SUPDRVIDCREQHDR Hdr;
179 /** The payload union. */
180 union
181 {
182 /** The input. */
183 struct SUPDRVIDCREQCOMPREGFACTORYIN
184 {
185 /** Pointer to the factory. */
186 PCSUPDRVFACTORY pFactory;
187 } In;
188 } u;
189} SUPDRVIDCREQCOMPREGFACTORY;
190/** Pointer to a SUPDRV IDC register component factory request. */
191typedef SUPDRVIDCREQCOMPREGFACTORY *PSUPDRVIDCREQCOMPREGFACTORY;
192
193
194/**
195 * SUPDRV IDC: Dergister a component factory.
196 * This request takes a SUPDRVIDCREQCOMPDEREGFACTORY packet.
197 */
198#define SUPDRV_IDC_REQ_COMPONENT_DEREGISTER_FACTORY SUP_IDC_CODE(11)
199/** A SUPDRV IDC deregister component factory request packet. */
200typedef struct SUPDRVIDCREQCOMPDEREGFACTORY
201{
202 /** The request header. */
203 SUPDRVIDCREQHDR Hdr;
204 /** The payload union. */
205 union
206 {
207 /** The input. */
208 struct SUPDRVIDCREQCOMPDEREGFACTORYIN
209 {
210 /** Pointer to the factory. */
211 PCSUPDRVFACTORY pFactory;
212 } In;
213 } u;
214} SUPDRVIDCREQCOMPDEREGFACTORY;
215/** Pointer to a SUPDRV IDC deregister component factory request. */
216typedef SUPDRVIDCREQCOMPDEREGFACTORY *PSUPDRVIDCREQCOMPDEREGFACTORY;
217
218
219/*
220 * The OS specific prototypes.
221 * Most OSes uses
222 */
223__BEGIN_DECLS
224
225#if defined(RT_OS_DARWIN)
226extern int VBOXCALL SUPDrvDarwinIDC(uint32_t iReq, PSUPDRVIDCREQHDR pReq);
227
228#elif defined(RT_OS_FREEBSD)
229extern int VBOXCALL SUPDrvFreeBSDIDC(uint32_t iReq, PSUPDRVIDCREQHDR pReq);
230
231#elif defined(RT_OS_LINUX)
232extern int VBOXCALL SUPDrvLinuxIDC(uint32_t iReq, PSUPDRVIDCREQHDR pReq);
233
234#elif defined(RT_OS_OS2)
235/** @todo Port to OS/2. */
236
237#elif defined(RT_OS_SOLARIS)
238extern int VBOXCALL SUPDrvSolarisIDC(uint32_t iReq, PSUPDRVIDCREQHDR pReq);
239
240#elif defined(RT_OS_WINDOWS)
241/* Nothing special for windows. */
242
243#else
244/* PORTME: OS specific IDC stuff goes here. */
245#endif
246
247__END_DECLS
248
249/**
250 * The SUPDRV IDC entry point.
251 *
252 * @returns VBox status code indicating the validity of the session, request and
253 * the return data packet. The status of the request it self is found
254 * in the packet (specific to each request).
255 *
256 * @param pSession The session. (This is NULL for SUPDRV_IDC_REQ_CONNECT.)
257 * @param uReq The request number.
258 * @param pvReq Pointer to the request packet. Optional for some requests.
259 * @param cbReq The size of the request packet.
260 */
261/** @todo move this and change to function proto */
262typedef DECLCALLBACK(int) FNSUPDRVIDCENTRY(PSUPDRVSESSION pSession, uint32_t uReq, void *pvReq, uint32_t cbReq);
263
264/** @} */
265
266
267#pragma pack() /* paranoia */
268
269#endif
270
271
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use