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 as published by the Free Software Foundation,
|
---|
13 | * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
14 | * distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
15 | * 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(SaveState) (IProgress **aProgress);
|
---|
129 | STDMETHOD(AdoptSavedState) (INPTR BSTR aSavedStateFile);
|
---|
130 | STDMETHOD(DiscardSavedState)();
|
---|
131 | STDMETHOD(GetDeviceActivity) (DeviceType_T aDeviceType,
|
---|
132 | DeviceActivity_T *aDeviceActivity);
|
---|
133 | STDMETHOD(AttachUSBDevice) (INPTR GUIDPARAM aId);
|
---|
134 | STDMETHOD(DetachUSBDevice) (INPTR GUIDPARAM aId, IUSBDevice **aDevice);
|
---|
135 | STDMETHOD(CreateSharedFolder) (INPTR BSTR aName, INPTR BSTR aHostPath);
|
---|
136 | STDMETHOD(RemoveSharedFolder) (INPTR BSTR aName);
|
---|
137 | STDMETHOD(TakeSnapshot) (INPTR BSTR aName, INPTR BSTR aDescription,
|
---|
138 | IProgress **aProgress);
|
---|
139 | STDMETHOD(DiscardSnapshot) (INPTR GUIDPARAM aId, IProgress **aProgress);
|
---|
140 | STDMETHOD(DiscardCurrentState) (IProgress **aProgress);
|
---|
141 | STDMETHOD(DiscardCurrentSnapshotAndState) (IProgress **aProgress);
|
---|
142 | STDMETHOD(RegisterCallback) (IConsoleCallback *aCallback);
|
---|
143 | STDMETHOD(UnregisterCallback)(IConsoleCallback *aCallback);
|
---|
144 |
|
---|
145 | // public methods for internal purposes only
|
---|
146 |
|
---|
147 | /*
|
---|
148 | * Note: the following methods do not increase refcount. intended to be
|
---|
149 | * called only by the VM execution thread.
|
---|
150 | */
|
---|
151 |
|
---|
152 | Guest *getGuest() { return mGuest; }
|
---|
153 | Keyboard *getKeyboard() { return mKeyboard; }
|
---|
154 | Mouse *getMouse() { return mMouse; }
|
---|
155 | Display *getDisplay() { return mDisplay; }
|
---|
156 | MachineDebugger *getMachineDebugger() { return mDebugger; }
|
---|
157 |
|
---|
158 | const ComPtr <IMachine> &machine() { return mMachine; }
|
---|
159 |
|
---|
160 | /** Method is called only from ConsoleVRDPServer */
|
---|
161 | IVRDPServer *getVRDPServer() { return mVRDPServer; }
|
---|
162 |
|
---|
163 | ConsoleVRDPServer *consoleVRDPServer() { return mConsoleVRDPServer; }
|
---|
164 |
|
---|
165 | HRESULT updateMachineState (MachineState_T aMachineState);
|
---|
166 |
|
---|
167 | // events from IInternalSessionControl
|
---|
168 | HRESULT onDVDDriveChange();
|
---|
169 | HRESULT onFloppyDriveChange();
|
---|
170 | HRESULT onNetworkAdapterChange (INetworkAdapter *aNetworkAdapter);
|
---|
171 | HRESULT onSerialPortChange (ISerialPort *aSerialPort);
|
---|
172 | HRESULT onParallelPortChange (IParallelPort *aParallelPort);
|
---|
173 | HRESULT onVRDPServerChange();
|
---|
174 | HRESULT onUSBControllerChange();
|
---|
175 | HRESULT onSharedFolderChange (BOOL aGlobal);
|
---|
176 | HRESULT onUSBDeviceAttach (IUSBDevice *aDevice, IVirtualBoxErrorInfo *aError);
|
---|
177 | HRESULT onUSBDeviceDetach (INPTR GUIDPARAM aId, IVirtualBoxErrorInfo *aError);
|
---|
178 |
|
---|
179 | VMMDev *getVMMDev() { return mVMMDev; }
|
---|
180 | AudioSniffer *getAudioSniffer () { return mAudioSniffer; }
|
---|
181 |
|
---|
182 | #ifdef VRDP_NO_COM
|
---|
183 | int VRDPClientLogon (uint32_t u32ClientId, const char *pszUser, const char *pszPassword, const char *pszDomain);
|
---|
184 | void VRDPClientConnect (uint32_t u32ClientId);
|
---|
185 | void VRDPClientDisconnect (uint32_t u32ClientId, uint32_t fu32Intercepted);
|
---|
186 | void VRDPInterceptAudio (uint32_t u32ClientId);
|
---|
187 | void VRDPInterceptUSB (uint32_t u32ClientId, void **ppvIntercept);
|
---|
188 | void VRDPInterceptClipboard (uint32_t u32ClientId);
|
---|
189 | #else
|
---|
190 | static VRDPSERVERCALLBACK *getVrdpServerCallback () { return &sVrdpServerCallback; };
|
---|
191 | #endif /* VRDP_NO_COM */
|
---|
192 |
|
---|
193 | void processRemoteUSBDevices (uint32_t u32ClientId, VRDPUSBDEVICEDESC *pDevList, uint32_t cbDevList);
|
---|
194 |
|
---|
195 | // callback callers (partly; for some events console callbacks are notified
|
---|
196 | // directly from IInternalSessionControl event handlers declared above)
|
---|
197 | void onMousePointerShapeChange(bool fVisible, bool fAlpha,
|
---|
198 | uint32_t xHot, uint32_t yHot,
|
---|
199 | uint32_t width, uint32_t height,
|
---|
200 | void *pShape);
|
---|
201 | void onMouseCapabilityChange (BOOL supportsAbsolute, BOOL needsHostCursor);
|
---|
202 | void onStateChange (MachineState_T aMachineState);
|
---|
203 | void onAdditionsStateChange();
|
---|
204 | void onAdditionsOutdated();
|
---|
205 | void onKeyboardLedsChange (bool fNumLock, bool fCapsLock, bool fScrollLock);
|
---|
206 | void onUSBDeviceStateChange (IUSBDevice *aDevice, bool aAttached,
|
---|
207 | IVirtualBoxErrorInfo *aError);
|
---|
208 | void onRuntimeError (BOOL aFatal, INPTR BSTR aErrorID, INPTR BSTR aMessage);
|
---|
209 | HRESULT onShowWindow (BOOL aCheck, BOOL *aCanShow, ULONG64 *aWinId);
|
---|
210 |
|
---|
211 | static const PDMDRVREG DrvStatusReg;
|
---|
212 |
|
---|
213 | void reportAuthLibraryError (const char *filename, int rc)
|
---|
214 | {
|
---|
215 | setError (E_FAIL, tr("Could not load the external authentication library '%s' (%Vrc)"), filename, rc);
|
---|
216 | }
|
---|
217 |
|
---|
218 | // for VirtualBoxSupportErrorInfoImpl
|
---|
219 | static const wchar_t *getComponentName() { return L"Console"; }
|
---|
220 |
|
---|
221 | private:
|
---|
222 |
|
---|
223 | /**
|
---|
224 | * Base template for AutoVMCaller and SaveVMPtr. Template arguments
|
---|
225 | * have the same meaning as arguments of Console::addVMCaller().
|
---|
226 | */
|
---|
227 | template <bool taQuiet = false, bool taAllowNullVM = false>
|
---|
228 | class AutoVMCallerBase
|
---|
229 | {
|
---|
230 | public:
|
---|
231 | AutoVMCallerBase (Console *aThat) : mThat (aThat), mRC (S_OK)
|
---|
232 | {
|
---|
233 | Assert (aThat);
|
---|
234 | mRC = aThat->addVMCaller (taQuiet, taAllowNullVM);
|
---|
235 | }
|
---|
236 | ~AutoVMCallerBase()
|
---|
237 | {
|
---|
238 | if (SUCCEEDED (mRC))
|
---|
239 | mThat->releaseVMCaller();
|
---|
240 | }
|
---|
241 | /** Decreases the number of callers before the instance is destroyed. */
|
---|
242 | void release()
|
---|
243 | {
|
---|
244 | AssertReturnVoid (SUCCEEDED (mRC));
|
---|
245 | mThat->releaseVMCaller();
|
---|
246 | mRC = E_FAIL;
|
---|
247 | }
|
---|
248 | /** Restores the number of callers after by #release(). #rc() must be
|
---|
249 | * rechecked to ensure the operation succeeded. */
|
---|
250 | void add()
|
---|
251 | {
|
---|
252 | AssertReturnVoid (!SUCCEEDED (mRC));
|
---|
253 | mRC = mThat->addVMCaller (taQuiet, taAllowNullVM);
|
---|
254 | }
|
---|
255 | /** Returns the result of Console::addVMCaller() */
|
---|
256 | HRESULT rc() const { return mRC; }
|
---|
257 | /** Shortcut to SUCCEEDED (rc()) */
|
---|
258 | bool isOk() const { return SUCCEEDED (mRC); }
|
---|
259 | protected:
|
---|
260 | Console *mThat;
|
---|
261 | HRESULT mRC;
|
---|
262 | private:
|
---|
263 | DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP (AutoVMCallerBase)
|
---|
264 | DECLARE_CLS_NEW_DELETE_NOOP (AutoVMCallerBase)
|
---|
265 | };
|
---|
266 |
|
---|
267 | /**
|
---|
268 | * Helper class that protects sections of code using the mpVM pointer by
|
---|
269 | * automatically calling addVMCaller() on construction and
|
---|
270 | * releaseVMCaller() on destruction. Intended for Console methods dealing
|
---|
271 | * with mpVM. The usage pattern is:
|
---|
272 | * <code>
|
---|
273 | * AutoVMCaller autoVMCaller (this);
|
---|
274 | * CheckComRCReturnRC (autoVMCaller.rc());
|
---|
275 | * ...
|
---|
276 | * VMR3ReqCall (mpVM, ...
|
---|
277 | * </code>
|
---|
278 | *
|
---|
279 | * @sa SafeVMPtr, SafeVMPtrQuiet
|
---|
280 | */
|
---|
281 | typedef AutoVMCallerBase <false, false> AutoVMCaller;
|
---|
282 |
|
---|
283 | /**
|
---|
284 | * Same as AutoVMCaller but doesn't set extended error info on failure.
|
---|
285 | */
|
---|
286 | typedef AutoVMCallerBase <true, false> AutoVMCallerQuiet;
|
---|
287 |
|
---|
288 | /**
|
---|
289 | * Same as AutoVMCaller but allows a null VM pointer (to trigger an error
|
---|
290 | * instead of assertion).
|
---|
291 | */
|
---|
292 | typedef AutoVMCallerBase <false, true> AutoVMCallerWeak;
|
---|
293 |
|
---|
294 | /**
|
---|
295 | * Same as AutoVMCaller but doesn't set extended error info on failure
|
---|
296 | * and allows a null VM pointer (to trigger an error instead of
|
---|
297 | * assertion).
|
---|
298 | */
|
---|
299 | typedef AutoVMCallerBase <true, true> AutoVMCallerQuietWeak;
|
---|
300 |
|
---|
301 | /**
|
---|
302 | * Base template for SaveVMPtr and SaveVMPtrQuiet.
|
---|
303 | */
|
---|
304 | template <bool taQuiet = false>
|
---|
305 | class SafeVMPtrBase : public AutoVMCallerBase <taQuiet, true>
|
---|
306 | {
|
---|
307 | typedef AutoVMCallerBase <taQuiet, true> Base;
|
---|
308 | public:
|
---|
309 | SafeVMPtrBase (Console *aThat) : Base (aThat), mpVM (NULL)
|
---|
310 | {
|
---|
311 | if (SUCCEEDED (Base::mRC))
|
---|
312 | mpVM = aThat->mpVM;
|
---|
313 | }
|
---|
314 | /** Smart SaveVMPtr to PVM cast operator */
|
---|
315 | operator PVM() const { return mpVM; }
|
---|
316 | /** Direct PVM access for printf()-like functions */
|
---|
317 | PVM raw() const { return mpVM; }
|
---|
318 | private:
|
---|
319 | PVM mpVM;
|
---|
320 | DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP (SafeVMPtrBase)
|
---|
321 | DECLARE_CLS_NEW_DELETE_NOOP (SafeVMPtrBase)
|
---|
322 | };
|
---|
323 |
|
---|
324 | public:
|
---|
325 |
|
---|
326 | /**
|
---|
327 | * Helper class that safely manages the Console::mpVM pointer
|
---|
328 | * by calling addVMCaller() on construction and releaseVMCaller() on
|
---|
329 | * destruction. Intended for Console children. The usage pattern is:
|
---|
330 | * <code>
|
---|
331 | * Console::SaveVMPtr pVM (mParent);
|
---|
332 | * CheckComRCReturnRC (pVM.rc());
|
---|
333 | * ...
|
---|
334 | * VMR3ReqCall (pVM, ...
|
---|
335 | * ...
|
---|
336 | * printf ("%p\n", pVM.raw());
|
---|
337 | * </code>
|
---|
338 | *
|
---|
339 | * @sa SafeVMPtrQuiet, AutoVMCaller
|
---|
340 | */
|
---|
341 | typedef SafeVMPtrBase <false> SafeVMPtr;
|
---|
342 |
|
---|
343 | /**
|
---|
344 | * A deviation of SaveVMPtr that doesn't set the error info on failure.
|
---|
345 | * Intenede for pieces of code that don't need to return the VM access
|
---|
346 | * failure to the caller. The usage pattern is:
|
---|
347 | * <code>
|
---|
348 | * Console::SaveVMPtrQuiet pVM (mParent);
|
---|
349 | * if (pVM.rc())
|
---|
350 | * VMR3ReqCall (pVM, ...
|
---|
351 | * return S_OK;
|
---|
352 | * </code>
|
---|
353 | *
|
---|
354 | * @sa SafeVMPtr, AutoVMCaller
|
---|
355 | */
|
---|
356 | typedef SafeVMPtrBase <true> SafeVMPtrQuiet;
|
---|
357 |
|
---|
358 | typedef std::map <Bstr, ComObjPtr <SharedFolder> > SharedFolderMap;
|
---|
359 | typedef std::map <Bstr, Bstr> SharedFolderDataMap;
|
---|
360 |
|
---|
361 | private:
|
---|
362 |
|
---|
363 | typedef std::list <ComObjPtr <OUSBDevice> > USBDeviceList;
|
---|
364 | typedef std::list <ComObjPtr <RemoteUSBDevice> > RemoteUSBDeviceList;
|
---|
365 |
|
---|
366 | HRESULT addVMCaller (bool aQuiet = false, bool aAllowNullVM = false);
|
---|
367 | void releaseVMCaller();
|
---|
368 |
|
---|
369 | HRESULT powerDown();
|
---|
370 |
|
---|
371 | HRESULT callTapSetupApplication(bool isStatic, RTFILE tapFD, Bstr &tapDevice,
|
---|
372 | Bstr &tapSetupApplication);
|
---|
373 | HRESULT attachToHostInterface(INetworkAdapter *networkAdapter);
|
---|
374 | HRESULT detachFromHostInterface(INetworkAdapter *networkAdapter);
|
---|
375 | HRESULT powerDownHostInterfaces();
|
---|
376 |
|
---|
377 | HRESULT setMachineState (MachineState_T aMachineState, bool aUpdateServer = true);
|
---|
378 | HRESULT setMachineStateLocally (MachineState_T aMachineState)
|
---|
379 | {
|
---|
380 | return setMachineState (aMachineState, false /* aUpdateServer */);
|
---|
381 | }
|
---|
382 |
|
---|
383 | HRESULT findSharedFolder (const BSTR aName,
|
---|
384 | ComObjPtr <SharedFolder> &aSharedFolder,
|
---|
385 | bool aSetError = false);
|
---|
386 |
|
---|
387 | HRESULT fetchSharedFolders (BOOL aGlobal);
|
---|
388 | bool findOtherSharedFolder (INPTR BSTR aName,
|
---|
389 | SharedFolderDataMap::const_iterator &aIt);
|
---|
390 |
|
---|
391 | HRESULT createSharedFolder (INPTR BSTR aName, INPTR BSTR aHostPath);
|
---|
392 | HRESULT removeSharedFolder (INPTR BSTR aName);
|
---|
393 |
|
---|
394 | static DECLCALLBACK(int) configConstructor(PVM pVM, void *pvConsole);
|
---|
395 | static DECLCALLBACK(void) vmstateChangeCallback(PVM aVM, VMSTATE aState,
|
---|
396 | VMSTATE aOldState, void *aUser);
|
---|
397 | HRESULT doDriveChange (const char *pszDevice, unsigned uInstance,
|
---|
398 | unsigned uLun, DriveState_T eState,
|
---|
399 | DriveState_T *peState, const char *pszPath,
|
---|
400 | bool fPassthrough);
|
---|
401 | static DECLCALLBACK(int) changeDrive (Console *pThis, const char *pszDevice,
|
---|
402 | unsigned uInstance, unsigned uLun,
|
---|
403 | DriveState_T eState, DriveState_T *peState,
|
---|
404 | const char *pszPath, bool fPassthrough);
|
---|
405 |
|
---|
406 | #ifndef VBOX_WITH_PDMUSB
|
---|
407 | HRESULT attachUSBDevice (IUSBDevice *aHostDevice, PVUSBIRHCONFIG aConfig);
|
---|
408 | HRESULT detachUSBDevice (USBDeviceList::iterator &aIt);
|
---|
409 |
|
---|
410 | static DECLCALLBACK(int)
|
---|
411 | usbAttachCallback (Console *that, IUSBDevice *aHostDevice,
|
---|
412 | PVUSBIRHCONFIG aConfig, PCRTUUID aUuid, bool aRemote,
|
---|
413 | const char *aAddress, void *aRemoteBackend);
|
---|
414 | static DECLCALLBACK(int)
|
---|
415 | usbDetachCallback (Console *that, USBDeviceList::iterator *aIt,
|
---|
416 | PVUSBIRHCONFIG aConfig, PCRTUUID aUuid);
|
---|
417 | #else /* PDMUsb coding. */
|
---|
418 | HRESULT attachUSBDevice (IUSBDevice *aHostDevice);
|
---|
419 | HRESULT detachUSBDevice (USBDeviceList::iterator &aIt);
|
---|
420 |
|
---|
421 | static DECLCALLBACK(int)
|
---|
422 | usbAttachCallback (Console *that, IUSBDevice *aHostDevice, PCRTUUID aUuid,
|
---|
423 | bool aRemote, const char *aAddress);
|
---|
424 | static DECLCALLBACK(int)
|
---|
425 | usbDetachCallback (Console *that, USBDeviceList::iterator *aIt, PCRTUUID aUuid);
|
---|
426 | #endif /* PDMUsb coding. */
|
---|
427 |
|
---|
428 | static DECLCALLBACK (int)
|
---|
429 | stateProgressCallback (PVM pVM, unsigned uPercent, void *pvUser);
|
---|
430 |
|
---|
431 | static DECLCALLBACK(void)
|
---|
432 | setVMErrorCallback (PVM pVM, void *pvUser, int rc, RT_SRC_POS_DECL,
|
---|
433 | const char *pszFormat, va_list args);
|
---|
434 |
|
---|
435 | static DECLCALLBACK(void)
|
---|
436 | setVMRuntimeErrorCallback (PVM pVM, void *pvUser, bool fFatal,
|
---|
437 | const char *pszErrorID,
|
---|
438 | const char *pszFormat, va_list args);
|
---|
439 |
|
---|
440 | HRESULT captureUSBDevices (PVM pVM);
|
---|
441 | void detachAllUSBDevices (bool aDone);
|
---|
442 |
|
---|
443 | static DECLCALLBACK (int) powerUpThread (RTTHREAD Thread, void *pvUser);
|
---|
444 | static DECLCALLBACK (int) saveStateThread (RTTHREAD Thread, void *pvUser);
|
---|
445 | static DECLCALLBACK (int) powerDownThread (RTTHREAD Thread, void *pvUser);
|
---|
446 |
|
---|
447 | static DECLCALLBACK(void *) drvStatus_QueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface);
|
---|
448 | static DECLCALLBACK(void) drvStatus_UnitChanged(PPDMILEDCONNECTORS pInterface, unsigned iLUN);
|
---|
449 | static DECLCALLBACK(void) drvStatus_Destruct(PPDMDRVINS pDrvIns);
|
---|
450 | static DECLCALLBACK(int) drvStatus_Construct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle);
|
---|
451 |
|
---|
452 | int mcAudioRefs;
|
---|
453 | volatile uint32_t mcVRDPClients;
|
---|
454 |
|
---|
455 | #ifdef VRDP_NO_COM
|
---|
456 | #else
|
---|
457 | static DECLCALLBACK(int) vrdp_ClientLogon (void *pvUser, uint32_t u32ClientId, const char *pszUser, const char *pszPassword, const char *pszDomain);
|
---|
458 | static DECLCALLBACK(void) vrdp_ClientConnect (void *pvUser, uint32_t u32ClientId);
|
---|
459 | static DECLCALLBACK(void) vrdp_ClientDisconnect (void *pvUser, uint32_t u32ClientId, uint32_t fu32Intercepted);
|
---|
460 | static DECLCALLBACK(void) vrdp_InterceptAudio (void *pvUser, uint32_t u32ClientId);
|
---|
461 | static DECLCALLBACK(void) vrdp_InterceptUSB (void *pvUser, uint32_t u32ClientId, PFNVRDPUSBCALLBACK *ppfn, void **ppv);
|
---|
462 | static DECLCALLBACK(void) vrdp_InterceptClipboard (void *pvUser, uint32_t u32ClientId, PFNVRDPCLIPBOARDCALLBACK *ppfn, void **ppv);
|
---|
463 |
|
---|
464 | static VRDPSERVERCALLBACK sVrdpServerCallback;
|
---|
465 | #endif /* VRDP_NO_COM */
|
---|
466 |
|
---|
467 | static const char *sSSMConsoleUnit;
|
---|
468 | static uint32_t sSSMConsoleVer;
|
---|
469 |
|
---|
470 | HRESULT loadDataFromSavedState();
|
---|
471 |
|
---|
472 | static DECLCALLBACK(void) saveStateFileExec (PSSMHANDLE pSSM, void *pvUser);
|
---|
473 | static DECLCALLBACK(int) loadStateFileExec (PSSMHANDLE pSSM, void *pvUser, uint32_t u32Version);
|
---|
474 |
|
---|
475 | bool mSavedStateDataLoaded : 1;
|
---|
476 |
|
---|
477 | const ComPtr <IMachine> mMachine;
|
---|
478 | const ComPtr <IInternalMachineControl> mControl;
|
---|
479 |
|
---|
480 | const ComPtr <IVRDPServer> mVRDPServer;
|
---|
481 | const ComPtr <IDVDDrive> mDVDDrive;
|
---|
482 | const ComPtr <IFloppyDrive> mFloppyDrive;
|
---|
483 |
|
---|
484 | ConsoleVRDPServer * const mConsoleVRDPServer;
|
---|
485 |
|
---|
486 | const ComObjPtr <Guest> mGuest;
|
---|
487 | const ComObjPtr <Keyboard> mKeyboard;
|
---|
488 | const ComObjPtr <Mouse> mMouse;
|
---|
489 | const ComObjPtr <Display> mDisplay;
|
---|
490 | const ComObjPtr <MachineDebugger> mDebugger;
|
---|
491 | const ComObjPtr <RemoteDisplayInfo> mRemoteDisplayInfo;
|
---|
492 |
|
---|
493 | USBDeviceList mUSBDevices;
|
---|
494 | RemoteUSBDeviceList mRemoteUSBDevices;
|
---|
495 |
|
---|
496 | SharedFolderMap mSharedFolders;
|
---|
497 | SharedFolderDataMap mMachineSharedFolders;
|
---|
498 | SharedFolderDataMap mGlobalSharedFolders;
|
---|
499 |
|
---|
500 | /** The VM instance handle. */
|
---|
501 | PVM mpVM;
|
---|
502 | /** Holds the number of "readonly" mpVM callers (users) */
|
---|
503 | uint32_t mVMCallers;
|
---|
504 | /** Semaphore posted when the number of mpVM callers drops to zero */
|
---|
505 | RTSEMEVENT mVMZeroCallersSem;
|
---|
506 | /** true when Console has entered the mpVM destruction phase */
|
---|
507 | bool mVMDestroying : 1;
|
---|
508 |
|
---|
509 | /** The current DVD drive state in the VM.
|
---|
510 | * This does not have to match the state maintained in the DVD. */
|
---|
511 | DriveState_T meDVDState;
|
---|
512 | /** The current Floppy drive state in the VM.
|
---|
513 | * This does not have to match the state maintained in the Floppy. */
|
---|
514 | DriveState_T meFloppyState;
|
---|
515 |
|
---|
516 | VMMDev * const mVMMDev;
|
---|
517 | AudioSniffer * const mAudioSniffer;
|
---|
518 |
|
---|
519 | PPDMLED mapFDLeds[2];
|
---|
520 | PPDMLED mapIDELeds[4];
|
---|
521 | PPDMLED mapNetworkLeds[8];
|
---|
522 | PPDMLED mapSharedFolderLed;
|
---|
523 | PPDMLED mapUSBLed;
|
---|
524 | #ifdef VBOX_WITH_UNIXY_TAP_NETWORKING
|
---|
525 | Utf8Str maTAPDeviceName[8];
|
---|
526 | RTFILE maTapFD[8];
|
---|
527 | #endif
|
---|
528 |
|
---|
529 | bool mVMStateChangeCallbackDisabled;
|
---|
530 |
|
---|
531 | /* Local machine state value */
|
---|
532 | MachineState_T mMachineState;
|
---|
533 |
|
---|
534 | typedef std::list <ComPtr <IConsoleCallback> > CallbackList;
|
---|
535 | CallbackList mCallbacks;
|
---|
536 |
|
---|
537 | struct
|
---|
538 | {
|
---|
539 | /** OnMousePointerShapeChange() cache */
|
---|
540 | struct
|
---|
541 | {
|
---|
542 | bool valid;
|
---|
543 | bool visible;
|
---|
544 | bool alpha;
|
---|
545 | uint32_t xHot;
|
---|
546 | uint32_t yHot;
|
---|
547 | uint32_t width;
|
---|
548 | uint32_t height;
|
---|
549 | BYTE *shape;
|
---|
550 | size_t shapeSize;
|
---|
551 | }
|
---|
552 | mpsc;
|
---|
553 |
|
---|
554 | /** OnMouseCapabilityChange() cache */
|
---|
555 | struct
|
---|
556 | {
|
---|
557 | bool valid;
|
---|
558 | BOOL supportsAbsolute;
|
---|
559 | BOOL needsHostCursor;
|
---|
560 | }
|
---|
561 | mcc;
|
---|
562 |
|
---|
563 | /** OnKeyboardLedsChange() cache */
|
---|
564 | struct
|
---|
565 | {
|
---|
566 | bool valid;
|
---|
567 | bool numLock;
|
---|
568 | bool capsLock;
|
---|
569 | bool scrollLock;
|
---|
570 | }
|
---|
571 | klc;
|
---|
572 | }
|
---|
573 | mCallbackData;
|
---|
574 |
|
---|
575 | friend struct VMTask;
|
---|
576 | };
|
---|
577 |
|
---|
578 | #endif // ____H_CONSOLEIMPL
|
---|