VirtualBox

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

Last change on this file since 78351 was 76568, checked in by vboxsync, 6 years ago

HostDrivers: Use VBOX_INCLUDED_SRC_ as header guard prefix with scm.

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