1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox Console COM Class definition
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2007 innotek GmbH
|
---|
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 |
|
---|
18 | #ifndef ____H_CONSOLEIMPL
|
---|
19 | #define ____H_CONSOLEIMPL
|
---|
20 |
|
---|
21 | #include "VirtualBoxBase.h"
|
---|
22 | #include "ProgressImpl.h"
|
---|
23 |
|
---|
24 | class Guest;
|
---|
25 | class Keyboard;
|
---|
26 | class Mouse;
|
---|
27 | class Display;
|
---|
28 | class MachineDebugger;
|
---|
29 | class OUSBDevice;
|
---|
30 | class RemoteUSBDevice;
|
---|
31 | class SharedFolder;
|
---|
32 | class RemoteDisplayInfo;
|
---|
33 | class AudioSniffer;
|
---|
34 | class ConsoleVRDPServer;
|
---|
35 | class VMMDev;
|
---|
36 |
|
---|
37 | #include <VBox/vrdpapi.h>
|
---|
38 | #include <VBox/pdmdrv.h>
|
---|
39 |
|
---|
40 | struct VUSBIRHCONFIG;
|
---|
41 | typedef struct VUSBIRHCONFIG *PVUSBIRHCONFIG;
|
---|
42 |
|
---|
43 | #include <list>
|
---|
44 |
|
---|
45 | // defines
|
---|
46 | ///////////////////////////////////////////////////////////////////////////////
|
---|
47 |
|
---|
48 | /**
|
---|
49 | * Checks the availability of the underlying VM device driver corresponding
|
---|
50 | * to the COM interface (IKeyboard, IMouse, IDisplay, etc.). When the driver is
|
---|
51 | * not available (NULL), sets error info and returns returns E_ACCESSDENIED.
|
---|
52 | * The translatable error message is defined in null context.
|
---|
53 | *
|
---|
54 | * Intended to used only within Console children (i,e. Keyboard, Mouse,
|
---|
55 | * Display, etc.).
|
---|
56 | *
|
---|
57 | * @param drv driver pointer to check (compare it with NULL)
|
---|
58 | */
|
---|
59 | #define CHECK_CONSOLE_DRV(drv) \
|
---|
60 | do { \
|
---|
61 | if (!(drv)) \
|
---|
62 | return setError (E_ACCESSDENIED, tr ("The console is not powered up")); \
|
---|
63 | } while (0)
|
---|
64 |
|
---|
65 | /** @def VBOX_WITH_UNIXY_TAP_NETWORKING
|
---|
66 | * Unixy style TAP networking. This is defined in the Makefile since it's also
|
---|
67 | * used by NetworkAdapterImpl.h/cpp.
|
---|
68 | */
|
---|
69 | #ifdef __DOXYGEN__
|
---|
70 | # define VBOX_WITH_UNIXY_TAP_NETWORKING
|
---|
71 | #endif
|
---|
72 |
|
---|
73 | // Console
|
---|
74 | ///////////////////////////////////////////////////////////////////////////////
|
---|
75 |
|
---|
76 | /** IConsole implementation class */
|
---|
77 | class ATL_NO_VTABLE Console :
|
---|
78 | public VirtualBoxBaseWithChildrenNEXT,
|
---|
79 | public VirtualBoxSupportErrorInfoImpl <Console, IConsole>,
|
---|
80 | public VirtualBoxSupportTranslation <Console>,
|
---|
81 | public IConsole
|
---|
82 | {
|
---|
83 | Q_OBJECT
|
---|
84 |
|
---|
85 | public:
|
---|
86 |
|
---|
87 | DECLARE_NOT_AGGREGATABLE(Console)
|
---|
88 |
|
---|
89 | DECLARE_PROTECT_FINAL_CONSTRUCT()
|
---|
90 |
|
---|
91 | BEGIN_COM_MAP(Console)
|
---|
92 | COM_INTERFACE_ENTRY(ISupportErrorInfo)
|
---|
93 | COM_INTERFACE_ENTRY(IConsole)
|
---|
94 | END_COM_MAP()
|
---|
95 |
|
---|
96 | NS_DECL_ISUPPORTS
|
---|
97 |
|
---|
98 | Console();
|
---|
99 | ~Console();
|
---|
100 |
|
---|
101 | HRESULT FinalConstruct();
|
---|
102 | void FinalRelease();
|
---|
103 |
|
---|
104 | // public initializers/uninitializers for internal purposes only
|
---|
105 | HRESULT init (IMachine *aMachine, IInternalMachineControl *aControl);
|
---|
106 | void uninit();
|
---|
107 |
|
---|
108 | // IConsole properties
|
---|
109 | STDMETHOD(COMGETTER(Machine)) (IMachine **aMachine);
|
---|
110 | STDMETHOD(COMGETTER(State)) (MachineState_T *aMachineState);
|
---|
111 | STDMETHOD(COMGETTER(Guest)) (IGuest **aGuest);
|
---|
112 | STDMETHOD(COMGETTER(Keyboard)) (IKeyboard **aKeyboard);
|
---|
113 | STDMETHOD(COMGETTER(Mouse)) (IMouse **aMouse);
|
---|
114 | STDMETHOD(COMGETTER(Display)) (IDisplay **aDisplay);
|
---|
115 | STDMETHOD(COMGETTER(Debugger)) (IMachineDebugger **aDebugger);
|
---|
116 | STDMETHOD(COMGETTER(USBDevices)) (IUSBDeviceCollection **aUSBDevices);
|
---|
117 | STDMETHOD(COMGETTER(RemoteUSBDevices)) (IHostUSBDeviceCollection **aRemoteUSBDevices);
|
---|
118 | STDMETHOD(COMGETTER(RemoteDisplayInfo)) (IRemoteDisplayInfo **aRemoteDisplayInfo);
|
---|
119 | STDMETHOD(COMGETTER(SharedFolders)) (ISharedFolderCollection **aSharedFolders);
|
---|
120 |
|
---|
121 | // IConsole methods
|
---|
122 | STDMETHOD(PowerUp) (IProgress **aProgress);
|
---|
123 | STDMETHOD(PowerDown)();
|
---|
124 | STDMETHOD(Reset)();
|
---|
125 | STDMETHOD(Pause)();
|
---|
126 | STDMETHOD(Resume)();
|
---|
127 | STDMETHOD(PowerButton)();
|
---|
128 | STDMETHOD(SleepButton)();
|
---|
129 | STDMETHOD(GetPowerButtonHandled)(BOOL *aHandled);
|
---|
130 | STDMETHOD(SaveState) (IProgress **aProgress);
|
---|
131 | STDMETHOD(AdoptSavedState) (INPTR BSTR aSavedStateFile);
|
---|
132 | STDMETHOD(DiscardSavedState)();
|
---|
133 | STDMETHOD(GetDeviceActivity) (DeviceType_T aDeviceType,
|
---|
134 | DeviceActivity_T *aDeviceActivity);
|
---|
135 | STDMETHOD(AttachUSBDevice) (INPTR GUIDPARAM aId);
|
---|
136 | STDMETHOD(DetachUSBDevice) (INPTR GUIDPARAM aId, IUSBDevice **aDevice);
|
---|
137 | STDMETHOD(CreateSharedFolder) (INPTR BSTR aName, INPTR BSTR aHostPath, BOOL aWritable);
|
---|
138 | STDMETHOD(RemoveSharedFolder) (INPTR BSTR aName);
|
---|
139 | STDMETHOD(TakeSnapshot) (INPTR BSTR aName, INPTR BSTR aDescription,
|
---|
140 | IProgress **aProgress);
|
---|
141 | STDMETHOD(DiscardSnapshot) (INPTR GUIDPARAM aId, IProgress **aProgress);
|
---|
142 | STDMETHOD(DiscardCurrentState) (IProgress **aProgress);
|
---|
143 | STDMETHOD(DiscardCurrentSnapshotAndState) (IProgress **aProgress);
|
---|
144 | STDMETHOD(RegisterCallback) (IConsoleCallback *aCallback);
|
---|
145 | STDMETHOD(UnregisterCallback)(IConsoleCallback *aCallback);
|
---|
146 |
|
---|
147 | // public methods for internal purposes only
|
---|
148 |
|
---|
149 | /*
|
---|
150 | * Note: the following methods do not increase refcount. intended to be
|
---|
151 | * called only by the VM execution thread.
|
---|
152 | */
|
---|
153 |
|
---|
154 | Guest *getGuest() { return mGuest; }
|
---|
155 | Keyboard *getKeyboard() { return mKeyboard; }
|
---|
156 | Mouse *getMouse() { return mMouse; }
|
---|
157 | Display *getDisplay() { return mDisplay; }
|
---|
158 | MachineDebugger *getMachineDebugger() { return mDebugger; }
|
---|
159 |
|
---|
160 | const ComPtr <IMachine> &machine() { return mMachine; }
|
---|
161 |
|
---|
162 | /** Method is called only from ConsoleVRDPServer */
|
---|
163 | IVRDPServer *getVRDPServer() { return mVRDPServer; }
|
---|
164 |
|
---|
165 | ConsoleVRDPServer *consoleVRDPServer() { return mConsoleVRDPServer; }
|
---|
166 |
|
---|
167 | HRESULT updateMachineState (MachineState_T aMachineState);
|
---|
168 |
|
---|
169 | // events from IInternalSessionControl
|
---|
170 | HRESULT onDVDDriveChange();
|
---|
171 | HRESULT onFloppyDriveChange();
|
---|
172 | HRESULT onNetworkAdapterChange (INetworkAdapter *aNetworkAdapter);
|
---|
173 | HRESULT onSerialPortChange (ISerialPort *aSerialPort);
|
---|
174 | HRESULT onParallelPortChange (IParallelPort *aParallelPort);
|
---|
175 | HRESULT onVRDPServerChange();
|
---|
176 | HRESULT onUSBControllerChange();
|
---|
177 | HRESULT onSharedFolderChange (BOOL aGlobal);
|
---|
178 | HRESULT onUSBDeviceAttach (IUSBDevice *aDevice, IVirtualBoxErrorInfo *aError, ULONG aMaskedIfs);
|
---|
179 | HRESULT onUSBDeviceDetach (INPTR GUIDPARAM aId, IVirtualBoxErrorInfo *aError);
|
---|
180 |
|
---|
181 | VMMDev *getVMMDev() { return mVMMDev; }
|
---|
182 | AudioSniffer *getAudioSniffer () { return mAudioSniffer; }
|
---|
183 |
|
---|
184 | int VRDPClientLogon (uint32_t u32ClientId, const char *pszUser, const char *pszPassword, const char *pszDomain);
|
---|
185 | void VRDPClientConnect (uint32_t u32ClientId);
|
---|
186 | void VRDPClientDisconnect (uint32_t u32ClientId, uint32_t fu32Intercepted);
|
---|
187 | void VRDPInterceptAudio (uint32_t u32ClientId);
|
---|
188 | void VRDPInterceptUSB (uint32_t u32ClientId, void **ppvIntercept);
|
---|
189 | void VRDPInterceptClipboard (uint32_t u32ClientId);
|
---|
190 |
|
---|
191 | void processRemoteUSBDevices (uint32_t u32ClientId, VRDPUSBDEVICEDESC *pDevList, uint32_t cbDevList);
|
---|
192 |
|
---|
193 | // callback callers (partly; for some events console callbacks are notified
|
---|
194 | // directly from IInternalSessionControl event handlers declared above)
|
---|
195 | void onMousePointerShapeChange(bool fVisible, bool fAlpha,
|
---|
196 | uint32_t xHot, uint32_t yHot,
|
---|
197 | uint32_t width, uint32_t height,
|
---|
198 | void *pShape);
|
---|
199 | void onMouseCapabilityChange (BOOL supportsAbsolute, BOOL needsHostCursor);
|
---|
200 | void onStateChange (MachineState_T aMachineState);
|
---|
201 | void onAdditionsStateChange();
|
---|
202 | void onAdditionsOutdated();
|
---|
203 | void onKeyboardLedsChange (bool fNumLock, bool fCapsLock, bool fScrollLock);
|
---|
204 | void onUSBDeviceStateChange (IUSBDevice *aDevice, bool aAttached,
|
---|
205 | IVirtualBoxErrorInfo *aError);
|
---|
206 | void onRuntimeError (BOOL aFatal, INPTR BSTR aErrorID, INPTR BSTR aMessage);
|
---|
207 | HRESULT onShowWindow (BOOL aCheck, BOOL *aCanShow, ULONG64 *aWinId);
|
---|
208 |
|
---|
209 | static const PDMDRVREG DrvStatusReg;
|
---|
210 |
|
---|
211 | void reportAuthLibraryError (const char *filename, int rc)
|
---|
212 | {
|
---|
213 | setError (E_FAIL, tr("Could not load the external authentication library '%s' (%Vrc)"), filename, rc);
|
---|
214 | }
|
---|
215 |
|
---|
216 | // for VirtualBoxSupportErrorInfoImpl
|
---|
217 | static const wchar_t *getComponentName() { return L"Console"; }
|
---|
218 |
|
---|
219 | private:
|
---|
220 |
|
---|
221 | /**
|
---|
222 | * Base template for AutoVMCaller and SaveVMPtr. Template arguments
|
---|
223 | * have the same meaning as arguments of Console::addVMCaller().
|
---|
224 | */
|
---|
225 | template <bool taQuiet = false, bool taAllowNullVM = false>
|
---|
226 | class AutoVMCallerBase
|
---|
227 | {
|
---|
228 | public:
|
---|
229 | AutoVMCallerBase (Console *aThat) : mThat (aThat), mRC (S_OK)
|
---|
230 | {
|
---|
231 | Assert (aThat);
|
---|
232 | mRC = aThat->addVMCaller (taQuiet, taAllowNullVM);
|
---|
233 | }
|
---|
234 | ~AutoVMCallerBase()
|
---|
235 | {
|
---|
236 | if (SUCCEEDED (mRC))
|
---|
237 | mThat->releaseVMCaller();
|
---|
238 | }
|
---|
239 | /** Decreases the number of callers before the instance is destroyed. */
|
---|
240 | void release()
|
---|
241 | {
|
---|
242 | AssertReturnVoid (SUCCEEDED (mRC));
|
---|
243 | mThat->releaseVMCaller();
|
---|
244 | mRC = E_FAIL;
|
---|
245 | }
|
---|
246 | /** Restores the number of callers after by #release(). #rc() must be
|
---|
247 | * rechecked to ensure the operation succeeded. */
|
---|
248 | void add()
|
---|
249 | {
|
---|
250 | AssertReturnVoid (!SUCCEEDED (mRC));
|
---|
251 | mRC = mThat->addVMCaller (taQuiet, taAllowNullVM);
|
---|
252 | }
|
---|
253 | /** Returns the result of Console::addVMCaller() */
|
---|
254 | HRESULT rc() const { return mRC; }
|
---|
255 | /** Shortcut to SUCCEEDED (rc()) */
|
---|
256 | bool isOk() const { return SUCCEEDED (mRC); }
|
---|
257 | protected:
|
---|
258 | Console *mThat;
|
---|
259 | HRESULT mRC;
|
---|
260 | private:
|
---|
261 | DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP (AutoVMCallerBase)
|
---|
262 | DECLARE_CLS_NEW_DELETE_NOOP (AutoVMCallerBase)
|
---|
263 | };
|
---|
264 |
|
---|
265 | /**
|
---|
266 | * Helper class that protects sections of code using the mpVM pointer by
|
---|
267 | * automatically calling addVMCaller() on construction and
|
---|
268 | * releaseVMCaller() on destruction. Intended for Console methods dealing
|
---|
269 | * with mpVM. The usage pattern is:
|
---|
270 | * <code>
|
---|
271 | * AutoVMCaller autoVMCaller (this);
|
---|
272 | * CheckComRCReturnRC (autoVMCaller.rc());
|
---|
273 | * ...
|
---|
274 | * VMR3ReqCall (mpVM, ...
|
---|
275 | * </code>
|
---|
276 | *
|
---|
277 | * @sa SafeVMPtr, SafeVMPtrQuiet
|
---|
278 | */
|
---|
279 | typedef AutoVMCallerBase <false, false> AutoVMCaller;
|
---|
280 |
|
---|
281 | /**
|
---|
282 | * Same as AutoVMCaller but doesn't set extended error info on failure.
|
---|
283 | */
|
---|
284 | typedef AutoVMCallerBase <true, false> AutoVMCallerQuiet;
|
---|
285 |
|
---|
286 | /**
|
---|
287 | * Same as AutoVMCaller but allows a null VM pointer (to trigger an error
|
---|
288 | * instead of assertion).
|
---|
289 | */
|
---|
290 | typedef AutoVMCallerBase <false, true> AutoVMCallerWeak;
|
---|
291 |
|
---|
292 | /**
|
---|
293 | * Same as AutoVMCaller but doesn't set extended error info on failure
|
---|
294 | * and allows a null VM pointer (to trigger an error instead of
|
---|
295 | * assertion).
|
---|
296 | */
|
---|
297 | typedef AutoVMCallerBase <true, true> AutoVMCallerQuietWeak;
|
---|
298 |
|
---|
299 | /**
|
---|
300 | * Base template for SaveVMPtr and SaveVMPtrQuiet.
|
---|
301 | */
|
---|
302 | template <bool taQuiet = false>
|
---|
303 | class SafeVMPtrBase : public AutoVMCallerBase <taQuiet, true>
|
---|
304 | {
|
---|
305 | typedef AutoVMCallerBase <taQuiet, true> Base;
|
---|
306 | public:
|
---|
307 | SafeVMPtrBase (Console *aThat) : Base (aThat), mpVM (NULL)
|
---|
308 | {
|
---|
309 | if (SUCCEEDED (Base::mRC))
|
---|
310 | mpVM = aThat->mpVM;
|
---|
311 | }
|
---|
312 | /** Smart SaveVMPtr to PVM cast operator */
|
---|
313 | operator PVM() const { return mpVM; }
|
---|
314 | /** Direct PVM access for printf()-like functions */
|
---|
315 | PVM raw() const { return mpVM; }
|
---|
316 | private:
|
---|
317 | PVM mpVM;
|
---|
318 | DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP (SafeVMPtrBase)
|
---|
319 | DECLARE_CLS_NEW_DELETE_NOOP (SafeVMPtrBase)
|
---|
320 | };
|
---|
321 |
|
---|
322 | public:
|
---|
323 |
|
---|
324 | /**
|
---|
325 | * Helper class that safely manages the Console::mpVM pointer
|
---|
326 | * by calling addVMCaller() on construction and releaseVMCaller() on
|
---|
327 | * destruction. Intended for Console children. The usage pattern is:
|
---|
328 | * <code>
|
---|
329 | * Console::SaveVMPtr pVM (mParent);
|
---|
330 | * CheckComRCReturnRC (pVM.rc());
|
---|
331 | * ...
|
---|
332 | * VMR3ReqCall (pVM, ...
|
---|
333 | * ...
|
---|
334 | * printf ("%p\n", pVM.raw());
|
---|
335 | * </code>
|
---|
336 | *
|
---|
337 | * @sa SafeVMPtrQuiet, AutoVMCaller
|
---|
338 | */
|
---|
339 | typedef SafeVMPtrBase <false> SafeVMPtr;
|
---|
340 |
|
---|
341 | /**
|
---|
342 | * A deviation of SaveVMPtr that doesn't set the error info on failure.
|
---|
343 | * Intenede for pieces of code that don't need to return the VM access
|
---|
344 | * failure to the caller. The usage pattern is:
|
---|
345 | * <code>
|
---|
346 | * Console::SaveVMPtrQuiet pVM (mParent);
|
---|
347 | * if (pVM.rc())
|
---|
348 | * VMR3ReqCall (pVM, ...
|
---|
349 | * return S_OK;
|
---|
350 | * </code>
|
---|
351 | *
|
---|
352 | * @sa SafeVMPtr, AutoVMCaller
|
---|
353 | */
|
---|
354 | typedef SafeVMPtrBase <true> SafeVMPtrQuiet;
|
---|
355 |
|
---|
356 | class SharedFolderData
|
---|
357 | {
|
---|
358 | public:
|
---|
359 | SharedFolderData() {}
|
---|
360 | SharedFolderData(Bstr aHostPath, BOOL aWritable)
|
---|
361 | : mHostPath (aHostPath)
|
---|
362 | , mWritable (aWritable) {}
|
---|
363 | SharedFolderData(const SharedFolderData& aThat)
|
---|
364 | : mHostPath (aThat.mHostPath)
|
---|
365 | , mWritable (aThat.mWritable) {}
|
---|
366 | Bstr mHostPath;
|
---|
367 | BOOL mWritable;
|
---|
368 | };
|
---|
369 | typedef std::map <Bstr, ComObjPtr <SharedFolder> > SharedFolderMap;
|
---|
370 | typedef std::map <Bstr, SharedFolderData> SharedFolderDataMap;
|
---|
371 |
|
---|
372 | private:
|
---|
373 |
|
---|
374 | typedef std::list <ComObjPtr <OUSBDevice> > USBDeviceList;
|
---|
375 | typedef std::list <ComObjPtr <RemoteUSBDevice> > RemoteUSBDeviceList;
|
---|
376 |
|
---|
377 | HRESULT addVMCaller (bool aQuiet = false, bool aAllowNullVM = false);
|
---|
378 | void releaseVMCaller();
|
---|
379 |
|
---|
380 | HRESULT consoleInitReleaseLog (const ComPtr <IMachine> aMachine);
|
---|
381 |
|
---|
382 | HRESULT powerDown();
|
---|
383 |
|
---|
384 | HRESULT callTapSetupApplication(bool isStatic, RTFILE tapFD, Bstr &tapDevice,
|
---|
385 | Bstr &tapSetupApplication);
|
---|
386 | HRESULT attachToHostInterface(INetworkAdapter *networkAdapter);
|
---|
387 | HRESULT detachFromHostInterface(INetworkAdapter *networkAdapter);
|
---|
388 | HRESULT powerDownHostInterfaces();
|
---|
389 |
|
---|
390 | HRESULT setMachineState (MachineState_T aMachineState, bool aUpdateServer = true);
|
---|
391 | HRESULT setMachineStateLocally (MachineState_T aMachineState)
|
---|
392 | {
|
---|
393 | return setMachineState (aMachineState, false /* aUpdateServer */);
|
---|
394 | }
|
---|
395 |
|
---|
396 | HRESULT findSharedFolder (const BSTR aName,
|
---|
397 | ComObjPtr <SharedFolder> &aSharedFolder,
|
---|
398 | bool aSetError = false);
|
---|
399 |
|
---|
400 | HRESULT fetchSharedFolders (BOOL aGlobal);
|
---|
401 | bool findOtherSharedFolder (INPTR BSTR aName,
|
---|
402 | SharedFolderDataMap::const_iterator &aIt);
|
---|
403 |
|
---|
404 | HRESULT createSharedFolder (INPTR BSTR aName, SharedFolderData aData);
|
---|
405 | HRESULT removeSharedFolder (INPTR BSTR aName);
|
---|
406 |
|
---|
407 | static DECLCALLBACK(int) configConstructor(PVM pVM, void *pvConsole);
|
---|
408 | static DECLCALLBACK(void) vmstateChangeCallback(PVM aVM, VMSTATE aState,
|
---|
409 | VMSTATE aOldState, void *aUser);
|
---|
410 | HRESULT doDriveChange (const char *pszDevice, unsigned uInstance,
|
---|
411 | unsigned uLun, DriveState_T eState,
|
---|
412 | DriveState_T *peState, const char *pszPath,
|
---|
413 | bool fPassthrough);
|
---|
414 | static DECLCALLBACK(int) changeDrive (Console *pThis, const char *pszDevice,
|
---|
415 | unsigned uInstance, unsigned uLun,
|
---|
416 | DriveState_T eState, DriveState_T *peState,
|
---|
417 | const char *pszPath, bool fPassthrough);
|
---|
418 |
|
---|
419 | #ifdef VBOX_WITH_USB
|
---|
420 | HRESULT attachUSBDevice (IUSBDevice *aHostDevice, ULONG aMaskedIfs);
|
---|
421 | HRESULT detachUSBDevice (USBDeviceList::iterator &aIt);
|
---|
422 |
|
---|
423 | static DECLCALLBACK(int)
|
---|
424 | usbAttachCallback (Console *that, IUSBDevice *aHostDevice, PCRTUUID aUuid,
|
---|
425 | bool aRemote, const char *aAddress, ULONG aMaskedIfs);
|
---|
426 | static DECLCALLBACK(int)
|
---|
427 | usbDetachCallback (Console *that, USBDeviceList::iterator *aIt, PCRTUUID aUuid);
|
---|
428 | #endif
|
---|
429 |
|
---|
430 | static DECLCALLBACK (int)
|
---|
431 | stateProgressCallback (PVM pVM, unsigned uPercent, void *pvUser);
|
---|
432 |
|
---|
433 | static DECLCALLBACK(void)
|
---|
434 | setVMErrorCallback (PVM pVM, void *pvUser, int rc, RT_SRC_POS_DECL,
|
---|
435 | const char *pszFormat, va_list args);
|
---|
436 |
|
---|
437 | static DECLCALLBACK(void)
|
---|
438 | setVMRuntimeErrorCallback (PVM pVM, void *pvUser, bool fFatal,
|
---|
439 | const char *pszErrorID,
|
---|
440 | const char *pszFormat, va_list args);
|
---|
441 |
|
---|
442 | HRESULT captureUSBDevices (PVM pVM);
|
---|
443 | void detachAllUSBDevices (bool aDone);
|
---|
444 |
|
---|
445 | static DECLCALLBACK (int) powerUpThread (RTTHREAD Thread, void *pvUser);
|
---|
446 | static DECLCALLBACK (int) saveStateThread (RTTHREAD Thread, void *pvUser);
|
---|
447 | static DECLCALLBACK (int) powerDownThread (RTTHREAD Thread, void *pvUser);
|
---|
448 |
|
---|
449 | static DECLCALLBACK(void *) drvStatus_QueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface);
|
---|
450 | static DECLCALLBACK(void) drvStatus_UnitChanged(PPDMILEDCONNECTORS pInterface, unsigned iLUN);
|
---|
451 | static DECLCALLBACK(void) drvStatus_Destruct(PPDMDRVINS pDrvIns);
|
---|
452 | static DECLCALLBACK(int) drvStatus_Construct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle);
|
---|
453 |
|
---|
454 | int mcAudioRefs;
|
---|
455 | volatile uint32_t mcVRDPClients;
|
---|
456 |
|
---|
457 | static const char *sSSMConsoleUnit;
|
---|
458 | static uint32_t sSSMConsoleVer;
|
---|
459 |
|
---|
460 | HRESULT loadDataFromSavedState();
|
---|
461 |
|
---|
462 | static DECLCALLBACK(void) saveStateFileExec (PSSMHANDLE pSSM, void *pvUser);
|
---|
463 | static DECLCALLBACK(int) loadStateFileExec (PSSMHANDLE pSSM, void *pvUser, uint32_t u32Version);
|
---|
464 |
|
---|
465 | bool mSavedStateDataLoaded : 1;
|
---|
466 |
|
---|
467 | const ComPtr <IMachine> mMachine;
|
---|
468 | const ComPtr <IInternalMachineControl> mControl;
|
---|
469 |
|
---|
470 | const ComPtr <IVRDPServer> mVRDPServer;
|
---|
471 | const ComPtr <IDVDDrive> mDVDDrive;
|
---|
472 | const ComPtr <IFloppyDrive> mFloppyDrive;
|
---|
473 |
|
---|
474 | ConsoleVRDPServer * const mConsoleVRDPServer;
|
---|
475 |
|
---|
476 | const ComObjPtr <Guest> mGuest;
|
---|
477 | const ComObjPtr <Keyboard> mKeyboard;
|
---|
478 | const ComObjPtr <Mouse> mMouse;
|
---|
479 | const ComObjPtr <Display> mDisplay;
|
---|
480 | const ComObjPtr <MachineDebugger> mDebugger;
|
---|
481 | const ComObjPtr <RemoteDisplayInfo> mRemoteDisplayInfo;
|
---|
482 |
|
---|
483 | USBDeviceList mUSBDevices;
|
---|
484 | RemoteUSBDeviceList mRemoteUSBDevices;
|
---|
485 |
|
---|
486 | SharedFolderMap mSharedFolders;
|
---|
487 | SharedFolderDataMap mMachineSharedFolders;
|
---|
488 | SharedFolderDataMap mGlobalSharedFolders;
|
---|
489 |
|
---|
490 | /** The VM instance handle. */
|
---|
491 | PVM mpVM;
|
---|
492 | /** Holds the number of "readonly" mpVM callers (users) */
|
---|
493 | uint32_t mVMCallers;
|
---|
494 | /** Semaphore posted when the number of mpVM callers drops to zero */
|
---|
495 | RTSEMEVENT mVMZeroCallersSem;
|
---|
496 | /** true when Console has entered the mpVM destruction phase */
|
---|
497 | bool mVMDestroying : 1;
|
---|
498 |
|
---|
499 | /** The current DVD drive state in the VM.
|
---|
500 | * This does not have to match the state maintained in the DVD. */
|
---|
501 | DriveState_T meDVDState;
|
---|
502 | /** The current Floppy drive state in the VM.
|
---|
503 | * This does not have to match the state maintained in the Floppy. */
|
---|
504 | DriveState_T meFloppyState;
|
---|
505 |
|
---|
506 | VMMDev * const mVMMDev;
|
---|
507 | AudioSniffer * const mAudioSniffer;
|
---|
508 |
|
---|
509 | PPDMLED mapFDLeds[2];
|
---|
510 | PPDMLED mapIDELeds[4];
|
---|
511 | PPDMLED mapNetworkLeds[8];
|
---|
512 | PPDMLED mapSharedFolderLed;
|
---|
513 | PPDMLED mapUSBLed;
|
---|
514 | #ifdef VBOX_WITH_UNIXY_TAP_NETWORKING
|
---|
515 | Utf8Str maTAPDeviceName[8];
|
---|
516 | RTFILE maTapFD[8];
|
---|
517 | #endif
|
---|
518 |
|
---|
519 | bool mVMStateChangeCallbackDisabled;
|
---|
520 |
|
---|
521 | /* Local machine state value */
|
---|
522 | MachineState_T mMachineState;
|
---|
523 |
|
---|
524 | typedef std::list <ComPtr <IConsoleCallback> > CallbackList;
|
---|
525 | CallbackList mCallbacks;
|
---|
526 |
|
---|
527 | struct
|
---|
528 | {
|
---|
529 | /** OnMousePointerShapeChange() cache */
|
---|
530 | struct
|
---|
531 | {
|
---|
532 | bool valid;
|
---|
533 | bool visible;
|
---|
534 | bool alpha;
|
---|
535 | uint32_t xHot;
|
---|
536 | uint32_t yHot;
|
---|
537 | uint32_t width;
|
---|
538 | uint32_t height;
|
---|
539 | BYTE *shape;
|
---|
540 | size_t shapeSize;
|
---|
541 | }
|
---|
542 | mpsc;
|
---|
543 |
|
---|
544 | /** OnMouseCapabilityChange() cache */
|
---|
545 | struct
|
---|
546 | {
|
---|
547 | bool valid;
|
---|
548 | BOOL supportsAbsolute;
|
---|
549 | BOOL needsHostCursor;
|
---|
550 | }
|
---|
551 | mcc;
|
---|
552 |
|
---|
553 | /** OnKeyboardLedsChange() cache */
|
---|
554 | struct
|
---|
555 | {
|
---|
556 | bool valid;
|
---|
557 | bool numLock;
|
---|
558 | bool capsLock;
|
---|
559 | bool scrollLock;
|
---|
560 | }
|
---|
561 | klc;
|
---|
562 | }
|
---|
563 | mCallbackData;
|
---|
564 |
|
---|
565 | friend struct VMTask;
|
---|
566 | };
|
---|
567 |
|
---|
568 | #endif // ____H_CONSOLEIMPL
|
---|