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