VirtualBox

source: vbox/trunk/include/VBox/ExtPack/ExtPack.h@ 33933

Last change on this file since 33933 was 33693, checked in by vboxsync, 14 years ago

Main: More ExtPack code.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.6 KB
Line 
1/** @file
2 * VirtualBox - Extension Pack Interface.
3 */
4
5/*
6 * Copyright (C) 2010 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_ExtPack_ExtPack_h
27#define ___VBox_ExtPack_ExtPack_h
28
29#include <VBox/types.h>
30
31#if defined(__cplusplus)
32class IConsole;
33class IMachine;
34#else
35typedef struct IConsole IConsole;
36typedef struct IMachine IMachine;
37#endif
38
39
40/** Pointer to const helpers passed to the VBoxExtPackRegister() call. */
41typedef const struct VBOXEXTPACKHLP *PCVBOXEXTPACKHLP;
42/**
43 * Extension pack helpers passed to VBoxExtPackRegister().
44 *
45 * This will be valid until the module is unloaded.
46 */
47typedef struct VBOXEXTPACKHLP
48{
49 /** Interface version.
50 * This is set to VBOXEXTPACKHLP_VERSION. */
51 uint32_t u32Version;
52
53 /** The VirtualBox full version (see VBOX_FULL_VERSION). */
54 uint32_t uVBoxFullVersion;
55 /** The VirtualBox subversion tree revision. */
56 uint32_t uVBoxInternalRevision;
57 /** Explicit alignment padding, must be zero. */
58 uint32_t u32Padding;
59 /** Pointer to the version string (read-only). */
60 const char *pszVBoxVersion;
61
62 /**
63 * Finds a module belonging to this extension pack.
64 *
65 * @returns VBox status code.
66 * @param pHlp Pointer to this helper structure.
67 * @param pszName The module base name.
68 * @param pszExt The extension. If NULL the default ring-3
69 * library extension will be used.
70 * @param pszFound Where to return the path to the module on
71 * success.
72 * @param cbFound The size of the buffer @a pszFound points to.
73 * @param pfNative Where to return the native/agnostic indicator.
74 */
75 DECLR3CALLBACKMEMBER(int, pfnFindModule,(PCVBOXEXTPACKHLP pHlp, const char *pszName, const char *pszExt,
76 char *pszFound, size_t cbFound, bool *pfNative));
77
78 /** End of structure marker (VBOXEXTPACKHLP_VERSION). */
79 uint32_t u32EndMarker;
80} VBOXEXTPACKHLP;
81/** Current version of the VBOXEXTPACKHLP structure. */
82#define VBOXEXTPACKHLP_VERSION RT_MAKE_U32(1, 0)
83
84
85/** Pointer to the extension pack callback table. */
86typedef struct VBOXEXTPACKREG const *PCVBOXEXTPACKREG;
87/**
88 * Callback table returned by VBoxExtPackRegister.
89 *
90 * This must be valid until the extension pack main module is unloaded.
91 */
92typedef struct VBOXEXTPACKREG
93{
94 /** Interface version.
95 * This is set to VBOXEXTPACKREG_VERSION. */
96 uint32_t u32Version;
97
98 /**
99 * Hook for doing setups after the extension pack was installed.
100 *
101 * This is called in the context of the per-user service (VBoxSVC).
102 *
103 * @param pThis Pointer to this structure.
104 */
105 DECLCALLBACKMEMBER(void, pfnInstalled)(PCVBOXEXTPACKREG pThis);
106
107 /**
108 * Hook for cleaning up before the extension pack is uninstalled.
109 *
110 * This is called in the context of the per-user service (VBoxSVC).
111 *
112 * @returns VBox status code.
113 * @param pThis Pointer to this structure.
114 */
115 DECLCALLBACKMEMBER(int, pfnUninstall)(PCVBOXEXTPACKREG pThis);
116
117 /**
118 * Hook for doing work before unloading.
119 *
120 * This is called both in the context of the per-user service (VBoxSVC) and
121 * in context of the VM process (VBoxC).
122 *
123 * @param pThis Pointer to this structure.
124 *
125 * @remarks The helpers are not available at this point in time.
126 * @remarks This is not called on uninstall, then pfnUninstall will be the
127 * last callback.
128 */
129 DECLCALLBACKMEMBER(void, pfnUnload)(PCVBOXEXTPACKREG pThis);
130
131 /**
132 * Hook for changing the default VM configuration upon creation.
133 *
134 * This is called in the context of the per-user service (VBoxSVC).
135 *
136 * @returns VBox status code.
137 * @param pThis Pointer to this structure.
138 * @param pMachine The machine interface.
139 */
140 DECLCALLBACKMEMBER(int, pfnVMCreated)(PCVBOXEXTPACKREG pThis, IMachine *pMachine);
141
142 /**
143 * Hook for configuring the VMM for a VM.
144 *
145 * This is called in the context of the VM process (VBoxC).
146 *
147 * @returns VBox status code.
148 * @param pThis Pointer to this structure.
149 * @param pConsole The console interface.
150 * @param pVM The VM handle.
151 */
152 DECLCALLBACKMEMBER(int, pfnVMConfigureVMM)(PCVBOXEXTPACKREG pThis, IConsole *pConsole, PVM pVM);
153
154 /**
155 * Hook for doing work right before powering on the VM.
156 *
157 * This is called in the context of the VM process (VBoxC).
158 *
159 * @returns VBox status code.
160 * @param pThis Pointer to this structure.
161 * @param pConsole The console interface.
162 * @param pVM The VM handle.
163 */
164 DECLCALLBACKMEMBER(int, pfnVMPowerOn)(PCVBOXEXTPACKREG pThis, IConsole *pConsole, PVM pVM);
165
166 /**
167 * Hook for doing work after powering on the VM.
168 *
169 * This is called in the context of the VM process (VBoxC).
170 *
171 * @param pThis Pointer to this structure.
172 * @param pConsole The console interface.
173 * @param pVM The VM handle. Can be NULL.
174 */
175 DECLCALLBACKMEMBER(void, pfnVMPowerOff)(PCVBOXEXTPACKREG pThis, IConsole *pConsole, PVM pVM);
176
177 /** End of structure marker (VBOXEXTPACKREG_VERSION). */
178 uint32_t u32EndMarker;
179} VBOXEXTPACKREG;
180/** Current version of the VBOXEXTPACKREG structure. */
181#define VBOXEXTPACKREG_VERSION RT_MAKE_U32(1, 0)
182
183
184/**
185 * The VBoxExtPackRegister callback function.
186 *
187 * PDM will invoke this function after loading a driver module and letting
188 * the module decide which drivers to register and how to handle conflicts.
189 *
190 * @returns VBox status code.
191 * @param pHlp Pointer to the extension pack helper function
192 * table. This is valid until the module is unloaded.
193 * @param ppReg Where to return the pointer to the registration
194 * structure containing all the hooks. This structure
195 * be valid and unchanged until the module is unloaded
196 * (i.e. use some static const data for it).
197 * @param pszErr Error message buffer for explaining any failure.
198 * @param cbErr The size of the error message buffer.
199 */
200typedef DECLCALLBACK(int) FNVBOXEXTPACKREGISTER(PCVBOXEXTPACKHLP pHlp, PCVBOXEXTPACKREG *ppReg, char *pszErr, size_t cbErr);
201/** Pointer to a FNVBOXEXTPACKREGISTER. */
202typedef FNVBOXEXTPACKREGISTER *PFNVBOXEXTPACKREGISTER;
203
204/** The name of the main module entry point. */
205#define VBOX_EXTPACK_MAIN_MOD_ENTRY_POINT "VBoxExtPackRegister"
206
207
208#endif
209
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