VirtualBox

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

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

scm cleanup run.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.2 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 * @returns VBox status code.
104 * @param pThis Pointer to this structure.
105 */
106 DECLCALLBACKMEMBER(int, pfnInstalled)(PCVBOXEXTPACKREG pThis);
107
108 /**
109 * Hook for cleaning up before the extension pack is uninstalled.
110 *
111 * This is called in the context of the per-user service (VBoxSVC).
112 *
113 * @returns VBox status code.
114 * @param pThis Pointer to this structure.
115 */
116 DECLCALLBACKMEMBER(int, pfnUninstall)(PCVBOXEXTPACKREG pThis);
117
118 /**
119 * Hook for changing the default VM configuration upon creation.
120 *
121 * This is called in the context of the per-user service (VBoxSVC).
122 *
123 * @returns VBox status code.
124 * @param pThis Pointer to this structure.
125 * @param pMachine The machine interface.
126 */
127 DECLCALLBACKMEMBER(int, pfnVMCreated)(PCVBOXEXTPACKREG pThis, IMachine *pMachine);
128
129 /**
130 * Hook for configuring the VMM for a VM.
131 *
132 * This is called in the context of the VM process (VBoxC).
133 *
134 * @returns VBox status code.
135 * @param pThis Pointer to this structure.
136 * @param pVM The VM handle.
137 * @param pConsole The console interface.
138 */
139 DECLCALLBACKMEMBER(int, pfnVMConfigureVMM)(PCVBOXEXTPACKREG pThis, PVM pVM, IConsole *pConsole);
140
141 /**
142 * Hook for doing work right before powering on the VM.
143 *
144 * This is called in the context of the VM process (VBoxC).
145 *
146 * @returns VBox status code.
147 * @param pThis Pointer to this structure.
148 * @param pVM The VM handle.
149 * @param pConsole The console interface.
150 */
151 DECLCALLBACKMEMBER(int, pfnVMPowerOn)(PCVBOXEXTPACKREG pThis, PVM pVM, IConsole *pConsole);
152
153 /**
154 * Hook for doing work after powering on the VM.
155 *
156 * This is called in the context of the VM process (VBoxC).
157 *
158 * @returns VBox status code.
159 * @param pThis Pointer to this structure.
160 * @param pVM The VM handle. Can be NULL.
161 * @param pConsole The console interface.
162 */
163 DECLCALLBACKMEMBER(int, pfnVMPowerOff)(PCVBOXEXTPACKREG pThis, PVM pVM, IConsole *pConsole);
164
165 /** End of structure marker (VBOXEXTPACKREG_VERSION). */
166 uint32_t u32EndMarker;
167} VBOXEXTPACKREG;
168/** Current version of the VBOXEXTPACKREG structure. */
169#define VBOXEXTPACKREG_VERSION RT_MAKE_U32(1, 0)
170
171
172/**
173 * The VBoxExtPackRegister callback function.
174 *
175 * PDM will invoke this function after loading a driver module and letting
176 * the module decide which drivers to register and how to handle conflicts.
177 *
178 * @returns VBox status code.
179 * @param pHlp Pointer to the extension pack helper function
180 * table. This is valid until the module is unloaded.
181 * @param ppReg Where to return the pointer to the registration
182 * structure containing all the hooks. This structure
183 * be valid and unchanged until the module is unloaded
184 * (i.e. use some static const data for it).
185 * @param pszErr Error message buffer for explaining any failure.
186 * @param cbErr The size of the error message buffer.
187 */
188typedef DECLCALLBACK(int) FNVBOXEXTPACKREGISTER(PCVBOXEXTPACKHLP pHlp, PCVBOXEXTPACKREG *ppReg, char *pszErr, size_t cbErr);
189/** Pointer to a FNVBOXEXTPACKREGISTER. */
190typedef FNVBOXEXTPACKREGISTER *PFNVBOXEXTPACKREGISTER;
191
192/** The name of the main module entry point. */
193#define VBOX_EXTPACK_MAIN_MOD_ENTRY_POINT "VBoxExtPackRegister"
194
195
196#endif
197
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