Changeset 28727 in vbox for trunk/src/VBox/Main/include
- Timestamp:
- Apr 26, 2010 7:37:29 AM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 60601
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/ConsoleImpl.h
r27788 r28727 5 5 6 6 /* 7 * Copyright (C) 2006-20 09Sun Microsystems, Inc.7 * Copyright (C) 2006-2010 Sun Microsystems, Inc. 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 103 103 104 104 // public initializers/uninitializers for internal purposes only 105 HRESULT init 105 HRESULT init(IMachine *aMachine, IInternalMachineControl *aControl); 106 106 void uninit(); 107 107 108 108 // IConsole properties 109 STDMETHOD(COMGETTER(Machine)) 110 STDMETHOD(COMGETTER(State)) 111 STDMETHOD(COMGETTER(Guest)) 112 STDMETHOD(COMGETTER(Keyboard)) 113 STDMETHOD(COMGETTER(Mouse)) 114 STDMETHOD(COMGETTER(Display)) 115 STDMETHOD(COMGETTER(Debugger)) 116 STDMETHOD(COMGETTER(USBDevices)) (ComSafeArrayOut(IUSBDevice *, aUSBDevices));117 STDMETHOD(COMGETTER(RemoteUSBDevices)) (ComSafeArrayOut(IHostUSBDevice *, aRemoteUSBDevices));118 STDMETHOD(COMGETTER(RemoteDisplayInfo)) 119 STDMETHOD(COMGETTER(SharedFolders)) (ComSafeArrayOut(ISharedFolder *, aSharedFolders));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))(ComSafeArrayOut(IUSBDevice *, aUSBDevices)); 117 STDMETHOD(COMGETTER(RemoteUSBDevices))(ComSafeArrayOut(IHostUSBDevice *, aRemoteUSBDevices)); 118 STDMETHOD(COMGETTER(RemoteDisplayInfo))(IRemoteDisplayInfo **aRemoteDisplayInfo); 119 STDMETHOD(COMGETTER(SharedFolders))(ComSafeArrayOut(ISharedFolder *, aSharedFolders)); 120 120 121 121 // IConsole methods 122 STDMETHOD(PowerUp) 123 STDMETHOD(PowerUpPaused) 124 STDMETHOD(PowerDown) 122 STDMETHOD(PowerUp)(IProgress **aProgress); 123 STDMETHOD(PowerUpPaused)(IProgress **aProgress); 124 STDMETHOD(PowerDown)(IProgress **aProgress); 125 125 STDMETHOD(Reset)(); 126 126 STDMETHOD(Pause)(); … … 130 130 STDMETHOD(GetPowerButtonHandled)(BOOL *aHandled); 131 131 STDMETHOD(GetGuestEnteredACPIMode)(BOOL *aEntered); 132 STDMETHOD(SaveState) 133 STDMETHOD(AdoptSavedState) 132 STDMETHOD(SaveState)(IProgress **aProgress); 133 STDMETHOD(AdoptSavedState)(IN_BSTR aSavedStateFile); 134 134 STDMETHOD(ForgetSavedState)(BOOL aRemove); 135 STDMETHOD(GetDeviceActivity) 136 137 STDMETHOD(AttachUSBDevice) 138 STDMETHOD(DetachUSBDevice) 139 STDMETHOD(FindUSBDeviceByAddress) 140 STDMETHOD(FindUSBDeviceById) 141 STDMETHOD(CreateSharedFolder) 142 STDMETHOD(RemoveSharedFolder) 135 STDMETHOD(GetDeviceActivity)(DeviceType_T aDeviceType, 136 DeviceActivity_T *aDeviceActivity); 137 STDMETHOD(AttachUSBDevice)(IN_BSTR aId); 138 STDMETHOD(DetachUSBDevice)(IN_BSTR aId, IUSBDevice **aDevice); 139 STDMETHOD(FindUSBDeviceByAddress)(IN_BSTR aAddress, IUSBDevice **aDevice); 140 STDMETHOD(FindUSBDeviceById)(IN_BSTR aId, IUSBDevice **aDevice); 141 STDMETHOD(CreateSharedFolder)(IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable); 142 STDMETHOD(RemoveSharedFolder)(IN_BSTR aName); 143 143 STDMETHOD(TakeSnapshot)(IN_BSTR aName, IN_BSTR aDescription, 144 144 IProgress **aProgress); … … 146 146 STDMETHOD(RestoreSnapshot)(ISnapshot *aSnapshot, IProgress **aProgress); 147 147 STDMETHOD(Teleport)(IN_BSTR aHostname, ULONG aPort, IN_BSTR aPassword, ULONG aMaxDowntime, IProgress **aProgress); 148 STDMETHOD(RegisterCallback) 148 STDMETHOD(RegisterCallback)(IConsoleCallback *aCallback); 149 149 STDMETHOD(UnregisterCallback)(IConsoleCallback *aCallback); 150 150 … … 169 169 ConsoleVRDPServer *consoleVRDPServer() const { return mConsoleVRDPServer; } 170 170 171 HRESULT updateMachineState 171 HRESULT updateMachineState(MachineState_T aMachineState); 172 172 173 173 // events from IInternalSessionControl 174 HRESULT onNetworkAdapterChange 175 HRESULT onSerialPortChange 176 HRESULT onParallelPortChange 177 HRESULT onStorageControllerChange 174 HRESULT onNetworkAdapterChange(INetworkAdapter *aNetworkAdapter, BOOL changeAdapter); 175 HRESULT onSerialPortChange(ISerialPort *aSerialPort); 176 HRESULT onParallelPortChange(IParallelPort *aParallelPort); 177 HRESULT onStorageControllerChange(); 178 178 HRESULT onMediumChange(IMediumAttachment *aMediumAttachment, BOOL aForce); 179 179 HRESULT onCPUChange(ULONG aCPU, BOOL aRemove); 180 180 HRESULT onVRDPServerChange(); 181 181 HRESULT onUSBControllerChange(); 182 HRESULT onSharedFolderChange 183 HRESULT onUSBDeviceAttach 184 HRESULT onUSBDeviceDetach 185 HRESULT getGuestProperty 186 HRESULT setGuestProperty 187 HRESULT enumerateGuestProperties 182 HRESULT onSharedFolderChange(BOOL aGlobal); 183 HRESULT onUSBDeviceAttach(IUSBDevice *aDevice, IVirtualBoxErrorInfo *aError, ULONG aMaskedIfs); 184 HRESULT onUSBDeviceDetach(IN_BSTR aId, IVirtualBoxErrorInfo *aError); 185 HRESULT getGuestProperty(IN_BSTR aKey, BSTR *aValue, ULONG64 *aTimestamp, BSTR *aFlags); 186 HRESULT setGuestProperty(IN_BSTR aKey, IN_BSTR aValue, IN_BSTR aFlags); 187 HRESULT enumerateGuestProperties(IN_BSTR aPatterns, ComSafeArrayOut(BSTR, aNames), ComSafeArrayOut(BSTR, aValues), ComSafeArrayOut(ULONG64, aTimestamps), ComSafeArrayOut(BSTR, aFlags)); 188 188 VMMDev *getVMMDev() { return mVMMDev; } 189 AudioSniffer *getAudioSniffer 190 191 int VRDPClientLogon 192 void VRDPClientConnect 193 void VRDPClientDisconnect 194 void VRDPInterceptAudio 195 void VRDPInterceptUSB 196 void VRDPInterceptClipboard 197 198 void processRemoteUSBDevices 189 AudioSniffer *getAudioSniffer() { return mAudioSniffer; } 190 191 int VRDPClientLogon(uint32_t u32ClientId, const char *pszUser, const char *pszPassword, const char *pszDomain); 192 void VRDPClientConnect(uint32_t u32ClientId); 193 void VRDPClientDisconnect(uint32_t u32ClientId, uint32_t fu32Intercepted); 194 void VRDPInterceptAudio(uint32_t u32ClientId); 195 void VRDPInterceptUSB(uint32_t u32ClientId, void **ppvIntercept); 196 void VRDPInterceptClipboard(uint32_t u32ClientId); 197 198 void processRemoteUSBDevices(uint32_t u32ClientId, VRDPUSBDEVICEDESC *pDevList, uint32_t cbDevList); 199 199 200 200 // callback callers (partly; for some events console callbacks are notified … … 204 204 uint32_t width, uint32_t height, 205 205 void *pShape); 206 void onMouseCapabilityChange 207 void onStateChange 206 void onMouseCapabilityChange(BOOL supportsAbsolute, BOOL supportsRelative, BOOL needsHostCursor); 207 void onStateChange(MachineState_T aMachineState); 208 208 void onAdditionsStateChange(); 209 209 void onAdditionsOutdated(); 210 void onKeyboardLedsChange 211 void onUSBDeviceStateChange 212 213 void onRuntimeError 214 HRESULT onShowWindow 210 void onKeyboardLedsChange(bool fNumLock, bool fCapsLock, bool fScrollLock); 211 void onUSBDeviceStateChange(IUSBDevice *aDevice, bool aAttached, 212 IVirtualBoxErrorInfo *aError); 213 void onRuntimeError(BOOL aFatal, IN_BSTR aErrorID, IN_BSTR aMessage); 214 HRESULT onShowWindow(BOOL aCheck, BOOL *aCanShow, ULONG64 *aWinId); 215 215 void onRemoteDisplayInfoChange(); 216 216 … … 240 240 { 241 241 public: 242 AutoVMCallerBase (Console *aThat) : mThat (aThat), mRC(S_OK)242 AutoVMCallerBase(Console *aThat) : mThat(aThat), mRC(S_OK) 243 243 { 244 244 Assert(aThat); 245 mRC = aThat->addVMCaller 245 mRC = aThat->addVMCaller(taQuiet, taAllowNullVM); 246 246 } 247 247 ~AutoVMCallerBase() … … 262 262 { 263 263 AssertReturnVoid(!SUCCEEDED(mRC)); 264 mRC = mThat->addVMCaller 264 mRC = mThat->addVMCaller(taQuiet, taAllowNullVM); 265 265 } 266 266 /** Returns the result of Console::addVMCaller() */ … … 272 272 HRESULT mRC; 273 273 private: 274 DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP 275 DECLARE_CLS_NEW_DELETE_NOOP 274 DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP(AutoVMCallerBase) 275 DECLARE_CLS_NEW_DELETE_NOOP(AutoVMCallerBase) 276 276 }; 277 277 … … 282 282 * with mpVM. The usage pattern is: 283 283 * <code> 284 * AutoVMCaller autoVMCaller 284 * AutoVMCaller autoVMCaller(this); 285 285 * if (FAILED(autoVMCaller.rc())) return autoVMCaller.rc(); 286 286 * ... … … 326 326 typedef AutoVMCallerBase <taQuiet, true> Base; 327 327 public: 328 SafeVMPtrBase (Console *aThat) : Base (aThat), mpVM(NULL)328 SafeVMPtrBase(Console *aThat) : Base(aThat), mpVM(NULL) 329 329 { 330 330 if (SUCCEEDED(Base::mRC)) … … 337 337 private: 338 338 PVM mpVM; 339 DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP 340 DECLARE_CLS_NEW_DELETE_NOOP 339 DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP(SafeVMPtrBase) 340 DECLARE_CLS_NEW_DELETE_NOOP(SafeVMPtrBase) 341 341 }; 342 342 … … 348 348 * destruction. Intended for Console children. The usage pattern is: 349 349 * <code> 350 * Console::SaveVMPtr pVM 350 * Console::SaveVMPtr pVM(mParent); 351 351 * if (FAILED(pVM.rc())) return pVM.rc(); 352 352 * ... 353 * VMR3ReqCall 353 * VMR3ReqCall(pVM, ... 354 354 * ... 355 * printf 355 * printf("%p\n", pVM.raw()); 356 356 * </code> 357 357 * … … 367 367 * failure to the caller. The usage pattern is: 368 368 * <code> 369 * Console::SaveVMPtrQuiet pVM 369 * Console::SaveVMPtrQuiet pVM(mParent); 370 370 * if (pVM.rc()) 371 * VMR3ReqCall 371 * VMR3ReqCall(pVM, ... 372 372 * return S_OK; 373 373 * </code> … … 384 384 SharedFolderData() {} 385 385 SharedFolderData(Bstr aHostPath, BOOL aWritable) 386 : mHostPath 387 , mWritable 386 : mHostPath(aHostPath) 387 , mWritable(aWritable) {} 388 388 SharedFolderData(const SharedFolderData& aThat) 389 : mHostPath 390 , mWritable 389 : mHostPath(aThat.mHostPath) 390 , mWritable(aThat.mWritable) {} 391 391 Bstr mHostPath; 392 392 BOOL mWritable; … … 400 400 typedef std::list <ComObjPtr<RemoteUSBDevice> > RemoteUSBDeviceList; 401 401 402 HRESULT addVMCaller 402 HRESULT addVMCaller(bool aQuiet = false, bool aAllowNullVM = false); 403 403 void releaseVMCaller(); 404 404 405 HRESULT consoleInitReleaseLog 406 407 HRESULT powerUp 408 HRESULT powerDown 405 HRESULT consoleInitReleaseLog(const ComPtr<IMachine> aMachine); 406 407 HRESULT powerUp(IProgress **aProgress, bool aPaused); 408 HRESULT powerDown(Progress *aProgress = NULL); 409 409 410 410 HRESULT callTapSetupApplication(bool isStatic, RTFILE tapFD, Bstr &tapDevice, … … 419 419 HRESULT setMachineStateLocally(MachineState_T aMachineState) 420 420 { 421 return setMachineState 421 return setMachineState(aMachineState, false /* aUpdateServer */); 422 422 } 423 423 424 HRESULT findSharedFolder 425 426 427 428 HRESULT fetchSharedFolders 429 bool findOtherSharedFolder 430 431 432 HRESULT createSharedFolder 433 HRESULT removeSharedFolder 424 HRESULT findSharedFolder(CBSTR aName, 425 ComObjPtr<SharedFolder> &aSharedFolder, 426 bool aSetError = false); 427 428 HRESULT fetchSharedFolders(BOOL aGlobal); 429 bool findOtherSharedFolder(IN_BSTR aName, 430 SharedFolderDataMap::const_iterator &aIt); 431 432 HRESULT createSharedFolder(CBSTR aName, SharedFolderData aData); 433 HRESULT removeSharedFolder(CBSTR aName); 434 434 435 435 static DECLCALLBACK(int) configConstructor(PVM pVM, void *pvConsole); 436 437 static int configMediumAttachment(PCFGMNODE pCtlInst, 438 const char *pcszDevice, 439 unsigned uInstance, 440 StorageBus_T enmBus, 441 IMediumAttachment *pMediumAtt, 442 MachineState_T aMachineState, 443 HRESULT *phrc, bool fAttachDetach, 444 bool fForceUnmount, PVM pVM, 445 DeviceType_T *paLedDevType); 446 static int configMedium(PCFGMNODE pLunL0, bool fPassthrough, 447 DeviceType_T enmType, IMedium *pMedium, 448 MachineState_T aMachineState, HRESULT *phrc); 449 static DECLCALLBACK(int) reconfigureMediumAttachment(PVM pVM, 450 const char *pcszDevice, 451 unsigned uInstance, 452 StorageBus_T enmBus, 453 IMediumAttachment *aMediumAtt, 454 MachineState_T aMachineState, 455 HRESULT *phrc); 456 static DECLCALLBACK(int) changeRemovableMedium(Console *pThis, 457 const char *pcszDevice, 458 unsigned uInstance, 459 StorageBus_T enmBus, 460 IMediumAttachment *aMediumAtt, 461 bool fForce); 462 463 int configNetwork(const char *pszDevice, unsigned uInstance, unsigned uLun, 464 INetworkAdapter *aNetworkAdapter, PCFGMNODE pCfg, 465 PCFGMNODE pLunL0, PCFGMNODE pInst, bool fAttachDetach); 466 436 467 static DECLCALLBACK(int) configGuestProperties(void *pvConsole); 437 468 static DECLCALLBACK(int) configGuestControl(void *pvConsole); 438 static int configNetwork(Console *pThis, const char *pszDevice,439 unsigned uInstance, unsigned uLun,440 INetworkAdapter *aNetworkAdapter,441 PCFGMNODE pCfg, PCFGMNODE pLunL0,442 PCFGMNODE pInst, bool fAttachDetach);443 469 static DECLCALLBACK(void) vmstateChangeCallback(PVM aVM, VMSTATE aState, 444 470 VMSTATE aOldState, void *aUser); 445 static DECLCALLBACK(int) changeDrive (Console *pThis, const char *pszDevice, 446 unsigned uInstance, unsigned uLun, 447 bool fHostDrive, const char *pszPath, 448 const char *pszFormat, bool fPassthrough, 449 bool fForce); 450 static DECLCALLBACK(int) unplugCpu (Console *pThis, unsigned uCpu); 451 static DECLCALLBACK(int) plugCpu (Console *pThis, unsigned uCpu); 471 static DECLCALLBACK(int) unplugCpu(Console *pThis, unsigned uCpu); 472 static DECLCALLBACK(int) plugCpu(Console *pThis, unsigned uCpu); 452 473 HRESULT doMediumChange(IMediumAttachment *aMediumAttachment, bool fForce); 453 474 HRESULT doCPURemove(ULONG aCpu); … … 455 476 456 477 #ifdef VBOX_DYNAMIC_NET_ATTACH 457 HRESULT doNetworkAdapterChange 458 459 static DECLCALLBACK(int) changeNetworkAttachment 460 461 478 HRESULT doNetworkAdapterChange(const char *pszDevice, unsigned uInstance, 479 unsigned uLun, INetworkAdapter *aNetworkAdapter); 480 static DECLCALLBACK(int) changeNetworkAttachment(Console *pThis, const char *pszDevice, 481 unsigned uInstance, unsigned uLun, 482 INetworkAdapter *aNetworkAdapter); 462 483 #endif /* VBOX_DYNAMIC_NET_ATTACH */ 463 484 464 485 #ifdef VBOX_WITH_USB 465 HRESULT attachUSBDevice 466 HRESULT detachUSBDevice 467 468 static DECLCALLBACK(int) usbAttachCallback 486 HRESULT attachUSBDevice(IUSBDevice *aHostDevice, ULONG aMaskedIfs); 487 HRESULT detachUSBDevice(USBDeviceList::iterator &aIt); 488 489 static DECLCALLBACK(int) usbAttachCallback(Console *that, IUSBDevice *aHostDevice, PCRTUUID aUuid, 469 490 bool aRemote, const char *aAddress, ULONG aMaskedIfs); 470 static DECLCALLBACK(int) usbDetachCallback 491 static DECLCALLBACK(int) usbDetachCallback(Console *that, USBDeviceList::iterator *aIt, PCRTUUID aUuid); 471 492 #endif 472 493 … … 478 499 const char *pszFormat, va_list args); 479 500 480 static DECLCALLBACK(void) setVMRuntimeErrorCallbackF 501 static DECLCALLBACK(void) setVMRuntimeErrorCallbackF(PVM pVM, void *pvUser, uint32_t fFatal, 481 502 const char *pszErrorId, 482 503 const char *pszFormat, ...); 483 static DECLCALLBACK(void) setVMRuntimeErrorCallback 504 static DECLCALLBACK(void) setVMRuntimeErrorCallback(PVM pVM, void *pvUser, uint32_t fFatal, 484 505 const char *pszErrorId, 485 506 const char *pszFormat, va_list va); 486 507 487 HRESULT captureUSBDevices 488 void detachAllUSBDevices 489 490 static DECLCALLBACK (int) powerUpThread(RTTHREAD Thread, void *pvUser);491 static DECLCALLBACK (int) saveStateThread(RTTHREAD Thread, void *pvUser);492 static DECLCALLBACK (int) powerDownThread(RTTHREAD Thread, void *pvUser);508 HRESULT captureUSBDevices(PVM pVM); 509 void detachAllUSBDevices(bool aDone); 510 511 static DECLCALLBACK(int) powerUpThread(RTTHREAD Thread, void *pvUser); 512 static DECLCALLBACK(int) saveStateThread(RTTHREAD Thread, void *pvUser); 513 static DECLCALLBACK(int) powerDownThread(RTTHREAD Thread, void *pvUser); 493 514 494 515 static DECLCALLBACK(void *) drvStatus_QueryInterface(PPDMIBASE pInterface, const char *pszIID); … … 505 526 506 527 HRESULT loadDataFromSavedState(); 507 int loadStateFileExecInternal 508 509 static DECLCALLBACK(void) saveStateFileExec 510 static DECLCALLBACK(int) loadStateFileExec 528 int loadStateFileExecInternal(PSSMHANDLE pSSM, uint32_t u32Version); 529 530 static DECLCALLBACK(void) saveStateFileExec(PSSMHANDLE pSSM, void *pvUser); 531 static DECLCALLBACK(int) loadStateFileExec(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass); 511 532 512 533 #ifdef VBOX_WITH_GUEST_PROPS … … 518 539 ComSafeArrayOut(BSTR, aFlags)); 519 540 520 bool enabledGuestPropertiesVRDP 521 void updateGuestPropertiesVRDPLogon 522 void updateGuestPropertiesVRDPDisconnect 541 bool enabledGuestPropertiesVRDP(void); 542 void updateGuestPropertiesVRDPLogon(uint32_t u32ClientId, const char *pszUser, const char *pszDomain); 543 void updateGuestPropertiesVRDPDisconnect(uint32_t u32ClientId); 523 544 #endif 524 545
Note:
See TracChangeset
for help on using the changeset viewer.