summaryrefslogtreecommitdiff
path: root/src/VBox/Main/include
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2014-03-26 19:21:20 +0000
committer <>2014-05-08 15:03:54 +0000
commitfb123f93f9f5ce42c8e5785d2f8e0edaf951740e (patch)
treec2103d76aec5f1f10892cd1d3a38e24f665ae5db /src/VBox/Main/include
parent58ed4748338f9466599adfc8a9171280ed99e23f (diff)
downloadVirtualBox-master.tar.gz
Imported from /home/lorry/working-area/delta_VirtualBox/VirtualBox-4.3.10.tar.bz2.HEADVirtualBox-4.3.10master
Diffstat (limited to 'src/VBox/Main/include')
-rw-r--r--src/VBox/Main/include/ApplianceImpl.h86
-rw-r--r--src/VBox/Main/include/ApplianceImplPrivate.h26
-rw-r--r--src/VBox/Main/include/AudioAdapterImpl.h2
-rw-r--r--src/VBox/Main/include/AudioSnifferInterface.h2
-rw-r--r--src/VBox/Main/include/AutoCaller.h2
-rw-r--r--src/VBox/Main/include/BIOSSettingsImpl.h3
-rw-r--r--src/VBox/Main/include/BandwidthGroupImpl.h2
-rw-r--r--src/VBox/Main/include/ClientToken.h105
-rw-r--r--src/VBox/Main/include/ClientTokenHolder.h99
-rw-r--r--src/VBox/Main/include/ClientWatcher.h88
-rw-r--r--src/VBox/Main/include/ConsoleEvents.h2
-rw-r--r--src/VBox/Main/include/ConsoleImpl.h201
-rw-r--r--src/VBox/Main/include/ConsoleVRDPServer.h72
-rw-r--r--src/VBox/Main/include/DHCPServerImpl.h69
-rw-r--r--src/VBox/Main/include/DisplayImpl.h215
-rw-r--r--src/VBox/Main/include/DisplayUtils.h2
-rw-r--r--src/VBox/Main/include/EmulatedUSBImpl.h85
-rw-r--r--src/VBox/Main/include/EventImpl.h2
-rw-r--r--src/VBox/Main/include/ExtPackManagerImpl.h9
-rw-r--r--src/VBox/Main/include/ExtPackUtil.h2
-rw-r--r--src/VBox/Main/include/Global.h8
-rw-r--r--src/VBox/Main/include/GuestCtrlImplPrivate.h531
-rw-r--r--src/VBox/Main/include/GuestDirectoryImpl.h15
-rw-r--r--src/VBox/Main/include/GuestFileImpl.h64
-rw-r--r--src/VBox/Main/include/GuestImpl.h51
-rw-r--r--src/VBox/Main/include/GuestProcessImpl.h90
-rw-r--r--src/VBox/Main/include/GuestSessionImpl.h146
-rw-r--r--src/VBox/Main/include/HGCM.h2
-rw-r--r--src/VBox/Main/include/HGCMObjects.h2
-rw-r--r--src/VBox/Main/include/HGCMThread.h2
-rw-r--r--src/VBox/Main/include/HostHardwareLinux.h2
-rw-r--r--src/VBox/Main/include/HostImpl.h13
-rw-r--r--src/VBox/Main/include/HostNetworkInterfaceImpl.h5
-rw-r--r--src/VBox/Main/include/HostPower.h38
-rw-r--r--src/VBox/Main/include/HostUSBDeviceImpl.h2
-rw-r--r--src/VBox/Main/include/HostVideoInputDeviceImpl.h71
-rw-r--r--src/VBox/Main/include/KeyboardImpl.h5
-rw-r--r--src/VBox/Main/include/Logging.h3
-rw-r--r--src/VBox/Main/include/MachineDebuggerImpl.h9
-rw-r--r--src/VBox/Main/include/MachineImpl.h335
-rw-r--r--src/VBox/Main/include/Matching.h2
-rw-r--r--src/VBox/Main/include/MediumAttachmentImpl.h8
-rw-r--r--src/VBox/Main/include/MediumFormatImpl.h99
-rw-r--r--src/VBox/Main/include/MediumImpl.h33
-rw-r--r--src/VBox/Main/include/MediumLock.h20
-rw-r--r--src/VBox/Main/include/MouseImpl.h72
-rw-r--r--src/VBox/Main/include/NATNetworkImpl.h147
-rw-r--r--src/VBox/Main/include/NATNetworkServiceRunner.h (renamed from src/VBox/Main/include/DHCPServerRunner.h)52
-rw-r--r--src/VBox/Main/include/NetworkAdapterImpl.h2
-rw-r--r--src/VBox/Main/include/NetworkServiceRunner.h57
-rw-r--r--src/VBox/Main/include/Nvram.h9
-rw-r--r--src/VBox/Main/include/PCIDeviceAttachmentImpl.h62
-rw-r--r--src/VBox/Main/include/Performance.h178
-rw-r--r--src/VBox/Main/include/PerformanceImpl.h2
-rw-r--r--src/VBox/Main/include/ProgressCombinedImpl.h192
-rw-r--r--src/VBox/Main/include/ProgressImpl.h111
-rw-r--r--src/VBox/Main/include/ProgressProxyImpl.h2
-rw-r--r--src/VBox/Main/include/RemoteUSBBackend.h2
-rw-r--r--src/VBox/Main/include/RemoteUSBDeviceImpl.h2
-rw-r--r--src/VBox/Main/include/SessionImpl.h47
-rw-r--r--src/VBox/Main/include/SharedFolderImpl.h7
-rw-r--r--src/VBox/Main/include/SnapshotImpl.h2
-rw-r--r--src/VBox/Main/include/StorageControllerImpl.h2
-rw-r--r--src/VBox/Main/include/SystemPropertiesImpl.h11
-rw-r--r--src/VBox/Main/include/TokenImpl.h107
-rw-r--r--src/VBox/Main/include/USBControllerImpl.h36
-rw-r--r--src/VBox/Main/include/USBDeviceFilterImpl.h18
-rw-r--r--src/VBox/Main/include/USBDeviceFiltersImpl.h99
-rw-r--r--src/VBox/Main/include/USBDeviceImpl.h2
-rw-r--r--src/VBox/Main/include/USBGetDevices.h2
-rw-r--r--src/VBox/Main/include/UsbWebcamInterface.h66
-rw-r--r--src/VBox/Main/include/VFSExplorerImpl.h4
-rw-r--r--src/VBox/Main/include/VMMDev.h12
-rw-r--r--src/VBox/Main/include/VRDEServerImpl.h38
-rw-r--r--src/VBox/Main/include/VirtualBoxBase.h50
-rw-r--r--src/VBox/Main/include/VirtualBoxClientImpl.h3
-rw-r--r--src/VBox/Main/include/VirtualBoxErrorInfoImpl.h14
-rw-r--r--src/VBox/Main/include/VirtualBoxImpl.h51
-rw-r--r--src/VBox/Main/include/Wrapper.h491
-rw-r--r--src/VBox/Main/include/netif.h25
-rw-r--r--src/VBox/Main/include/objectslist.h2
-rw-r--r--src/VBox/Main/include/ovfreader.h284
-rw-r--r--src/VBox/Main/include/vbox-libhal.h2
-rw-r--r--src/VBox/Main/include/win/resource.h2
84 files changed, 3520 insertions, 1377 deletions
diff --git a/src/VBox/Main/include/ApplianceImpl.h b/src/VBox/Main/include/ApplianceImpl.h
index 16c96893..937ebbfd 100644
--- a/src/VBox/Main/include/ApplianceImpl.h
+++ b/src/VBox/Main/include/ApplianceImpl.h
@@ -1,12 +1,10 @@
/* $Id: ApplianceImpl.h $ */
-
/** @file
- *
* VirtualBox COM class implementation
*/
/*
- * Copyright (C) 2006-2009 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -26,6 +24,12 @@
/* Todo: This file needs massive cleanup. Split IAppliance in a public and
* private classes. */
#include <iprt/tar.h>
+#include <iprt/circbuf.h>
+#include <VBox/vd.h>
+#include <iprt/sha.h>
+
+#include "ovfreader.h"
+#include <set>
/* VBox forward declarations */
class Progress;
@@ -36,12 +40,15 @@ typedef struct VDINTERFACE *PVDINTERFACE;
typedef struct VDINTERFACEIO *PVDINTERFACEIO;
typedef struct SHASTORAGE *PSHASTORAGE;
+typedef enum applianceIOName { applianceIOTar, applianceIOFile, applianceIOSha } APPLIANCEIONAME;
+
namespace ovf
{
struct HardDiskController;
struct VirtualSystem;
class OVFReader;
struct DiskImage;
+ struct EnvelopeData;
}
namespace xml
@@ -72,13 +79,7 @@ public:
DECLARE_EMPTY_CTOR_DTOR (Appliance)
- enum OVFFormat
- {
- unspecified,
- OVF_0_9,
- OVF_1_0,
- OVF_2_0
- };
+
// public initializer/uninitializer for internal purposes only
HRESULT FinalConstruct() { return BaseFinalConstruct(); }
@@ -100,7 +101,7 @@ public:
STDMETHOD(ImportMachines)(ComSafeArrayIn(ImportOptions_T, options), IProgress **aProgress);
/* Export methods */
STDMETHOD(CreateVFSExplorer)(IN_BSTR aURI, IVFSExplorer **aExplorer);
- STDMETHOD(Write)(IN_BSTR format, BOOL fManifest, IN_BSTR path, IProgress **aProgress);
+ STDMETHOD(Write)(IN_BSTR format, ComSafeArrayIn(ExportOptions_T, options), IN_BSTR path, IProgress **aProgress);
STDMETHOD(GetWarnings)(ComSafeArrayOut(BSTR, aWarnings));
@@ -141,6 +142,16 @@ private:
static DECLCALLBACK(int) taskThreadImportOrExport(RTTHREAD aThread, void *pvUser);
+ HRESULT initSetOfSupportedStandardsURI();
+
+ Utf8Str typeOfVirtualDiskFormatFromURI(Utf8Str type) const;
+
+ std::set<Utf8Str> URIFromTypeOfVirtualDiskFormat(Utf8Str type);
+
+ HRESULT initApplianceIONameMap();
+
+ Utf8Str applianceIOName(APPLIANCEIONAME type) const;
+
/*******************************************************************************
* Read stuff
******************************************************************************/
@@ -164,8 +175,19 @@ private:
HRESULT importFSOVA(TaskOVF *pTask, AutoWriteLockBase& writeLock);
HRESULT importS3(TaskOVF *pTask);
- HRESULT readManifestFile(const Utf8Str &strFile, void **ppvBuf, size_t *pcbSize, PVDINTERFACEIO pCallbacks, PSHASTORAGE pStorage);
- HRESULT readTarManifestFile(RTTAR tar, const Utf8Str &strFile, void **ppvBuf, size_t *pcbSize, PVDINTERFACEIO pCallbacks, PSHASTORAGE pStorage);
+ HRESULT readFileToBuf(const Utf8Str &strFile,
+ void **ppvBuf,
+ size_t *pcbSize,
+ bool fCreateDigest,
+ PVDINTERFACEIO pCallbacks,
+ PSHASTORAGE pStorage);
+ HRESULT readTarFileToBuf(RTTAR tar,
+ const Utf8Str &strFile,
+ void **ppvBuf,
+ size_t *pcbSize,
+ bool fCreateDigest,
+ PVDINTERFACEIO pCallbacks,
+ PSHASTORAGE pStorage);
HRESULT verifyManifestFile(const Utf8Str &strFile, ImportStack &stack, void *pvBuf, size_t cbSize);
void convertDiskAttachmentValues(const ovf::HardDiskController &hdc,
@@ -175,11 +197,12 @@ private:
int32_t &lDevice);
void importOneDiskImage(const ovf::DiskImage &di,
- const Utf8Str &strTargetPath,
+ Utf8Str *strTargetPath,
ComObjPtr<Medium> &pTargetHD,
ImportStack &stack,
PVDINTERFACEIO pCallbacks,
PSHASTORAGE pStorage);
+
void importMachineGeneric(const ovf::VirtualSystem &vsysThis,
ComObjPtr<VirtualSystemDescription> &vsdescThis,
ComPtr<IMachine> &pNewMachine,
@@ -199,7 +222,7 @@ private:
* Write stuff
******************************************************************************/
- HRESULT writeImpl(OVFFormat aFormat, const LocationInfo &aLocInfo, ComObjPtr<Progress> &aProgress);
+ HRESULT writeImpl(ovf::OVFVersion_T aFormat, const LocationInfo &aLocInfo, ComObjPtr<Progress> &aProgress);
HRESULT writeFS(TaskOVF *pTask);
HRESULT writeFSOVF(TaskOVF *pTask, AutoWriteLockBase& writeLock);
@@ -208,14 +231,21 @@ private:
HRESULT writeS3(TaskOVF *pTask);
struct XMLStack;
- void buildXML(AutoWriteLockBase& writeLock, xml::Document &doc, XMLStack &stack, const Utf8Str &strPath, OVFFormat enFormat);
+
+ void buildXML(AutoWriteLockBase& writeLock,
+ xml::Document &doc,
+ XMLStack &stack,
+ const Utf8Str &strPath,
+ ovf::OVFVersion_T enFormat);
void buildXMLForOneVirtualSystem(AutoWriteLockBase& writeLock,
xml::ElementNode &elmToAddVirtualSystemsTo,
std::list<xml::ElementNode*> *pllElementsWithUuidAttributes,
ComObjPtr<VirtualSystemDescription> &vsdescThis,
- OVFFormat enFormat,
+ ovf::OVFVersion_T enFormat,
XMLStack &stack);
+ HRESULT preCheckImageAvailability(PSHASTORAGE pSHAStorage,
+ RTCString &availableImage);
friend class Machine;
};
@@ -228,12 +258,13 @@ struct VirtualSystemDescriptionEntry
VirtualSystemDescriptionType_T type; // type of this entry
Utf8Str strRef; // reference number (hard disk controllers only)
Utf8Str strOvf; // original OVF value (type-dependent)
- Utf8Str strVboxSuggested; // configuration value (type-dependent); original value suggested by interpret()
- Utf8Str strVboxCurrent; // configuration value (type-dependent); current value, either from interpret() or setFinalValue()
+ Utf8Str strVBoxSuggested; // configuration value (type-dependent); original value suggested by interpret()
+ Utf8Str strVBoxCurrent; // configuration value (type-dependent); current value, either from interpret() or setFinalValue()
Utf8Str strExtraConfigSuggested; // extra configuration key=value strings (type-dependent); original value suggested by interpret()
Utf8Str strExtraConfigCurrent; // extra configuration key=value strings (type-dependent); current value, either from interpret() or setFinalValue()
uint32_t ulSizeMB; // hard disk images only: a copy of ovf::DiskImage::ulSuggestedSizeMB
+ bool skipIt; ///< used during export to skip some parts if it's needed
};
class ATL_NO_VTABLE VirtualSystemDescription :
@@ -269,14 +300,14 @@ public:
STDMETHOD(GetDescription)(ComSafeArrayOut(VirtualSystemDescriptionType_T, aTypes),
ComSafeArrayOut(BSTR, aRefs),
ComSafeArrayOut(BSTR, aOvfValues),
- ComSafeArrayOut(BSTR, aVboxValues),
+ ComSafeArrayOut(BSTR, aVBoxValues),
ComSafeArrayOut(BSTR, aExtraConfigValues));
STDMETHOD(GetDescriptionByType)(VirtualSystemDescriptionType_T aType,
ComSafeArrayOut(VirtualSystemDescriptionType_T, aTypes),
ComSafeArrayOut(BSTR, aRefs),
ComSafeArrayOut(BSTR, aOvfValues),
- ComSafeArrayOut(BSTR, aVboxValues),
+ ComSafeArrayOut(BSTR, aVBoxValues),
ComSafeArrayOut(BSTR, aExtraConfigValues));
STDMETHOD(GetValuesByType)(VirtualSystemDescriptionType_T aType,
@@ -284,28 +315,29 @@ public:
ComSafeArrayOut(BSTR, aValues));
STDMETHOD(SetFinalValues)(ComSafeArrayIn(BOOL, aEnabled),
- ComSafeArrayIn(IN_BSTR, aVboxValues),
+ ComSafeArrayIn(IN_BSTR, aVBoxValues),
ComSafeArrayIn(IN_BSTR, aExtraConfigValues));
STDMETHOD(AddDescription)(VirtualSystemDescriptionType_T aType,
- IN_BSTR aVboxValue,
+ IN_BSTR aVBoxValue,
IN_BSTR aExtraConfigValue);
/* public methods only for internal purposes */
-
void addEntry(VirtualSystemDescriptionType_T aType,
const Utf8Str &strRef,
const Utf8Str &aOvfValue,
- const Utf8Str &aVboxValue,
+ const Utf8Str &aVBoxValue,
uint32_t ulSizeMB = 0,
const Utf8Str &strExtraConfig = "");
std::list<VirtualSystemDescriptionEntry*> findByType(VirtualSystemDescriptionType_T aType);
const VirtualSystemDescriptionEntry* findControllerFromID(uint32_t id);
- void importVboxMachineXML(const xml::ElementNode &elmMachine);
+ void importVBoxMachineXML(const xml::ElementNode &elmMachine);
const settings::MachineConfigFile* getMachineConfig() const;
+ void removeByType(VirtualSystemDescriptionType_T aType);
+
/* private instance data */
private:
struct Data;
@@ -314,5 +346,5 @@ private:
friend class Machine;
};
-#endif // ____H_APPLIANCEIMPL
+#endif // !____H_APPLIANCEIMPL
/* vi: set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/src/VBox/Main/include/ApplianceImplPrivate.h b/src/VBox/Main/include/ApplianceImplPrivate.h
index ee2f39d8..d36754a3 100644
--- a/src/VBox/Main/include/ApplianceImplPrivate.h
+++ b/src/VBox/Main/include/ApplianceImplPrivate.h
@@ -1,10 +1,9 @@
/** @file
- *
* VirtualBox Appliance private data definitions
*/
/*
- * Copyright (C) 2006-2010 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -21,6 +20,7 @@
class VirtualSystemDescription;
#include "ovfreader.h"
+#include <map>
////////////////////////////////////////////////////////////////////////////////
//
@@ -47,11 +47,13 @@ struct LocationInfo
struct Appliance::Data
{
enum ApplianceState { ApplianceIdle, ApplianceImporting, ApplianceExporting };
+ enum digest_T {SHA1, SHA256};
Data()
: state(ApplianceIdle)
, fManifest(true)
, fSha256(false)
+ , fExportISOImages(false)
, pReader(NULL)
, ulWeightForXmlOperation(0)
, ulWeightForManifestOperation(0)
@@ -74,7 +76,12 @@ struct Appliance::Data
LocationInfo locInfo; // location info for the currently processed OVF
bool fManifest; // Create a manifest file on export
bool fSha256; // true = SHA256 (OVF 2.0), false = SHA1 (OVF 1.0)
- RTCList<ImportOptions_T> optList;
+ Utf8Str strOVFSHADigest;//SHA digest of OVf file. It is stored here after reading OVF file (before import)
+
+ bool fExportISOImages;// when 1 the ISO images are exported
+
+ RTCList<ImportOptions_T> optListImport;
+ RTCList<ExportOptions_T> optListExport;
ovf::OVFReader *pReader;
@@ -87,7 +94,6 @@ struct Appliance::Data
ULONG ulWeightForManifestOperation;
ULONG ulTotalDisksMB;
ULONG cDisks;
- Utf8Str strOVFSHADigest;
std::list<Guid> llGuidsMachinesCreated;
};
@@ -115,7 +121,7 @@ struct Appliance::TaskOVF
taskType(aType),
locInfo(aLocInfo),
pProgress(aProgress),
- enFormat(unspecified),
+ enFormat(ovf::OVFVersion_unknown),
rc(S_OK)
{}
@@ -128,7 +134,7 @@ struct Appliance::TaskOVF
const LocationInfo locInfo;
ComObjPtr<Progress> pProgress;
- OVFFormat enFormat;
+ ovf::OVFVersion_T enFormat;
HRESULT rc;
};
@@ -221,10 +227,11 @@ struct VirtualSystemDescription::Data
void convertCIMOSType2VBoxOSType(Utf8Str &strType, ovf::CIMOSType_T c, const Utf8Str &cStr);
-ovf::CIMOSType_T convertVBoxOSType2CIMOSType(const char *pcszVbox);
+ovf::CIMOSType_T convertVBoxOSType2CIMOSType(const char *pcszVBox, BOOL fLongMode);
Utf8Str convertNetworkAttachmentTypeToString(NetworkAttachmentType_T type);
+
typedef struct SHASTORAGE
{
PVDINTERFACE pVDImageIfaces;
@@ -238,6 +245,7 @@ PVDINTERFACEIO FileCreateInterface();
PVDINTERFACEIO TarCreateInterface();
int ShaReadBuf(const char *pcszFilename, void **ppvBuf, size_t *pcbSize, PVDINTERFACEIO pIfIo, void *pvUser);
int ShaWriteBuf(const char *pcszFilename, void *pvBuf, size_t cbSize, PVDINTERFACEIO pIfIo, void *pvUser);
-
-#endif // ____H_APPLIANCEIMPLPRIVATE
+int decompressImageAndSave(const char *pcszFullFilenameIn, const char *pcszFullFilenameOut, PVDINTERFACEIO pIfIo, void *pvUser);
+int copyFileAndCalcShaDigest(const char *pcszSourceFilename, const char *pcszTargetFilename, PVDINTERFACEIO pIfIo, void *pvUser);
+#endif // !____H_APPLIANCEIMPLPRIVATE
diff --git a/src/VBox/Main/include/AudioAdapterImpl.h b/src/VBox/Main/include/AudioAdapterImpl.h
index d2c91b30..157664fa 100644
--- a/src/VBox/Main/include/AudioAdapterImpl.h
+++ b/src/VBox/Main/include/AudioAdapterImpl.h
@@ -6,7 +6,7 @@
*/
/*
- * Copyright (C) 2006-2007 Oracle Corporation
+ * Copyright (C) 2006-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Main/include/AudioSnifferInterface.h b/src/VBox/Main/include/AudioSnifferInterface.h
index 3c467bc7..e7461f5f 100644
--- a/src/VBox/Main/include/AudioSnifferInterface.h
+++ b/src/VBox/Main/include/AudioSnifferInterface.h
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 2006-2007 Oracle Corporation
+ * Copyright (C) 2006-2010 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Main/include/AutoCaller.h b/src/VBox/Main/include/AutoCaller.h
index 207d3589..9b155c5b 100644
--- a/src/VBox/Main/include/AutoCaller.h
+++ b/src/VBox/Main/include/AutoCaller.h
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2006-2010 Oracle Corporation
+ * Copyright (C) 2006-2012 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Main/include/BIOSSettingsImpl.h b/src/VBox/Main/include/BIOSSettingsImpl.h
index dffff1d0..660ff0d3 100644
--- a/src/VBox/Main/include/BIOSSettingsImpl.h
+++ b/src/VBox/Main/include/BIOSSettingsImpl.h
@@ -6,7 +6,7 @@
*/
/*
- * Copyright (C) 2006-2007 Oracle Corporation
+ * Copyright (C) 2006-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -71,6 +71,7 @@ public:
STDMETHOD(COMSETTER(PXEDebugEnabled))(BOOL enable);
STDMETHOD(COMGETTER)(TimeOffset)(LONG64 *offset);
STDMETHOD(COMSETTER)(TimeOffset)(LONG64 offset);
+ STDMETHOD(COMGETTER)(NonVolatileStorageFile)(BSTR *pbstrPath);
// public methods only for internal purposes
diff --git a/src/VBox/Main/include/BandwidthGroupImpl.h b/src/VBox/Main/include/BandwidthGroupImpl.h
index 98a6b86c..dbcf1591 100644
--- a/src/VBox/Main/include/BandwidthGroupImpl.h
+++ b/src/VBox/Main/include/BandwidthGroupImpl.h
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2006-2009 Oracle Corporation
+ * Copyright (C) 2006-2012 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Main/include/ClientToken.h b/src/VBox/Main/include/ClientToken.h
new file mode 100644
index 00000000..d452269d
--- /dev/null
+++ b/src/VBox/Main/include/ClientToken.h
@@ -0,0 +1,105 @@
+/* $Id: ClientToken.h $ */
+
+/** @file
+ *
+ * VirtualBox API client session token abstraction
+ */
+
+/*
+ * Copyright (C) 2013 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef ____H_CLIENTTOKEN
+#define ____H_CLIENTTOKEN
+
+#include <VBox/com/ptr.h>
+#include <VBox/com/AutoLock.h>
+
+#include "MachineImpl.h"
+#ifdef VBOX_WITH_GENERIC_SESSION_WATCHER
+# include "TokenImpl.h"
+#endif /* VBOX_WITH_GENERIC_SESSION_WATCHER */
+
+#if defined(RT_OS_WINDOWS)
+# define CTTOKENARG NULL
+# define CTTOKENTYPE HANDLE
+#elif defined(RT_OS_OS2)
+# define CTTOKENARG NULLHANDLE
+# define CTTOKENTYPE HMTX
+#elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER)
+# define CTTOKENARG -1
+# define CTTOKENTYPE int
+#elif defined(VBOX_WITH_GENERIC_SESSION_WATCHER)
+# define CTTOKENARG NULL
+# define CTTOKENTYPE MachineToken *
+#else
+# error "Port me!"
+#endif
+
+/**
+ * Class which represents a token which can be used to check for client
+ * crashes and similar purposes.
+ */
+class Machine::ClientToken
+{
+public:
+ /**
+ * Constructor which creates a usable instance
+ *
+ * @param pMachine Reference to Machine object
+ * @param pSessionMachine Reference to corresponding SessionMachine object
+ */
+ ClientToken(const ComObjPtr<Machine> &pMachine, SessionMachine *pSessionMachine);
+
+ /**
+ * Default destructor. Cleans everything up.
+ */
+ ~ClientToken();
+
+ /**
+ * Check if object contains a usable token.
+ */
+ bool isReady();
+
+ /**
+ * Query token ID, which is a unique string value for this token. Do not
+ * assume any specific content/format, it is opaque information.
+ */
+ void getId(Utf8Str &strId);
+
+ /**
+ * Query token, which is platform dependent.
+ */
+ CTTOKENTYPE getToken();
+
+#ifndef VBOX_WITH_GENERIC_SESSION_WATCHER
+ /**
+ * Release token now. Returns information if the client has terminated.
+ */
+ bool release();
+#endif /* !VBOX_WITH_GENERIC_SESSION_WATCHER */
+
+private:
+ /**
+ * Default constructor. Don't use, will not create a sensible instance.
+ */
+ ClientToken();
+
+ Machine *mMachine;
+ CTTOKENTYPE mClientToken;
+ Utf8Str mClientTokenId;
+#ifdef VBOX_WITH_GENERIC_SESSION_WATCHER
+ bool mClientTokenPassed;
+#endif
+};
+
+#endif /* !____H_CLIENTTOKEN */
+/* vi: set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/src/VBox/Main/include/ClientTokenHolder.h b/src/VBox/Main/include/ClientTokenHolder.h
new file mode 100644
index 00000000..30a2e51c
--- /dev/null
+++ b/src/VBox/Main/include/ClientTokenHolder.h
@@ -0,0 +1,99 @@
+/* $Id: ClientTokenHolder.h $ */
+
+/** @file
+ *
+ * VirtualBox API client session token holder (in the client process)
+ */
+
+/*
+ * Copyright (C) 2013 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef ____H_CLIENTTOKENHOLDER
+#define ____H_CLIENTTOKENHOLDER
+
+#include "SessionImpl.h"
+
+#if defined(RT_OS_WINDOWS)
+# define CTHSEMARG NULL
+# define CTHSEMTYPE HANDLE
+/* this second semaphore is only used on Windows */
+# define CTHTHREADSEMARG NULL
+# define CTHTHREADSEMTYPE HANDLE
+#elif defined(RT_OS_OS2)
+# define CTHSEMARG NIL_RTSEMEVENT
+# define CTHSEMTYPE RTSEMEVENT
+#elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER)
+# define CTHSEMARG -1
+# define CTHSEMTYPE int
+#elif defined(VBOX_WITH_GENERIC_SESSION_WATCHER)
+/* the token object based implementation needs no semaphores */
+#else
+# error "Port me!"
+#endif
+
+
+/**
+ * Class which holds a client token.
+ */
+class Session::ClientTokenHolder
+{
+public:
+#ifndef VBOX_WITH_GENERIC_SESSION_WATCHER
+ /**
+ * Constructor which creates a usable instance
+ *
+ * @param strTokenId String with identifier of the token
+ */
+ ClientTokenHolder(const Utf8Str &strTokenId);
+#else /* VBOX_WITH_GENERIC_SESSION_WATCHER */
+ /**
+ * Constructor which creates a usable instance
+ *
+ * @param aToken Reference to token object
+ */
+ ClientTokenHolder(IToken *aToken);
+#endif /* VBOX_WITH_GENERIC_SESSION_WATCHER */
+
+ /**
+ * Default destructor. Cleans everything up.
+ */
+ ~ClientTokenHolder();
+
+ /**
+ * Check if object contains a usable token.
+ */
+ bool isReady();
+
+private:
+ /**
+ * Default constructor. Don't use, will not create a sensible instance.
+ */
+ ClientTokenHolder();
+
+#ifndef VBOX_WITH_GENERIC_SESSION_WATCHER
+ Utf8Str mClientTokenId;
+#else /* VBOX_WITH_GENERIC_SESSION_WATCHER */
+ ComPtr<IToken> mToken;
+#endif /* VBOX_WITH_GENERIC_SESSION_WATCHER */
+#ifdef CTHSEMTYPE
+ CTHSEMTYPE mSem;
+#endif
+#if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2)
+ RTTHREAD mThread;
+#endif
+#ifdef RT_OS_WINDOWS
+ CTHTHREADSEMTYPE mThreadSem;
+#endif
+};
+
+#endif /* !____H_CLIENTTOKENHOLDER */
+/* vi: set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/src/VBox/Main/include/ClientWatcher.h b/src/VBox/Main/include/ClientWatcher.h
new file mode 100644
index 00000000..6e9d26b6
--- /dev/null
+++ b/src/VBox/Main/include/ClientWatcher.h
@@ -0,0 +1,88 @@
+/* $Id: ClientWatcher.h $ */
+
+/** @file
+ *
+ * VirtualBox API client session watcher
+ */
+
+/*
+ * Copyright (C) 2013 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef ____H_CLIENTWATCHER
+#define ____H_CLIENTWATCHER
+
+#include <list>
+#include <VBox/com/ptr.h>
+#include <VBox/com/AutoLock.h>
+
+#include "VirtualBoxImpl.h"
+
+#if defined(RT_OS_WINDOWS)
+# define CWUPDATEREQARG NULL
+# define CWUPDATEREQTYPE HANDLE
+#elif defined(RT_OS_OS2)
+# define CWUPDATEREQARG NIL_RTSEMEVENT
+# define CWUPDATEREQTYPE RTSEMEVENT
+#elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER) || defined(VBOX_WITH_GENERIC_SESSION_WATCHER)
+# define CWUPDATEREQARG NIL_RTSEMEVENT
+# define CWUPDATEREQTYPE RTSEMEVENT
+#else
+# error "Port me!"
+#endif
+
+/**
+ * Class which checks for API clients which have crashed/exited, and takes
+ * the necessary cleanup actions. Singleton.
+ */
+class VirtualBox::ClientWatcher
+{
+public:
+ /**
+ * Constructor which creates a usable instance
+ *
+ * @param pVirtualBox Reference to VirtualBox object
+ */
+ ClientWatcher(const ComObjPtr<VirtualBox> &pVirtualBox);
+
+ /**
+ * Default destructor. Cleans everything up.
+ */
+ ~ClientWatcher();
+
+ bool isReady();
+
+ void update();
+ void addProcess(RTPROCESS pid);
+
+private:
+ /**
+ * Default constructor. Don't use, will not create a sensible instance.
+ */
+ ClientWatcher();
+
+ static DECLCALLBACK(int) worker(RTTHREAD /* thread */, void *pvUser);
+
+ VirtualBox *mVirtualBox;
+ RTTHREAD mThread;
+ CWUPDATEREQTYPE mUpdateReq;
+ util::RWLockHandle mLock;
+
+ typedef std::list<RTPROCESS> ProcessList;
+ ProcessList mProcesses;
+
+#if defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER) || defined(VBOX_WITH_GENERIC_SESSION_WATCHER)
+ uint8_t mUpdateAdaptCtr;
+#endif
+};
+
+#endif /* !____H_CLIENTWATCHER */
+/* vi: set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/src/VBox/Main/include/ConsoleEvents.h b/src/VBox/Main/include/ConsoleEvents.h
index 8e82338c..a4718acd 100644
--- a/src/VBox/Main/include/ConsoleEvents.h
+++ b/src/VBox/Main/include/ConsoleEvents.h
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2006-2007 Oracle Corporation
+ * Copyright (C) 2006-2010 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Main/include/ConsoleImpl.h b/src/VBox/Main/include/ConsoleImpl.h
index 72066ad5..5e5cb696 100644
--- a/src/VBox/Main/include/ConsoleImpl.h
+++ b/src/VBox/Main/include/ConsoleImpl.h
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2005-2012 Oracle Corporation
+ * Copyright (C) 2005-2014 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -32,11 +32,9 @@ class OUSBDevice;
class RemoteUSBDevice;
class SharedFolder;
class VRDEServerInfo;
+class EmulatedUSB;
class AudioSniffer;
class Nvram;
-#ifdef VBOX_WITH_USB_VIDEO
-class UsbWebcamInterface;
-#endif
#ifdef VBOX_WITH_USB_CARDREADER
class UsbCardReader;
#endif
@@ -48,6 +46,8 @@ COM_STRUCT_OR_CLASS(IEventListener);
#ifdef VBOX_WITH_EXTPACK
class ExtPackManager;
#endif
+class VMMDevMouseInterface;
+class DisplayMouseInterface;
#include <VBox/RemoteDesktop/VRDE.h>
#include <VBox/vmm/pdmdrv.h>
@@ -88,10 +88,21 @@ typedef struct VUSBIRHCONFIG *PVUSBIRHCONFIG;
// Console
///////////////////////////////////////////////////////////////////////////////
+class ConsoleMouseInterface
+{
+public:
+ virtual VMMDevMouseInterface *getVMMDevMouseInterface() = 0;
+ virtual DisplayMouseInterface *getDisplayMouseInterface() = 0;
+ virtual void onMouseCapabilityChange(BOOL supportsAbsolute,
+ BOOL supportsRelative,
+ BOOL supportsMT,
+ BOOL needsHostCursor) = 0;
+};
+
/** IConsole implementation class */
class ATL_NO_VTABLE Console :
public VirtualBoxBase,
- VBOX_SCRIPTABLE_IMPL(IConsole)
+ VBOX_SCRIPTABLE_IMPL(IConsole), public ConsoleMouseInterface
{
Q_OBJECT
@@ -133,6 +144,7 @@ public:
STDMETHOD(COMGETTER(AttachedPCIDevices))(ComSafeArrayOut(IPCIDeviceAttachment *, aAttachments));
STDMETHOD(COMGETTER(UseHostClipboard))(BOOL *aUseHostClipboard);
STDMETHOD(COMSETTER(UseHostClipboard))(BOOL aUseHostClipboard);
+ STDMETHOD(COMGETTER(EmulatedUSB))(IEmulatedUSB **aEmulatedUSB);
// IConsole methods
STDMETHOD(PowerUp)(IProgress **aProgress);
@@ -200,12 +212,15 @@ public:
HRESULT onClipboardModeChange(ClipboardMode_T aClipboardMode);
HRESULT onDragAndDropModeChange(DragAndDropMode_T aDragAndDropMode);
HRESULT onVRDEServerChange(BOOL aRestart);
+ HRESULT onVideoCaptureChange();
HRESULT onUSBControllerChange();
HRESULT onSharedFolderChange(BOOL aGlobal);
HRESULT onUSBDeviceAttach(IUSBDevice *aDevice, IVirtualBoxErrorInfo *aError, ULONG aMaskedIfs);
HRESULT onUSBDeviceDetach(IN_BSTR aId, IVirtualBoxErrorInfo *aError);
HRESULT onBandwidthGroupChange(IBandwidthGroup *aBandwidthGroup);
- HRESULT onStorageDeviceChange(IMediumAttachment *aMediumAttachment, BOOL aRemove);
+ HRESULT onStorageDeviceChange(IMediumAttachment *aMediumAttachment, BOOL aRemove, BOOL aSilent);
+ HRESULT onExtraDataChange(IN_BSTR aMachineId, IN_BSTR aKey, IN_BSTR aVal);
+
HRESULT getGuestProperty(IN_BSTR aKey, BSTR *aValue, LONG64 *aTimestamp, BSTR *aFlags);
HRESULT setGuestProperty(IN_BSTR aKey, IN_BSTR aValue, IN_BSTR aFlags);
HRESULT enumerateGuestProperties(IN_BSTR aPatterns,
@@ -215,10 +230,8 @@ public:
ComSafeArrayOut(BSTR, aFlags));
HRESULT onlineMergeMedium(IMediumAttachment *aMediumAttachment,
ULONG aSourceIdx, ULONG aTargetIdx,
- IMedium *aSource, IMedium *aTarget,
- BOOL aMergeForward, IMedium *aParentForTarget,
- ComSafeArrayIn(IMedium *, aChildrenToReparent),
IProgress *aProgress);
+ int hgcmLoadService(const char *pszServiceLibrary, const char *pszServiceName);
VMMDev *getVMMDev() { return m_pVMMDev; }
AudioSniffer *getAudioSniffer() { return mAudioSniffer; }
#ifdef VBOX_WITH_EXTPACK
@@ -238,28 +251,34 @@ public:
void VRDPInterceptClipboard(uint32_t u32ClientId);
void processRemoteUSBDevices(uint32_t u32ClientId, VRDEUSBDEVICEDESC *pDevList, uint32_t cbDevList, bool fDescExt);
- void reportGuestStatistics(ULONG aValidStats, ULONG aCpuUser,
+ void reportVmStatistics(ULONG aValidStats, ULONG aCpuUser,
ULONG aCpuKernel, ULONG aCpuIdle,
ULONG aMemTotal, ULONG aMemFree,
ULONG aMemBalloon, ULONG aMemShared,
ULONG aMemCache, ULONG aPageTotal,
ULONG aAllocVMM, ULONG aFreeVMM,
- ULONG aBalloonedVMM, ULONG aSharedVMM)
+ ULONG aBalloonedVMM, ULONG aSharedVMM,
+ ULONG aVmNetRx, ULONG aVmNetTx)
{
- mControl->ReportGuestStatistics(aValidStats, aCpuUser, aCpuKernel, aCpuIdle,
- aMemTotal, aMemFree, aMemBalloon, aMemShared,
- aMemCache, aPageTotal, aAllocVMM, aFreeVMM,
- aBalloonedVMM, aSharedVMM);
+ mControl->ReportVmStatistics(aValidStats, aCpuUser, aCpuKernel, aCpuIdle,
+ aMemTotal, aMemFree, aMemBalloon, aMemShared,
+ aMemCache, aPageTotal, aAllocVMM, aFreeVMM,
+ aBalloonedVMM, aSharedVMM, aVmNetRx, aVmNetTx);
}
void enableVMMStatistics(BOOL aEnable);
+ HRESULT pause(Reason_T aReason);
+ HRESULT resume(Reason_T aReason);
+ HRESULT saveState(Reason_T aReason, IProgress **aProgress);
+
// callback callers (partly; for some events console callbacks are notified
// directly from IInternalSessionControl event handlers declared above)
void onMousePointerShapeChange(bool fVisible, bool fAlpha,
uint32_t xHot, uint32_t yHot,
uint32_t width, uint32_t height,
ComSafeArrayIn(uint8_t, aShape));
- void onMouseCapabilityChange(BOOL supportsAbsolute, BOOL supportsRelative, BOOL needsHostCursor);
+ void onMouseCapabilityChange(BOOL supportsAbsolute, BOOL supportsRelative,
+ BOOL supportsMT, BOOL needsHostCursor);
void onStateChange(MachineState_T aMachineState);
void onAdditionsStateChange();
void onAdditionsOutdated();
@@ -281,10 +300,16 @@ public:
HRESULT onNATRedirectRuleChange(ULONG ulInstance, BOOL aNatRuleRemove,
NATProtocol_T aProto, IN_BSTR aHostIp, LONG aHostPort, IN_BSTR aGuestIp, LONG aGuestPort);
+ // Mouse interface
+ VMMDevMouseInterface *getVMMDevMouseInterface();
+ DisplayMouseInterface *getDisplayMouseInterface();
+
+ EmulatedUSB *getEmulatedUSB(void) { return mEmulatedUSB; }
+
private:
/**
- * Base template for AutoVMCaller and SaveVMPtr. Template arguments
+ * Base template for AutoVMCaller and SafeVMPtr. Template arguments
* have the same meaning as arguments of Console::addVMCaller().
*/
template <bool taQuiet = false, bool taAllowNullVM = false>
@@ -328,15 +353,15 @@ private:
#if 0
/**
- * Helper class that protects sections of code using the mpVM pointer by
+ * Helper class that protects sections of code using the mpUVM pointer by
* automatically calling addVMCaller() on construction and
* releaseVMCaller() on destruction. Intended for Console methods dealing
- * with mpVM. The usage pattern is:
+ * with mpUVM. The usage pattern is:
* <code>
* AutoVMCaller autoVMCaller(this);
* if (FAILED(autoVMCaller.rc())) return autoVMCaller.rc();
* ...
- * VMR3ReqCall (mpVM, ...
+ * VMR3ReqCall (mpUVM, ...
* </code>
*
* @note Temporarily locks the argument for writing.
@@ -375,56 +400,52 @@ private:
typedef AutoVMCallerBase<true, true> AutoVMCallerQuietWeak;
/**
- * Base template for SaveVMPtr and SaveVMPtrQuiet.
+ * Base template for SafeVMPtr and SafeVMPtrQuiet.
*/
template<bool taQuiet = false>
class SafeVMPtrBase : public AutoVMCallerBase<taQuiet, true>
{
typedef AutoVMCallerBase<taQuiet, true> Base;
public:
- SafeVMPtrBase(Console *aThat) : Base(aThat), mpVM(NULL), mpUVM(NULL)
+ SafeVMPtrBase(Console *aThat) : Base(aThat), mpUVM(NULL)
{
if (SUCCEEDED(Base::mRC))
- Base::mRC = aThat->safeVMPtrRetainer(&mpVM, &mpUVM, taQuiet);
+ Base::mRC = aThat->safeVMPtrRetainer(&mpUVM, taQuiet);
}
~SafeVMPtrBase()
{
if (SUCCEEDED(Base::mRC))
release();
}
- /** Smart SaveVMPtr to PVM cast operator */
- operator PVM() const { return mpVM; }
- /** Direct PVM access for printf()-like functions */
- PVM raw() const { return mpVM; }
- /** Direct PUVM access for printf()-like functions */
+ /** Direct PUVM access. */
PUVM rawUVM() const { return mpUVM; }
/** Release the handles. */
void release()
{
AssertReturnVoid(SUCCEEDED(Base::mRC));
- Base::mThat->safeVMPtrReleaser(&mpVM, &mpUVM);
+ Base::mThat->safeVMPtrReleaser(&mpUVM);
Base::releaseCaller();
}
private:
- PVM mpVM;
PUVM mpUVM;
DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP(SafeVMPtrBase)
};
public:
- /**
- * Helper class that safely manages the Console::mpVM pointer
+ /*
+ * Helper class that safely manages the Console::mpUVM pointer
* by calling addVMCaller() on construction and releaseVMCaller() on
* destruction. Intended for Console children. The usage pattern is:
* <code>
- * Console::SaveVMPtr pVM(mParent);
- * if (FAILED(pVM.rc())) return pVM.rc();
+ * Console::SafeVMPtr ptrVM(mParent);
+ * if (!ptrVM.isOk())
+ * return ptrVM.rc();
* ...
- * VMR3ReqCall(pVM, ...
+ * VMR3ReqCall(ptrVM.rawUVM(), ...
* ...
- * printf("%p\n", pVM.raw());
+ * printf("%p\n", ptrVM.rawUVM());
* </code>
*
* @note Temporarily locks the argument for writing.
@@ -434,11 +455,11 @@ public:
typedef SafeVMPtrBase<false> SafeVMPtr;
/**
- * A deviation of SaveVMPtr that doesn't set the error info on failure.
+ * A deviation of SafeVMPtr that doesn't set the error info on failure.
* Intended for pieces of code that don't need to return the VM access
* failure to the caller. The usage pattern is:
* <code>
- * Console::SaveVMPtrQuiet pVM(mParent);
+ * Console::SafeVMPtrQuiet pVM(mParent);
* if (pVM.rc())
* VMR3ReqCall(pVM, ...
* return S_OK;
@@ -487,8 +508,8 @@ private:
HRESULT addVMCaller(bool aQuiet = false, bool aAllowNullVM = false);
void releaseVMCaller();
- HRESULT safeVMPtrRetainer(PVM *a_ppVM, PUVM *a_ppUVM, bool aQuiet);
- void safeVMPtrReleaser(PVM *a_ppVM, PUVM *a_ppUVM);
+ HRESULT safeVMPtrRetainer(PUVM *a_ppUVM, bool aQuiet);
+ void safeVMPtrReleaser(PUVM *a_ppUVM);
HRESULT consoleInitReleaseLog(const ComPtr<IMachine> aMachine);
@@ -519,10 +540,20 @@ private:
HRESULT createSharedFolder(const Utf8Str &strName, const SharedFolderData &aData);
HRESULT removeSharedFolder(const Utf8Str &strName);
- static DECLCALLBACK(int) configConstructor(PVM pVM, void *pvConsole);
- int configConstructorInner(PVM pVM, AutoWriteLock *pAlock);
- int configCfgmOverlay(PVM pVM, IVirtualBox *pVirtualBox, IMachine *pMachine);
+ HRESULT suspendBeforeConfigChange(PUVM pUVM, AutoWriteLock *pAlock, bool *pfResume);
+ void resumeAfterConfigChange(PUVM pUVM);
+ static DECLCALLBACK(int) configConstructor(PUVM pUVM, PVM pVM, void *pvConsole);
+ int configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock);
+ int configCfgmOverlay(PCFGMNODE pRoot, IVirtualBox *pVirtualBox, IMachine *pMachine);
+ int configDumpAPISettingsTweaks(IVirtualBox *pVirtualBox, IMachine *pMachine);
+
+ int configGraphicsController(PCFGMNODE pDevices,
+ const GraphicsControllerType_T graphicsController,
+ BusAssignmentManager *pBusMgr,
+ const ComPtr<IMachine> &pMachine,
+ const ComPtr<IBIOSSettings> &biosSettings,
+ bool fHMEnabled);
int configMediumAttachment(PCFGMNODE pCtlInst,
const char *pcszDevice,
unsigned uInstance,
@@ -538,8 +569,9 @@ private:
bool fAttachDetach,
bool fForceUnmount,
bool fHotplug,
- PVM pVM,
- DeviceType_T *paLedDevType);
+ PUVM pUVM,
+ DeviceType_T *paLedDevType,
+ PCFGMNODE *ppLunL0);
int configMedium(PCFGMNODE pLunL0,
bool fPassthrough,
DeviceType_T enmType,
@@ -553,8 +585,8 @@ private:
IMedium *pMedium,
MachineState_T aMachineState,
HRESULT *phrc);
- static DECLCALLBACK(int) reconfigureMediumAttachment(Console *pConsole,
- PVM pVM,
+ static DECLCALLBACK(int) reconfigureMediumAttachment(Console *pThis,
+ PUVM pUVM,
const char *pcszDevice,
unsigned uInstance,
StorageBus_T enmBus,
@@ -567,7 +599,7 @@ private:
MachineState_T aMachineState,
HRESULT *phrc);
static DECLCALLBACK(int) changeRemovableMedium(Console *pThis,
- PVM pVM,
+ PUVM pUVM,
const char *pcszDevice,
unsigned uInstance,
StorageBus_T enmBus,
@@ -575,7 +607,7 @@ private:
IMediumAttachment *aMediumAtt,
bool fForce);
- HRESULT attachRawPCIDevices(PVM pVM, BusAssignmentManager *BusMgr, PCFGMNODE pDevices);
+ HRESULT attachRawPCIDevices(PUVM pUVM, BusAssignmentManager *BusMgr, PCFGMNODE pDevices);
void attachStatusDriver(PCFGMNODE pCtlInst, PPDMLED *papLeds,
uint64_t uFirst, uint64_t uLast,
Console::MediumAttachmentMap *pmapMediumAttachments,
@@ -586,19 +618,18 @@ private:
PCFGMNODE pLunL0, PCFGMNODE pInst,
bool fAttachDetach, bool fIgnoreConnectFailure);
- static DECLCALLBACK(int) configGuestProperties(void *pvConsole, PVM pVM);
+ static DECLCALLBACK(int) configGuestProperties(void *pvConsole, PUVM pUVM);
static DECLCALLBACK(int) configGuestControl(void *pvConsole);
- static DECLCALLBACK(void) vmstateChangeCallback(PVM aVM, VMSTATE aState,
- VMSTATE aOldState, void *aUser);
- static DECLCALLBACK(int) unplugCpu(Console *pThis, PVM pVM, unsigned uCpu);
- static DECLCALLBACK(int) plugCpu(Console *pThis, PVM pVM, unsigned uCpu);
- HRESULT doMediumChange(IMediumAttachment *aMediumAttachment, bool fForce, PVM pVM);
- HRESULT doCPURemove(ULONG aCpu, PVM pVM);
- HRESULT doCPUAdd(ULONG aCpu, PVM pVM);
-
- HRESULT doNetworkAdapterChange(PVM pVM, const char *pszDevice, unsigned uInstance,
+ static DECLCALLBACK(void) vmstateChangeCallback(PUVM pUVM, VMSTATE enmState, VMSTATE enmOldState, void *pvUser);
+ static DECLCALLBACK(int) unplugCpu(Console *pThis, PUVM pUVM, VMCPUID idCpu);
+ static DECLCALLBACK(int) plugCpu(Console *pThis, PUVM pUVM, VMCPUID idCpu);
+ HRESULT doMediumChange(IMediumAttachment *aMediumAttachment, bool fForce, PUVM pUVM);
+ HRESULT doCPURemove(ULONG aCpu, PUVM pUVM);
+ HRESULT doCPUAdd(ULONG aCpu, PUVM pUVM);
+
+ HRESULT doNetworkAdapterChange(PUVM pUVM, const char *pszDevice, unsigned uInstance,
unsigned uLun, INetworkAdapter *aNetworkAdapter);
- static DECLCALLBACK(int) changeNetworkAttachment(Console *pThis, PVM pVM, const char *pszDevice,
+ static DECLCALLBACK(int) changeNetworkAttachment(Console *pThis, PUVM pUVM, const char *pszDevice,
unsigned uInstance, unsigned uLun,
INetworkAdapter *aNetworkAdapter);
@@ -609,40 +640,41 @@ private:
HRESULT attachUSBDevice(IUSBDevice *aHostDevice, ULONG aMaskedIfs);
HRESULT detachUSBDevice(const ComObjPtr<OUSBDevice> &aHostDevice);
- static DECLCALLBACK(int) usbAttachCallback(Console *that, PVM pVM, IUSBDevice *aHostDevice, PCRTUUID aUuid,
+ static DECLCALLBACK(int) usbAttachCallback(Console *that, PUVM pUVM, IUSBDevice *aHostDevice, PCRTUUID aUuid,
bool aRemote, const char *aAddress, void *pvRemoteBackend, USHORT aPortVersion, ULONG aMaskedIfs);
- static DECLCALLBACK(int) usbDetachCallback(Console *that, PVM pVM, PCRTUUID aUuid);
+ static DECLCALLBACK(int) usbDetachCallback(Console *that, PUVM pUVM, PCRTUUID aUuid);
#endif
static DECLCALLBACK(int) attachStorageDevice(Console *pThis,
- PVM pVM,
+ PUVM pUVM,
const char *pcszDevice,
unsigned uInstance,
StorageBus_T enmBus,
bool fUseHostIOCache,
- IMediumAttachment *aMediumAtt);
+ IMediumAttachment *aMediumAtt,
+ bool fSilent);
static DECLCALLBACK(int) detachStorageDevice(Console *pThis,
- PVM pVM,
+ PUVM pUVM,
const char *pcszDevice,
unsigned uInstance,
StorageBus_T enmBus,
- IMediumAttachment *aMediumAtt);
- HRESULT doStorageDeviceAttach(IMediumAttachment *aMediumAttachment, PVM pVM);
- HRESULT doStorageDeviceDetach(IMediumAttachment *aMediumAttachment, PVM pVM);
+ IMediumAttachment *aMediumAtt,
+ bool fSilent);
+ HRESULT doStorageDeviceAttach(IMediumAttachment *aMediumAttachment, PUVM pUVM, bool fSilent);
+ HRESULT doStorageDeviceDetach(IMediumAttachment *aMediumAttachment, PUVM pUVM, bool fSilent);
static DECLCALLBACK(int) fntTakeSnapshotWorker(RTTHREAD Thread, void *pvUser);
- static DECLCALLBACK(int) stateProgressCallback(PVM pVM, unsigned uPercent, void *pvUser);
+ static DECLCALLBACK(int) stateProgressCallback(PUVM pUVM, unsigned uPercent, void *pvUser);
- static DECLCALLBACK(void) genericVMSetErrorCallback(PVM pVM, void *pvUser, int rc, RT_SRC_POS_DECL,
+ static DECLCALLBACK(void) genericVMSetErrorCallback(PUVM pUVM, void *pvUser, int rc, RT_SRC_POS_DECL,
const char *pszErrorFmt, va_list va);
- static void setVMRuntimeErrorCallbackF(PVM pVM, void *pvUser, uint32_t fFatal,
- const char *pszErrorId, const char *pszFormat, ...);
- static DECLCALLBACK(void) setVMRuntimeErrorCallback(PVM pVM, void *pvUser, uint32_t fFatal,
+ void setVMRuntimeErrorCallbackF(uint32_t fFatal, const char *pszErrorId, const char *pszFormat, ...);
+ static DECLCALLBACK(void) setVMRuntimeErrorCallback(PUVM pUVM, void *pvUser, uint32_t fFatal,
const char *pszErrorId, const char *pszFormat, va_list va);
- HRESULT captureUSBDevices(PVM pVM);
+ HRESULT captureUSBDevices(PUVM pUVM);
void detachAllUSBDevices(bool aDone);
static DECLCALLBACK(int) powerUpThread(RTTHREAD Thread, void *pvUser);
@@ -654,6 +686,7 @@ private:
static DECLCALLBACK(void) vmm2User_NotifyEmtTerm(PCVMM2USERMETHODS pThis, PUVM pUVM, PUVMCPU pUVCpu);
static DECLCALLBACK(void) vmm2User_NotifyPdmtInit(PCVMM2USERMETHODS pThis, PUVM pUVM);
static DECLCALLBACK(void) vmm2User_NotifyPdmtTerm(PCVMM2USERMETHODS pThis, PUVM pUVM);
+ static DECLCALLBACK(void) vmm2User_NotifyResetTurnedIntoPowerOff(PCVMM2USERMETHODS pThis, PUVM pUVM);
static DECLCALLBACK(void *) drvStatus_QueryInterface(PPDMIBASE pInterface, const char *pszIID);
static DECLCALLBACK(void) drvStatus_UnitChanged(PPDMILEDCONNECTORS pInterface, unsigned iLUN);
@@ -695,6 +728,8 @@ private:
void guestPropertiesVRDPUpdateDisconnect(uint32_t u32ClientId);
#endif
+ bool isResetTurnedIntoPowerOff(void);
+
/** @name Teleporter support
* @{ */
static DECLCALLBACK(int) teleporterSrcThreadWrapper(RTTHREAD hThread, void *pvUser);
@@ -714,6 +749,8 @@ private:
const ComPtr<IVRDEServer> mVRDEServer;
ConsoleVRDPServer * const mConsoleVRDPServer;
+ bool mfVRDEChangeInProcess;
+ bool mfVRDEChangePending;
const ComObjPtr<Guest> mGuest;
const ComObjPtr<Keyboard> mKeyboard;
@@ -728,6 +765,7 @@ private:
#ifdef VBOX_WITH_EXTPACK
const ComObjPtr<ExtPackManager> mptrExtPackManager;
#endif
+ const ComObjPtr<EmulatedUSB> mEmulatedUSB;
USBDeviceList mUSBDevices;
RemoteUSBDeviceList mRemoteUSBDevices;
@@ -738,13 +776,13 @@ private:
/** The user mode VM handle. */
PUVM mpUVM;
- /** Holds the number of "readonly" mpVM callers (users) */
+ /** Holds the number of "readonly" mpUVM callers (users). */
uint32_t mVMCallers;
- /** Semaphore posted when the number of mpVM callers drops to zero */
+ /** Semaphore posted when the number of mpUVM callers drops to zero. */
RTSEMEVENT mVMZeroCallersSem;
- /** true when Console has entered the mpVM destruction phase */
+ /** true when Console has entered the mpUVM destruction phase. */
bool mVMDestroying : 1;
- /** true when power down is initiated by vmstateChangeCallback (EMT) */
+ /** true when power down is initiated by vmstateChangeCallback (EMT). */
bool mVMPoweredOff : 1;
/** true when vmstateChangeCallback shouldn't initiate a power down. */
bool mVMIsAlreadyPoweringOff : 1;
@@ -754,6 +792,10 @@ private:
bool mfSnapshotFolderExt4WarningShown : 1;
/** true if we already listed the disk type of the snapshot folder. */
bool mfSnapshotFolderDiskTypeShown : 1;
+ /** true if a USB controller is available (i.e. USB devices can be attached). */
+ bool mfVMHasUsbController : 1;
+ /** true if the VM power off was caused by reset. */
+ bool mfPowerOffCausedByReset : 1;
/** Pointer to the VMM -> User (that's us) callbacks. */
struct MYVMM2USERMETHODS : public VMM2USERMETHODS
@@ -772,9 +814,6 @@ private:
VMMDev * m_pVMMDev;
AudioSniffer * const mAudioSniffer;
Nvram * const mNvram;
-#ifdef VBOX_WITH_USB_VIDEO
- UsbWebcamInterface * const mUsbWebcamInterface;
-#endif
#ifdef VBOX_WITH_USB_CARDREADER
UsbCardReader * const mUsbCardReader;
#endif
diff --git a/src/VBox/Main/include/ConsoleVRDPServer.h b/src/VBox/Main/include/ConsoleVRDPServer.h
index e8e774ef..ee87367c 100644
--- a/src/VBox/Main/include/ConsoleVRDPServer.h
+++ b/src/VBox/Main/include/ConsoleVRDPServer.h
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2006-2010 Oracle Corporation
+ * Copyright (C) 2006-2012 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -27,6 +27,9 @@
#include <VBox/RemoteDesktop/VRDEMousePtr.h>
#include <VBox/RemoteDesktop/VRDESCard.h>
#include <VBox/RemoteDesktop/VRDETSMF.h>
+#define VRDE_VIDEOIN_WITH_VRDEINTERFACE /* Get the VRDE interface definitions. */
+#include <VBox/RemoteDesktop/VRDEVideoIn.h>
+#include <VBox/RemoteDesktop/VRDEInput.h>
#include <VBox/HostServices/VBoxClipboardExt.h>
#include <VBox/HostServices/VBoxHostChannel.h>
@@ -36,6 +39,8 @@
// ConsoleVRDPServer
///////////////////////////////////////////////////////////////////////////////
+class EmWebcam;
+
typedef struct _VRDPInputSynch
{
int cGuestNumLockAdaptions;
@@ -123,7 +128,7 @@ public:
* Forwarders to VRDP server library.
*/
void SendUpdate (unsigned uScreenId, void *pvUpdate, uint32_t cbUpdate) const;
- void SendResize (void) const;
+ void SendResize (void);
void SendUpdateBitmap (unsigned uScreenId, uint32_t x, uint32_t y, uint32_t w, uint32_t h) const;
void SendAudioSamples (void *pvSamples, uint32_t cSamples, VRDEAUDIOFORMAT format) const;
@@ -140,13 +145,17 @@ public:
uint32_t cBits);
void SendAudioInputEnd(void *pvUserCtx);
-#ifdef VBOX_WITH_USB_VIDEO
- int GetVideoFrameDimensions(uint16_t *pu16Heigh, uint16_t *pu16Width);
- int SendVideoSreamOn(bool fFetch);
-#endif
int SCardRequest(void *pvUser, uint32_t u32Function, const void *pvData, uint32_t cbData);
+ int VideoInDeviceAttach(const VRDEVIDEOINDEVICEHANDLE *pDeviceHandle, void *pvDeviceCtx);
+ int VideoInDeviceDetach(const VRDEVIDEOINDEVICEHANDLE *pDeviceHandle);
+ int VideoInGetDeviceDesc(void *pvUser, const VRDEVIDEOINDEVICEHANDLE *pDeviceHandle);
+ int VideoInControl(void *pvUser, const VRDEVIDEOINDEVICEHANDLE *pDeviceHandle,
+ const VRDEVIDEOINCTRLHDR *pReq, uint32_t cbReq);
+
+ Console *getConsole(void) { return mConsole; }
+
private:
/* Note: This is not a ComObjPtr here, because the ConsoleVRDPServer object
* is actually just a part of the Console.
@@ -156,6 +165,8 @@ private:
HVRDESERVER mhServer;
int mServerInterfaceVersion;
+ int32_t volatile mcInResize; /* Do not Stop the server if this is not 0. */
+
static int loadVRDPLibrary (const char *pszLibraryName);
/** Static because will never load this more than once! */
@@ -237,19 +248,21 @@ private:
uint32_t volatile mu32AudioInputClientId;
+ int32_t volatile mcClients;
+
static DECLCALLBACK(void) H3DORBegin(const void *pvContext, void **ppvInstance,
const char *pszFormat);
static DECLCALLBACK(void) H3DORGeometry(void *pvInstance,
int32_t x, int32_t y, uint32_t w, uint32_t h);
static DECLCALLBACK(void) H3DORVisibleRegion(void *pvInstance,
- uint32_t cRects, RTRECT *paRects);
+ uint32_t cRects, const RTRECT *paRects);
static DECLCALLBACK(void) H3DORFrame(void *pvInstance,
void *pvData, uint32_t cbData);
static DECLCALLBACK(void) H3DOREnd(void *pvInstance);
static DECLCALLBACK(int) H3DORContextProperty(const void *pvContext, uint32_t index,
void *pvBuffer, uint32_t cbBuffer, uint32_t *pcbOut);
- void remote3DRedirect(void);
+ void remote3DRedirect(bool fEnable);
/*
* VRDE server optional interfaces.
@@ -301,6 +314,49 @@ private:
static DECLCALLBACK(int) tsmfHostChannelControl(void *pvInstance, uint32_t u32Code,
const void *pvParm, uint32_t cbParm,
const void *pvData, uint32_t cbData, uint32_t *pcbDataReturned);
+ int tsmfLock(void);
+ void tsmfUnlock(void);
+ RTCRITSECT mTSMFLock;
+
+ /* Video input interface. */
+ VRDEVIDEOININTERFACE m_interfaceVideoIn;
+ VRDEVIDEOINCALLBACKS m_interfaceCallbacksVideoIn;
+ static DECLCALLBACK(void) VRDECallbackVideoInNotify(void *pvCallback,
+ uint32_t u32Id,
+ const void *pvData,
+ uint32_t cbData);
+ static DECLCALLBACK(void) VRDECallbackVideoInDeviceDesc(void *pvCallback,
+ int rcRequest,
+ void *pDeviceCtx,
+ void *pvUser,
+ const VRDEVIDEOINDEVICEDESC *pDeviceDesc,
+ uint32_t cbDevice);
+ static DECLCALLBACK(void) VRDECallbackVideoInControl(void *pvCallback,
+ int rcRequest,
+ void *pDeviceCtx,
+ void *pvUser,
+ const VRDEVIDEOINCTRLHDR *pControl,
+ uint32_t cbControl);
+ static DECLCALLBACK(void) VRDECallbackVideoInFrame(void *pvCallback,
+ int rcRequest,
+ void *pDeviceCtx,
+ const VRDEVIDEOINPAYLOADHDR *pFrame,
+ uint32_t cbFrame);
+ EmWebcam *mEmWebcam;
+
+ /* Input interface. */
+ VRDEINPUTINTERFACE m_interfaceInput;
+ VRDEINPUTCALLBACKS m_interfaceCallbacksInput;
+ static DECLCALLBACK(void) VRDECallbackInputSetup(void *pvCallback,
+ int rcRequest,
+ uint32_t u32Method,
+ const void *pvResult,
+ uint32_t cbResult);
+ static DECLCALLBACK(void) VRDECallbackInputEvent(void *pvCallback,
+ uint32_t u32Method,
+ const void *pvEvent,
+ uint32_t cbEvent);
+ uint64_t mu64TouchInputTimestampMCS;
};
diff --git a/src/VBox/Main/include/DHCPServerImpl.h b/src/VBox/Main/include/DHCPServerImpl.h
index 0773d7bf..f326405e 100644
--- a/src/VBox/Main/include/DHCPServerImpl.h
+++ b/src/VBox/Main/include/DHCPServerImpl.h
@@ -6,7 +6,7 @@
*/
/*
- * Copyright (C) 2006-2009 Oracle Corporation
+ * Copyright (C) 2006-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -29,7 +29,47 @@ struct NETIFINFO;
namespace settings
{
struct DHCPServer;
+ struct VmNameSlotKey;
}
+#ifdef RT_OS_WINDOWS
+# define DHCP_EXECUTABLE_NAME "VBoxNetDHCP.exe"
+#else
+# define DHCP_EXECUTABLE_NAME "VBoxNetDHCP"
+#endif
+
+class DHCPServerRunner: public NetworkServiceRunner
+{
+public:
+ DHCPServerRunner():NetworkServiceRunner(DHCP_EXECUTABLE_NAME){}
+ virtual ~DHCPServerRunner(){};
+
+ static const std::string kDsrKeyGateway;
+ static const std::string kDsrKeyLowerIp;
+ static const std::string kDsrKeyUpperIp;
+};
+
+/**
+ * for server configuration needs, it's perhaps better to use (VM,slot) pair
+ * (vm-name, slot) <----> (MAC)
+ *
+ * but for client configuration, when server will have MACs at hand, it'd be
+ * easier to requiest options by MAC.
+ * (MAC) <----> (option-list)
+ *
+ * Doubts: What should be done if MAC changed for (vm-name, slot), when syncing should?
+ * XML: serialization of dependecy (DHCP options) - (VM,slot) shouldn't be done via MAC in
+ * the middle.
+ */
+
+typedef std::map<DhcpOpt_T, com::Utf8Str> DhcpOptionMap;
+typedef DhcpOptionMap::value_type DhcpOptValuePair;
+typedef DhcpOptionMap::const_iterator DhcpOptConstIterator;
+typedef DhcpOptionMap::iterator DhcpOptIterator;
+
+typedef std::map<settings::VmNameSlotKey, DhcpOptionMap> VmSlot2OptionsMap;
+typedef VmSlot2OptionsMap::value_type VmSlot2OptionsPair;
+typedef VmSlot2OptionsMap::iterator VmSlot2OptionsIterator;
+
class ATL_NO_VTABLE DHCPServer :
public VirtualBoxBase,
@@ -69,30 +109,29 @@ public:
STDMETHOD(COMGETTER(LowerIP))(BSTR *aIPAddress);
STDMETHOD(COMGETTER(UpperIP))(BSTR *aIPAddress);
+ STDMETHOD(AddGlobalOption)(DhcpOpt_T aOption, IN_BSTR aValue);
+ STDMETHOD(COMGETTER(GlobalOptions))(ComSafeArrayOut(BSTR, aValue));
+ STDMETHOD(COMGETTER(VmConfigs))(ComSafeArrayOut(BSTR, aValue));
+ STDMETHOD(AddVmSlotOption)(IN_BSTR aVmName, LONG aSlot, DhcpOpt_T aOption, IN_BSTR aValue);
+ STDMETHOD(RemoveVmSlotOptions)(IN_BSTR aVmName, LONG aSlot);
+ STDMETHOD(GetVmSlotOptions)(IN_BSTR aVmName, LONG aSlot, ComSafeArrayOut(BSTR, aValues));
+ STDMETHOD(GetMacOptions)(IN_BSTR aMAC, ComSafeArrayOut(BSTR, aValues));
+ STDMETHOD(COMGETTER(EventSource))(IEventSource **aEventSource);
+
STDMETHOD(SetConfiguration)(IN_BSTR aIPAddress, IN_BSTR aNetworkMask, IN_BSTR aFromIPAddress, IN_BSTR aToIPAddress);
STDMETHOD(Start)(IN_BSTR aNetworkName, IN_BSTR aTrunkName, IN_BSTR aTrunkType);
STDMETHOD(Stop)();
private:
+ struct Data;
+ Data *m;
/** weak VirtualBox parent */
VirtualBox * const mVirtualBox;
-
const Bstr mName;
- struct Data
- {
- Data() : enabled(FALSE) {}
-
- Bstr IPAddress;
- Bstr networkMask;
- Bstr lowerIP;
- Bstr upperIP;
- BOOL enabled;
-
- DHCPServerRunner dhcp;
- } m;
-
+ DhcpOptionMap& findOptMapByVmNameSlot(const com::Utf8Str& aVmName,
+ LONG Slot);
};
#endif // ____H_H_DHCPSERVERIMPL
diff --git a/src/VBox/Main/include/DisplayImpl.h b/src/VBox/Main/include/DisplayImpl.h
index 1f783700..4bc1415a 100644
--- a/src/VBox/Main/include/DisplayImpl.h
+++ b/src/VBox/Main/include/DisplayImpl.h
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2006-2008 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -26,10 +26,15 @@
#include <VBox/VMMDev.h>
#include <VBox/VBoxVideo.h>
+#ifdef VBOX_WITH_CROGL
+# include <VBox/HostServices/VBoxCrOpenGLSvc.h>
+#endif
+
class Console;
struct VIDEORECCONTEXT;
-enum {
+enum
+{
ResizeStatus_Void,
ResizeStatus_InProgress,
ResizeStatus_UpdateDisplayData
@@ -56,6 +61,10 @@ typedef struct _DISPLAYFBINFO
uint16_t flags;
+ /* for saving the rectangles arrived during fb resize is in progress. */
+ PRTRECT mpSavedVisibleRegion;
+ uint32_t mcSavedVisibleRegion;
+
VBOXVIDEOINFOHOSTEVENTS *pHostEvents;
volatile uint32_t u32ResizeStatus;
@@ -63,7 +72,8 @@ typedef struct _DISPLAYFBINFO
/* The Framebuffer has default format and must be updates immediately. */
bool fDefaultFormat;
- struct {
+ struct
+ {
/* The rectangle that includes all dirty rectangles. */
int32_t xLeft;
int32_t xRight;
@@ -71,21 +81,23 @@ typedef struct _DISPLAYFBINFO
int32_t yBottom;
} dirtyRect;
- struct {
+ struct
+ {
bool fPending;
ULONG pixelFormat;
void *pvVRAM;
uint32_t bpp;
uint32_t cbLine;
- int w;
- int h;
+ uint32_t w;
+ uint32_t h;
uint16_t flags;
} pendingResize;
#ifdef VBOX_WITH_HGSMI
bool fVBVAEnabled;
uint32_t cVBVASkipUpdate;
- struct {
+ struct
+ {
int32_t xLeft;
int32_t yTop;
int32_t xRight;
@@ -93,12 +105,35 @@ typedef struct _DISPLAYFBINFO
} vbvaSkippedRect;
PVBVAHOSTFLAGS pVBVAHostFlags;
#endif /* VBOX_WITH_HGSMI */
+
+#ifdef VBOX_WITH_CROGL
+ struct
+ {
+ bool fPending;
+ ULONG x;
+ ULONG y;
+ ULONG width;
+ ULONG height;
+ } pendingViewportInfo;
+#endif /* VBOX_WITH_CROGL */
} DISPLAYFBINFO;
+class DisplayMouseInterface
+{
+public:
+ virtual int getScreenResolution(uint32_t cScreen, ULONG *pcx,
+ ULONG *pcy, ULONG *pcBPP, LONG *pXOrigin, LONG *pYOrigin) = 0;
+ virtual void getFramebufferDimensions(int32_t *px1, int32_t *py1,
+ int32_t *px2, int32_t *py2) = 0;
+};
+
+class VMMDev;
+
class ATL_NO_VTABLE Display :
public VirtualBoxBase,
VBOX_SCRIPTABLE_IMPL(IEventListener),
- VBOX_SCRIPTABLE_IMPL(IDisplay)
+ VBOX_SCRIPTABLE_IMPL(IDisplay),
+ public DisplayMouseInterface
{
public:
@@ -113,52 +148,74 @@ public:
COM_INTERFACE_ENTRY(IEventListener)
END_COM_MAP()
- DECLARE_EMPTY_CTOR_DTOR (Display)
+ DECLARE_EMPTY_CTOR_DTOR(Display)
HRESULT FinalConstruct();
void FinalRelease();
// public initializer/uninitializer for internal purposes only
- HRESULT init (Console *aParent);
+ HRESULT init(Console *aParent);
void uninit();
- int registerSSM(PVM pVM);
+ int registerSSM(PUVM pUVM);
// public methods only for internal purposes
- int handleDisplayResize (unsigned uScreenId, uint32_t bpp, void *pvVRAM, uint32_t cbLine, int w, int h, uint16_t flags);
- void handleDisplayUpdateLegacy (int x, int y, int cx, int cy);
- void handleDisplayUpdate (unsigned uScreenId, int x, int y, int w, int h);
+ int handleDisplayResize(unsigned uScreenId, uint32_t bpp, void *pvVRAM, uint32_t cbLine, uint32_t w, uint32_t h, uint16_t flags);
+ void handleDisplayUpdateLegacy(int x, int y, int cx, int cy);
+ void handleDisplayUpdate(unsigned uScreenId, int x, int y, int w, int h);
#ifdef VBOX_WITH_VIDEOHWACCEL
- void handleVHWACommandProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVHWACMD pCommand);
+ int handleVHWACommandProcess(PVBOXVHWACMD pCommand);
#endif
#ifdef VBOX_WITH_CRHGSMI
- void handleCrHgsmiCommandProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVDMACMD_CHROMIUM_CMD pCmd, uint32_t cbCmd);
- void handleCrHgsmiControlProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVDMACMD_CHROMIUM_CTL pCtl, uint32_t cbCtl);
+ void handleCrHgsmiCommandProcess(PVBOXVDMACMD_CHROMIUM_CMD pCmd, uint32_t cbCmd);
+ void handleCrHgsmiControlProcess(PVBOXVDMACMD_CHROMIUM_CTL pCtl, uint32_t cbCtl);
void handleCrHgsmiCommandCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam);
void handleCrHgsmiControlCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam);
#endif
+ int handleCrHgcmCtlSubmit(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd,
+ PFNCRCTLCOMPLETION pfnCompletion,
+ void *pvCompletion);
+#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
+ void handleCrAsyncCmdCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam);
+ void handleCrVRecScreenshotPerform(uint32_t uScreen,
+ uint32_t x, uint32_t y, uint32_t uPixelFormat, uint32_t uBitsPerPixel,
+ uint32_t uBytesPerLine, uint32_t uGuestWidth, uint32_t uGuestHeight,
+ uint8_t *pu8BufferAddress, uint64_t u64TimeStamp);
+ bool handleCrVRecScreenshotBegin(uint32_t uScreen, uint64_t u64TimeStamp);
+ void handleCrVRecScreenshotEnd(uint32_t uScreen, uint64_t u64TimeStamp);
+ void handleVRecCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext);
+#endif
+
+ int notifyCroglResize(const PVBVAINFOVIEW pView, const PVBVAINFOSCREEN pScreen, void *pvVRAM);
+
IFramebuffer *getFramebuffer()
{
return maFramebuffers[VBOX_VIDEO_PRIMARY_SCREEN].pFramebuffer;
}
- void getFramebufferDimensions(int32_t *px1, int32_t *py1, int32_t *px2,
- int32_t *py2);
-
- int handleSetVisibleRegion(uint32_t cRect, PRTRECT pRect);
- int handleQueryVisibleRegion(uint32_t *pcRect, PRTRECT pRect);
+ void getFramebufferDimensions(int32_t *px1, int32_t *py1, int32_t *px2, int32_t *py2);
+ int getScreenResolution(uint32_t cScreen, ULONG *pcx, ULONG *pcy,
+ ULONG *pcBPP, LONG *pXOrigin, LONG *pYOrigin)
+ {
+ return GetScreenResolution(cScreen, pcx, pcy, pcBPP, pXOrigin, pYOrigin);
+ }
- int VideoAccelEnable (bool fEnable, VBVAMEMORY *pVbvaMemory);
- void VideoAccelFlush (void);
+ int handleSetVisibleRegion(uint32_t cRect, PRTRECT pRect);
+ int handleQueryVisibleRegion(uint32_t *pcRect, PRTRECT pRect);
- bool VideoAccelAllowed (void);
+ int VideoAccelEnable(bool fEnable, VBVAMEMORY *pVbvaMemory);
+ void VideoAccelFlush(void);
+ bool VideoAccelAllowed(void);
+ void VideoAccelVRDP(bool fEnable);
- void VideoAccelVRDP (bool fEnable);
+ int VideoCaptureStart();
+ void VideoCaptureStop();
+ int VideoCaptureEnableScreens(ComSafeArrayIn(BOOL, aScreens));
// IEventListener methods
STDMETHOD(HandleEvent)(IEvent * aEvent);
// IDisplay methods
- STDMETHOD(GetScreenResolution)(ULONG aScreenId, ULONG *aWidth, ULONG *aHeight, ULONG *aBitsPerPixel);
+ STDMETHOD(GetScreenResolution)(ULONG aScreenId, ULONG *aWidth, ULONG *aHeight, ULONG *aBitsPerPixel, LONG *aXOrigin, LONG *aYOrigin);
STDMETHOD(SetFramebuffer)(ULONG aScreenId, IFramebuffer *aFramebuffer);
STDMETHOD(GetFramebuffer)(ULONG aScreenId, IFramebuffer **aFramebuffer, LONG *aXOrigin, LONG *aYOrigin);
STDMETHOD(SetVideoModeHint)(ULONG aDisplay, BOOL aEnabled, BOOL aChangeOrigin, LONG aOriginX, LONG aOriginY, ULONG aWidth, ULONG aHeight, ULONG aBitsPerPixel);
@@ -178,13 +235,17 @@ public:
private:
- void updateDisplayData(void);
+ int updateDisplayData(void);
#ifdef VBOX_WITH_CRHGSMI
void setupCrHgsmiData(void);
void destructCrHgsmiData(void);
#endif
+#ifdef VBOX_WITH_CROGL
+ void crViewportNotify(class VMMDev *pVMMDev, ULONG aScreenId, ULONG x, ULONG y, ULONG width, ULONG height);
+#endif
+
static DECLCALLBACK(int) changeFramebuffer(Display *that, IFramebuffer *aFB, unsigned uScreenId);
static DECLCALLBACK(void*) drvQueryInterface(PPDMIBASE pInterface, const char *pszIID);
@@ -200,17 +261,21 @@ private:
static DECLCALLBACK(void) displayProcessDisplayDataCallback(PPDMIDISPLAYCONNECTOR pInterface, void *pvVRAM, unsigned uScreenId);
#ifdef VBOX_WITH_VIDEOHWACCEL
- static DECLCALLBACK(void) displayVHWACommandProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVHWACMD pCommand);
+ static DECLCALLBACK(int) displayVHWACommandProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVHWACMD pCommand);
#endif
#ifdef VBOX_WITH_CRHGSMI
static DECLCALLBACK(void) displayCrHgsmiCommandProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVDMACMD_CHROMIUM_CMD pCmd, uint32_t cbCmd);
static DECLCALLBACK(void) displayCrHgsmiControlProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVDMACMD_CHROMIUM_CTL pCtl, uint32_t cbCtl);
- static DECLCALLBACK(void) displayCrHgsmiCommandCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext);
- static DECLCALLBACK(void) displayCrHgsmiControlCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext);
+ static DECLCALLBACK(void) displayCrHgsmiCommandCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext);
+ static DECLCALLBACK(void) displayCrHgsmiControlCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext);
#endif
-
+ static DECLCALLBACK(int) displayCrHgcmCtlSubmit(PPDMIDISPLAYCONNECTOR pInterface,
+ struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd,
+ PFNCRCTLCOMPLETION pfnCompletion,
+ void *pvCompletion);
+ static DECLCALLBACK(void) displayCrHgcmCtlSubmitCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext);
#ifdef VBOX_WITH_HGSMI
static DECLCALLBACK(int) displayVBVAEnable(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, PVBVAHOSTFLAGS pHostFlags);
static DECLCALLBACK(void) displayVBVADisable(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId);
@@ -221,6 +286,18 @@ private:
static DECLCALLBACK(int) displayVBVAMousePointerShape(PPDMIDISPLAYCONNECTOR pInterface, bool fVisible, bool fAlpha, uint32_t xHot, uint32_t yHot, uint32_t cx, uint32_t cy, const void *pvShape);
#endif
+#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
+ static DECLCALLBACK(void) displayCrVRecScreenshotPerform(void *pvCtx, uint32_t uScreen,
+ uint32_t x, uint32_t y,
+ uint32_t uBitsPerPixel, uint32_t uBytesPerLine,
+ uint32_t uGuestWidth, uint32_t uGuestHeight,
+ uint8_t *pu8BufferAddress, uint64_t u64TimeStamp);
+ static DECLCALLBACK(bool) displayCrVRecScreenshotBegin(void *pvCtx, uint32_t uScreen, uint64_t u64TimeStamp);
+ static DECLCALLBACK(void) displayCrVRecScreenshotEnd(void *pvCtx, uint32_t uScreen, uint64_t u64TimeStamp);
+
+ static DECLCALLBACK(void) displayVRecCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext);
+ static DECLCALLBACK(void) displayCrAsyncCmdCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext);
+#endif
static DECLCALLBACK(void) displaySSMSaveScreenshot(PSSMHANDLE pSSM, void *pvUser);
static DECLCALLBACK(int) displaySSMLoadScreenshot(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass);
@@ -238,15 +315,13 @@ private:
unsigned mcMonitors;
DISPLAYFBINFO maFramebuffers[SchemaDefs::MaxGuestMonitors];
- bool mFramebufferOpened;
-
/* arguments of the last handleDisplayResize() call */
- void *mLastAddress;
- uint32_t mLastBytesPerLine;
- uint32_t mLastBitsPerPixel;
- int mLastWidth;
- int mLastHeight;
- uint16_t mLastFlags;
+ void *mLastAddress;
+ uint32_t mLastBytesPerLine;
+ uint32_t mLastBitsPerPixel;
+ uint32_t mLastWidth;
+ uint32_t mLastHeight;
+ uint16_t mLastFlags;
VBVAMEMORY *mpVbvaMemory;
bool mfVideoAccelEnabled;
@@ -258,59 +333,75 @@ private:
VBVAMEMORY *mpPendingVbvaMemory;
bool mfPendingVideoAccelEnable;
bool mfMachineRunning;
+#ifdef VBOX_WITH_CROGL
+ bool mfCrOglDataHidden;
+#endif
uint8_t *mpu8VbvaPartial;
- uint32_t mcbVbvaPartial;
+ uint32_t mcbVbvaPartial;
#ifdef VBOX_WITH_CRHGSMI
/* for fast host hgcm calls */
HGCMCVSHANDLE mhCrOglSvc;
#endif
+#ifdef VBOX_WITH_CROGL
+ CR_MAIN_INTERFACE mCrOglCallbacks;
+ volatile uint32_t mfCrOglVideoRecState;
+ CRVBOXHGCMTAKESCREENSHOT mCrOglScreenshotData;
+#endif
- bool vbvaFetchCmd (VBVACMDHDR **ppHdr, uint32_t *pcbCmd);
- void vbvaReleaseCmd (VBVACMDHDR *pHdr, int32_t cbCmd);
+ bool vbvaFetchCmd(VBVACMDHDR **ppHdr, uint32_t *pcbCmd);
+ void vbvaReleaseCmd(VBVACMDHDR *pHdr, int32_t cbCmd);
- void handleResizeCompletedEMT (void);
+ void handleResizeCompletedEMT(void);
RTCRITSECT mVBVALock;
volatile uint32_t mfu32PendingVideoAccelDisable;
- int vbvaLock(void);
+ int vbvaLock(void);
void vbvaUnlock(void);
+ RTCRITSECT mSaveSeamlessRectLock;
+ int SaveSeamlessRectLock(void);
+ void SaveSeamlessRectUnLock(void);
+
public:
- static int displayTakeScreenshotEMT(Display *pDisplay, ULONG aScreenId, uint8_t **ppu8Data, size_t *pcbData, uint32_t *pu32Width, uint32_t *pu32Height);
+ static int displayTakeScreenshotEMT(Display *pDisplay, ULONG aScreenId, uint8_t **ppu8Data, size_t *pcbData, uint32_t *pu32Width, uint32_t *pu32Height);
+
+#ifdef VBOX_WITH_CROGL
+ static BOOL displayCheckTakeScreenshotCrOgl(Display *pDisplay, ULONG aScreenId, uint8_t *pu8Data, uint32_t u32Width, uint32_t u32Height);
+#endif
private:
- static void InvalidateAndUpdateEMT(Display *pDisplay);
- static int drawToScreenEMT(Display *pDisplay, ULONG aScreenId, BYTE *address, ULONG x, ULONG y, ULONG width, ULONG height);
+ static void InvalidateAndUpdateEMT(Display *pDisplay, unsigned uId, bool fUpdateAll);
+ static int drawToScreenEMT(Display *pDisplay, ULONG aScreenId, BYTE *address, ULONG x, ULONG y, ULONG width, ULONG height);
- int videoAccelRefreshProcess(void);
+ int videoAccelRefreshProcess(void);
/* Functions run under VBVA lock. */
- int videoAccelEnable (bool fEnable, VBVAMEMORY *pVbvaMemory);
- void videoAccelFlush (void);
+ int videoAccelEnable(bool fEnable, VBVAMEMORY *pVbvaMemory);
+ void videoAccelFlush(void);
+
+#ifdef VBOX_WITH_CROGL
+ int crOglWindowsShow(bool fShow);
+#endif
#ifdef VBOX_WITH_HGSMI
volatile uint32_t mu32UpdateVBVAFlags;
#endif
#ifdef VBOX_WITH_VPX
- VIDEORECCONTEXT *mpVideoRecContext;
+ VIDEORECCONTEXT *mpVideoRecCtx;
+ bool maVideoRecEnabled[SchemaDefs::MaxGuestMonitors];
#endif
};
-void gdImageCopyResampled (uint8_t *dst, uint8_t *src,
- int dstX, int dstY,
- int srcX, int srcY,
- int dstW, int dstH, int srcW, int srcH);
-
+void gdImageCopyResampled(uint8_t *dst, uint8_t *src,
+ int dstX, int dstY, int srcX, int srcY,
+ int dstW, int dstH, int srcW, int srcH);
-void BitmapScale32 (uint8_t *dst,
- int dstW, int dstH,
- const uint8_t *src,
- int iDeltaLine,
- int srcW, int srcH);
+void BitmapScale32(uint8_t *dst, int dstW, int dstH,
+ const uint8_t *src, int iDeltaLine, int srcW, int srcH);
int DisplayMakePNG(uint8_t *pu8Data, uint32_t cx, uint32_t cy,
uint8_t **ppu8PNG, uint32_t *pcbPNG, uint32_t *pcxPNG, uint32_t *pcyPNG,
diff --git a/src/VBox/Main/include/DisplayUtils.h b/src/VBox/Main/include/DisplayUtils.h
index 6c4a9b16..7b8d9f86 100644
--- a/src/VBox/Main/include/DisplayUtils.h
+++ b/src/VBox/Main/include/DisplayUtils.h
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 2010 Oracle Corporation
+ * Copyright (C) 2010-2012 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Main/include/EmulatedUSBImpl.h b/src/VBox/Main/include/EmulatedUSBImpl.h
new file mode 100644
index 00000000..fd8af0ab
--- /dev/null
+++ b/src/VBox/Main/include/EmulatedUSBImpl.h
@@ -0,0 +1,85 @@
+/* $Id: EmulatedUSBImpl.h $ */
+
+/** @file
+ *
+ * Emulated USB devices manager.
+ */
+
+/*
+ * Copyright (C) 2013 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef EMULATEDUSB_IMPL_H_
+#define EMULATEDUSB_IMPL_H_
+
+#include "EmulatedUSBWrap.h"
+
+class Console;
+class EUSBWEBCAM;
+
+typedef std::map<Utf8Str, EUSBWEBCAM *> WebcamsMap;
+
+class ATL_NO_VTABLE EmulatedUSB :
+ public EmulatedUSBWrap
+{
+public:
+
+ DECLARE_EMPTY_CTOR_DTOR(EmulatedUSB)
+
+ HRESULT FinalConstruct();
+ void FinalRelease();
+
+ /* Public initializer/uninitializer for internal purposes only. */
+ HRESULT init(ComObjPtr<Console> pConsole);
+ void uninit();
+
+ /* Public method for internal use. */
+ static DECLCALLBACK(int) eusbCallback(void *pv, const char *pszId, uint32_t iEvent,
+ const void *pvData, uint32_t cbData);
+
+ HRESULT webcamAttachInternal(const com::Utf8Str &aPath,
+ const com::Utf8Str &aSettings,
+ const char *pszDriver,
+ void *pvObject);
+ HRESULT webcamDetachInternal(const com::Utf8Str &aPath);
+
+private:
+
+ static DECLCALLBACK(int) eusbCallbackEMT(EmulatedUSB *pThis, char *pszId, uint32_t iEvent,
+ void *pvData, uint32_t cbData);
+
+ HRESULT webcamPathFromId(com::Utf8Str *pPath, const char *pszId);
+
+ // wrapped IEmulatedUSB properties
+ virtual HRESULT getWebcams(std::vector<com::Utf8Str> &aWebcams);
+
+ // wrapped IEmulatedUSB methods
+ virtual HRESULT webcamAttach(const com::Utf8Str &aPath,
+ const com::Utf8Str &aSettings);
+ virtual HRESULT webcamDetach(const com::Utf8Str &aPath);
+
+ /* Data. */
+ struct Data
+ {
+ Data()
+ {
+ }
+
+ ComObjPtr<Console> pConsole;
+ WebcamsMap webcams;
+ };
+
+ Data m;
+};
+
+#endif // EMULATEDUSB_IMPL_H_
+
+/* vi: set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/src/VBox/Main/include/EventImpl.h b/src/VBox/Main/include/EventImpl.h
index e2979ce6..414ce013 100644
--- a/src/VBox/Main/include/EventImpl.h
+++ b/src/VBox/Main/include/EventImpl.h
@@ -144,7 +144,7 @@ public:
void FinalRelease();
// public initializer/uninitializer for internal purposes only
- HRESULT init(IUnknown *aParent);
+ HRESULT init();
void uninit();
// IEventSource methods
diff --git a/src/VBox/Main/include/ExtPackManagerImpl.h b/src/VBox/Main/include/ExtPackManagerImpl.h
index c3f9a78d..642e77b5 100644
--- a/src/VBox/Main/include/ExtPackManagerImpl.h
+++ b/src/VBox/Main/include/ExtPackManagerImpl.h
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2010 Oracle Corporation
+ * Copyright (C) 2010-2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -22,6 +22,7 @@
#include <VBox/ExtPack/ExtPack.h>
#include <iprt/fs.h>
+#if !defined(VBOX_COM_INPROC)
/**
* An extension pack file.
*/
@@ -84,6 +85,7 @@ private:
friend class ExtPackManager;
};
+#endif
/**
@@ -146,6 +148,7 @@ public:
bool callVmPowerOffHook(IConsole *a_pConsole, PVM a_pVM, AutoWriteLock *a_pLock);
HRESULT checkVrde(void);
HRESULT getVrdpLibraryName(Utf8Str *a_pstrVrdeLibrary);
+ HRESULT getLibraryName(const char *a_pszModuleName, Utf8Str *a_pstrLibrary);
bool wantsToBeDefaultVrde(void) const;
HRESULT refresh(bool *pfCanDelete);
/** @} */
@@ -165,6 +168,7 @@ protected:
VBOXEXTPACKMODKIND enmKind, char *pszFound, size_t cbFound, bool *pfNative);
static DECLCALLBACK(int) hlpGetFilePath(PCVBOXEXTPACKHLP pHlp, const char *pszFilename, char *pszPath, size_t cbPath);
static DECLCALLBACK(VBOXEXTPACKCTX) hlpGetContext(PCVBOXEXTPACKHLP pHlp);
+ static DECLCALLBACK(int) hlpLoadHGCMService(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IConsole) *pConsole, const char *pszServiceLibrary, const char *pszServiceName);
static DECLCALLBACK(int) hlpReservedN(PCVBOXEXTPACKHLP pHlp);
/** @} */
@@ -214,10 +218,12 @@ class ATL_NO_VTABLE ExtPackManager :
/** @name Internal interfaces used by other Main classes.
* @{ */
+#if !defined(VBOX_COM_INPROC)
static DECLCALLBACK(int) doInstallThreadProc(RTTHREAD hThread, void *pvJob);
HRESULT doInstall(ExtPackFile *a_pExtPackFile, bool a_fReplace, Utf8Str const *a_pstrDisplayInfo);
static DECLCALLBACK(int) doUninstallThreadProc(RTTHREAD hThread, void *pvJob);
HRESULT doUninstall(const Utf8Str *a_pstrName, bool a_fForcedRemoval, const Utf8Str *a_pstrDisplayInfo);
+#endif
void callAllVirtualBoxReadyHooks(void);
void callAllConsoleReadyHooks(IConsole *a_pConsole);
void callAllVmCreatedHooks(IMachine *a_pMachine);
@@ -226,6 +232,7 @@ class ATL_NO_VTABLE ExtPackManager :
void callAllVmPowerOffHooks(IConsole *a_pConsole, PVM a_pVM);
HRESULT checkVrdeExtPack(Utf8Str const *a_pstrExtPack);
int getVrdeLibraryPathForExtPack(Utf8Str const *a_pstrExtPack, Utf8Str *a_pstrVrdeLibrary);
+ HRESULT getLibraryPathForExtPack(const char *a_pszModuleName, Utf8Str const *a_pstrExtPack, Utf8Str *a_pstrLibrary);
HRESULT getDefaultVrdeExtPack(Utf8Str *a_pstrExtPack);
bool isExtPackUsable(const char *a_pszExtPack);
void dumpAllToReleaseLog(void);
diff --git a/src/VBox/Main/include/ExtPackUtil.h b/src/VBox/Main/include/ExtPackUtil.h
index 0fd97bf0..5b09fe6f 100644
--- a/src/VBox/Main/include/ExtPackUtil.h
+++ b/src/VBox/Main/include/ExtPackUtil.h
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2010 Oracle Corporation
+ * Copyright (C) 2010-2012 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Main/include/Global.h b/src/VBox/Main/include/Global.h
index bfe53af4..38d9a470 100644
--- a/src/VBox/Main/include/Global.h
+++ b/src/VBox/Main/include/Global.h
@@ -193,6 +193,14 @@ public:
static const char *stringifyDeviceType(DeviceType_T aType);
/**
+ * Stringify a reason.
+ *
+ * @returns Pointer to a read only string.
+ * @param aReason The reason code.
+ */
+ static const char *stringifyReason(Reason_T aReason);
+
+ /**
* Try convert a COM status code to a VirtualBox status code (VBox/err.h).
*
* @returns VBox status code.
diff --git a/src/VBox/Main/include/GuestCtrlImplPrivate.h b/src/VBox/Main/include/GuestCtrlImplPrivate.h
index b8feac32..bd8a0f47 100644
--- a/src/VBox/Main/include/GuestCtrlImplPrivate.h
+++ b/src/VBox/Main/include/GuestCtrlImplPrivate.h
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2011-2012 Oracle Corporation
+ * Copyright (C) 2011-2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -18,6 +18,8 @@
#ifndef ____H_GUESTIMPLPRIVATE
#define ____H_GUESTIMPLPRIVATE
+#include "ConsoleImpl.h"
+
#include <iprt/asm.h>
#include <iprt/semaphore.h>
@@ -36,172 +38,13 @@ using namespace com;
using namespace guestControl;
#endif
-/** Maximum number of guest sessions a VM can have. */
-#define VBOX_GUESTCTRL_MAX_SESSIONS 32
-/** Maximum number of guest objects (processes, files, ...)
- * a guest session can have. */
-#define VBOX_GUESTCTRL_MAX_OBJECTS _2K
-/** Maximum of callback contexts a guest process can have. */
-#define VBOX_GUESTCTRL_MAX_CONTEXTS _64K
-
-/** Builds a context ID out of the session ID, object ID and an
- * increasing count. */
-#define VBOX_GUESTCTRL_CONTEXTID_MAKE(uSession, uObject, uCount) \
- ( (uint32_t)((uSession) & 0x1f) << 27 \
- | (uint32_t)((uObject) & 0x7ff) << 16 \
- | (uint32_t)((uCount) & 0xffff) \
- )
-/** Gets the session ID out of a context ID. */
-#define VBOX_GUESTCTRL_CONTEXTID_GET_SESSION(uContextID) \
- ((uContextID) >> 27)
-/** Gets the process ID out of a context ID. */
-#define VBOX_GUESTCTRL_CONTEXTID_GET_OBJECT(uContextID) \
- (((uContextID) >> 16) & 0x7ff)
-/** Gets the conext count of a process out of a context ID. */
-#define VBOX_GUESTCTRL_CONTEXTID_GET_COUNT(uContextID) \
- ((uContextID) & 0xffff)
-
/** Vector holding a process' CPU affinity. */
typedef std::vector <LONG> ProcessAffinity;
/** Vector holding process startup arguments. */
typedef std::vector <Utf8Str> ProcessArguments;
class GuestProcessStreamBlock;
-
-
-/**
- * Base class for a all guest control callbacks/events.
- */
-class GuestCtrlEvent
-{
-public:
-
- GuestCtrlEvent(void);
-
- virtual ~GuestCtrlEvent(void);
-
- /** @todo Copy/comparison operator? */
-
-public:
-
- int Cancel(void);
-
- bool Canceled(void);
-
- virtual void Destroy(void);
-
- int Init(void);
-
- virtual int Signal(int rc = VINF_SUCCESS);
-
- int GetResultCode(void) { return mRC; }
-
- int Wait(ULONG uTimeoutMS);
-
-protected:
-
- /** Was the callback canceled? */
- bool fCanceled;
- /** Did the callback complete? */
- bool fCompleted;
- /** The event semaphore for triggering
- * the actual event. */
- RTSEMEVENT hEventSem;
- /** The waiting mutex. */
- RTSEMMUTEX hEventMutex;
- /** Overall result code. */
- int mRC;
-};
-
-
-/*
- * Class representing a guest control callback.
- */
-class GuestCtrlCallback : public GuestCtrlEvent
-{
-public:
-
- GuestCtrlCallback(void);
-
- GuestCtrlCallback(eVBoxGuestCtrlCallbackType enmType);
-
- virtual ~GuestCtrlCallback(void);
-
-public:
-
- void Destroy(void);
-
- int Init(eVBoxGuestCtrlCallbackType enmType);
-
- eVBoxGuestCtrlCallbackType GetCallbackType(void) { return mType; }
-
- const void* GetDataRaw(void) const { return pvData; }
-
- size_t GetDataSize(void) { return cbData; }
-
- const void* GetPayloadRaw(void) const { return pvPayload; }
-
- size_t GetPayloadSize(void) { return cbPayload; }
-
- int SetData(const void *pvCallback, size_t cbCallback);
-
- int SetPayload(const void *pvToWrite, size_t cbToWrite);
-
-protected:
-
- /** Pointer to actual callback data. */
- void *pvData;
- /** Size of user-supplied data. */
- size_t cbData;
- /** The callback type. */
- eVBoxGuestCtrlCallbackType mType;
- /** Callback flags. */
- uint32_t uFlags;
- /** Payload which will be available on successful
- * waiting (optional). */
- void *pvPayload;
- /** Size of the payload (optional). */
- size_t cbPayload;
-};
-typedef std::map < uint32_t, GuestCtrlCallback* > GuestCtrlCallbacks;
-
-
-/*
- * Class representing a guest control process waiting
- * event.
- */
-class GuestProcessWaitEvent : public GuestCtrlEvent
-{
-public:
-
- GuestProcessWaitEvent(void);
-
- GuestProcessWaitEvent(uint32_t uWaitFlags);
-
- virtual ~GuestProcessWaitEvent(void);
-
-public:
-
- void Destroy(void);
-
- int Init(uint32_t uWaitFlags);
-
- uint32_t GetWaitFlags(void) { return ASMAtomicReadU32(&mFlags); }
-
- ProcessWaitResult_T GetWaitResult(void) { return mResult; }
-
- int GetWaitRc(void) { return mRC; }
-
- int Signal(ProcessWaitResult_T enmResult, int rc = VINF_SUCCESS);
-
-protected:
-
- /** The waiting flag(s). The specifies what to
- * wait for. See ProcessWaitFlag_T. */
- uint32_t mFlags;
- /** Structure containing the overall result. */
- ProcessWaitResult_T mResult;
-};
+class GuestSession;
/**
@@ -261,6 +104,43 @@ protected:
/**
+ * Structure for keeping all the relevant guest directory
+ * information around.
+ */
+struct GuestDirectoryOpenInfo
+{
+ /** The directory path. */
+ Utf8Str mPath;
+ /** Then open filter. */
+ Utf8Str mFilter;
+ /** Opening flags. */
+ uint32_t mFlags;
+};
+
+
+/**
+ * Structure for keeping all the relevant guest file
+ * information around.
+ */
+struct GuestFileOpenInfo
+{
+ /** The filename. */
+ Utf8Str mFileName;
+ /** Then file's opening mode. */
+ Utf8Str mOpenMode;
+ /** The file's disposition mode. */
+ Utf8Str mDisposition;
+ /** The file's sharing mode.
+ **@todo Not implemented yet.*/
+ Utf8Str mSharingMode;
+ /** Octal creation mode. */
+ uint32_t mCreationMode;
+ /** The initial offset on open. */
+ uint64_t mInitialOffset;
+};
+
+
+/**
* Structure representing information of a
* file system object.
*/
@@ -269,6 +149,7 @@ struct GuestFsObjData
/** Helper function to extract the data from
* a certin VBoxService tool's guest stream block. */
int FromLs(const GuestProcessStreamBlock &strmBlk);
+ int FromMkTemp(const GuestProcessStreamBlock &strmBlk);
int FromStat(const GuestProcessStreamBlock &strmBlk);
int64_t mAccessTime;
@@ -295,8 +176,37 @@ struct GuestFsObjData
/**
- * Structure for keeping all the relevant process
- * starting parameters around.
+ * Structure for keeping all the relevant guest session
+ * startup parameters around.
+ */
+class GuestSessionStartupInfo
+{
+public:
+
+ GuestSessionStartupInfo(void)
+ : mIsInternal(false /* Non-internal session */),
+ mOpenTimeoutMS(30 * 1000 /* 30s opening timeout */),
+ mOpenFlags(0 /* No opening flags set */) { }
+
+ /** The session's friendly name. Optional. */
+ Utf8Str mName;
+ /** The session's unique ID. Used to encode
+ * a context ID. */
+ uint32_t mID;
+ /** Flag indicating if this is an internal session
+ * or not. Internal session are not accessible by
+ * public API clients. */
+ bool mIsInternal;
+ /** Timeout (in ms) used for opening the session. */
+ uint32_t mOpenTimeoutMS;
+ /** Session opening flags. */
+ uint32_t mOpenFlags;
+};
+
+
+/**
+ * Structure for keeping all the relevant guest process
+ * startup parameters around.
*/
class GuestProcessStartupInfo
{
@@ -316,8 +226,12 @@ public:
/** Process creation flags. */
uint32_t mFlags;
ULONG mTimeoutMS;
+ /** Process priority. */
ProcessPriority_T mPriority;
- ProcessAffinity mAffinity;
+ /** Process affinity. At the moment we
+ * only support 64 VCPUs. API and
+ * guest can do more already! */
+ uint64_t mAffinity;
};
@@ -371,19 +285,21 @@ public:
size_t GetCount(void) const;
+ int GetRc(void) const;
+
const char* GetString(const char *pszKey) const;
int GetUInt32Ex(const char *pszKey, uint32_t *puVal) const;
uint32_t GetUInt32(const char *pszKey) const;
- bool IsEmpty(void) { return m_mapPairs.empty(); }
+ bool IsEmpty(void) { return mPairs.empty(); }
int SetValue(const char *pszKey, const char *pszValue);
protected:
- GuestCtrlStreamPairMap m_mapPairs;
+ GuestCtrlStreamPairMap mPairs;
};
/** Vector containing multiple allocated stream pair objects. */
@@ -414,9 +330,9 @@ public:
void Dump(const char *pszFile);
#endif
- uint32_t GetOffset();
+ uint32_t GetOffset() { return m_cbOffset; }
- uint32_t GetSize();
+ size_t GetSize() { return m_cbSize; }
int ParseBlock(GuestProcessStreamBlock &streamBlock);
@@ -425,7 +341,7 @@ protected:
/** Currently allocated size of internal stream buffer. */
uint32_t m_cbAllocated;
/** Currently used size of allocated internal stream buffer. */
- uint32_t m_cbSize;
+ size_t m_cbSize;
/** Current offset within the internal stream buffer. */
uint32_t m_cbOffset;
/** Internal stream buffer. */
@@ -478,5 +394,282 @@ public:
Utf8Str strPassword;
ULONG uFlags;
};
+
+class GuestWaitEventPayload
+{
+
+public:
+
+ GuestWaitEventPayload(void)
+ : uType(0),
+ cbData(0),
+ pvData(NULL) { }
+
+ GuestWaitEventPayload(uint32_t uTypePayload,
+ const void *pvPayload, uint32_t cbPayload)
+ {
+ if (cbPayload)
+ {
+ pvData = RTMemAlloc(cbPayload);
+ if (pvData)
+ {
+ uType = uTypePayload;
+
+ memcpy(pvData, pvPayload, cbPayload);
+ cbData = cbPayload;
+ }
+ else /* Throw IPRT error. */
+ throw VERR_NO_MEMORY;
+ }
+ else
+ {
+ uType = uTypePayload;
+
+ pvData = NULL;
+ cbData = 0;
+ }
+ }
+
+ virtual ~GuestWaitEventPayload(void)
+ {
+ Clear();
+ }
+
+ GuestWaitEventPayload& operator=(const GuestWaitEventPayload &that)
+ {
+ CopyFromDeep(that);
+ return *this;
+ }
+
+public:
+
+ void Clear(void)
+ {
+ if (pvData)
+ {
+ RTMemFree(pvData);
+ cbData = 0;
+ }
+ uType = 0;
+ }
+
+ int CopyFromDeep(const GuestWaitEventPayload &payload)
+ {
+ Clear();
+
+ int rc = VINF_SUCCESS;
+ if (payload.cbData)
+ {
+ Assert(payload.cbData);
+ pvData = RTMemAlloc(payload.cbData);
+ if (pvData)
+ {
+ memcpy(pvData, payload.pvData, payload.cbData);
+ cbData = payload.cbData;
+ uType = payload.uType;
+ }
+ else
+ rc = VERR_NO_MEMORY;
+ }
+
+ return rc;
+ }
+
+ const void* Raw(void) const { return pvData; }
+
+ size_t Size(void) const { return cbData; }
+
+ uint32_t Type(void) const { return uType; }
+
+ void* MutableRaw(void) { return pvData; }
+
+protected:
+
+ /** Type of payload. */
+ uint32_t uType;
+ /** Size (in bytes) of payload. */
+ uint32_t cbData;
+ /** Pointer to actual payload data. */
+ void *pvData;
+};
+
+class GuestWaitEventBase
+{
+
+protected:
+
+ GuestWaitEventBase(void);
+ virtual ~GuestWaitEventBase(void);
+
+public:
+
+ uint32_t ContextID(void) { return mCID; };
+ int GuestResult(void) { return mGuestRc; }
+ int Result(void) { return mRc; }
+ GuestWaitEventPayload & Payload(void) { return mPayload; }
+ int SignalInternal(int rc, int guestRc, const GuestWaitEventPayload *pPayload);
+ int Wait(RTMSINTERVAL uTimeoutMS);
+
+protected:
+
+ int Init(uint32_t uCID);
+
+protected:
+
+ /* Shutdown indicator. */
+ bool mfAborted;
+ /* Associated context ID (CID). */
+ uint32_t mCID;
+ /** The event semaphore for triggering
+ * the actual event. */
+ RTSEMEVENT mEventSem;
+ /** The event's overall result. If
+ * set to VERR_GSTCTL_GUEST_ERROR,
+ * mGuestRc will contain the actual
+ * error code from the guest side. */
+ int mRc;
+ /** The event'S overall result from the
+ * guest side. If used, mRc must be
+ * set to VERR_GSTCTL_GUEST_ERROR. */
+ int mGuestRc;
+ /** The event's payload data. Optional. */
+ GuestWaitEventPayload mPayload;
+};
+
+/** List of public guest event types. */
+typedef std::list < VBoxEventType_T > GuestEventTypes;
+
+class GuestWaitEvent : public GuestWaitEventBase
+{
+
+public:
+
+ GuestWaitEvent(uint32_t uCID);
+ GuestWaitEvent(uint32_t uCID, const GuestEventTypes &lstEvents);
+ virtual ~GuestWaitEvent(void);
+
+public:
+
+ int Cancel(void);
+ const ComPtr<IEvent> Event(void) { return mEvent; }
+ int SignalExternal(IEvent *pEvent);
+ const GuestEventTypes Types(void) { return mEventTypes; }
+ size_t TypeCount(void) { return mEventTypes.size(); }
+
+protected:
+
+ int Init(uint32_t uCID);
+
+protected:
+
+ /** List of public event types this event should
+ * be signalled on. Optional. */
+ GuestEventTypes mEventTypes;
+ /** Pointer to the actual public event, if any. */
+ ComPtr<IEvent> mEvent;
+};
+/** Map of pointers to guest events. The primary key
+ * contains the context ID. */
+typedef std::map < uint32_t, GuestWaitEvent* > GuestWaitEvents;
+/** Map of wait events per public guest event. Nice for
+ * faster lookups when signalling a whole event group. */
+typedef std::map < VBoxEventType_T, GuestWaitEvents > GuestEventGroup;
+
+class GuestBase
+{
+
+public:
+
+ GuestBase(void);
+ virtual ~GuestBase(void);
+
+public:
+
+ /** Signals a wait event using a public guest event; also used for
+ * for external event listeners. */
+ int signalWaitEvent(VBoxEventType_T aType, IEvent *aEvent);
+ /** Signals a wait event using a guest rc. */
+ int signalWaitEventInternal(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, int guestRc, const GuestWaitEventPayload *pPayload);
+ /** Signals a wait event without letting public guest events know,
+ * extended director's cut version. */
+ int signalWaitEventInternalEx(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, int rc, int guestRc, const GuestWaitEventPayload *pPayload);
+public:
+
+ int baseInit(void);
+ void baseUninit(void);
+ int cancelWaitEvents(void);
+ int dispatchGeneric(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
+ int generateContextID(uint32_t uSessionID, uint32_t uObjectID, uint32_t *puContextID);
+ int registerWaitEvent(uint32_t uSessionID, uint32_t uObjectID, GuestWaitEvent **ppEvent);
+ int registerWaitEvent(uint32_t uSessionID, uint32_t uObjectID, const GuestEventTypes &lstEvents, GuestWaitEvent **ppEvent);
+ void unregisterWaitEvent(GuestWaitEvent *pEvent);
+ int waitForEvent(GuestWaitEvent *pEvent, uint32_t uTimeoutMS, VBoxEventType_T *pType, IEvent **ppEvent);
+
+protected:
+
+ /** Pointer to the console object. Needed
+ * for HGCM (VMMDev) communication. */
+ Console *mConsole;
+ /** The next upcoming context ID for this object. */
+ uint32_t mNextContextID;
+ /** Local listener for handling the waiting events
+ * internally. */
+ ComPtr<IEventListener> mLocalListener;
+ /** Critical section for wait events access. */
+ RTCRITSECT mWaitEventCritSect;
+ /** Map of registered wait events per event group. */
+ GuestEventGroup mWaitEventGroups;
+ /** Map of registered wait events. */
+ GuestWaitEvents mWaitEvents;
+};
+
+/**
+ * Virtual class (interface) for guest objects (processes, files, ...) --
+ * contains all per-object callback management.
+ */
+class GuestObject : public GuestBase
+{
+
+public:
+
+ GuestObject(void);
+ virtual ~GuestObject(void);
+
+public:
+
+ ULONG getObjectID(void) { return mObjectID; }
+
+protected:
+
+ virtual int onRemove(void) = 0;
+
+ /** Callback dispatcher -- must be implemented by the actual object. */
+ virtual int callbackDispatcher(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb) = 0;
+
+protected:
+
+ int bindToSession(Console *pConsole, GuestSession *pSession, uint32_t uObjectID);
+ int registerWaitEvent(const GuestEventTypes &lstEvents, GuestWaitEvent **ppEvent);
+ int sendCommand(uint32_t uFunction, uint32_t uParms, PVBOXHGCMSVCPARM paParms);
+
+protected:
+
+ /**
+ * Commom parameters for all derived objects, when then have
+ * an own mData structure to keep their specific data around.
+ */
+
+ /** Pointer to parent session. Per definition
+ * this objects *always* lives shorter than the
+ * parent. */
+ GuestSession *mSession;
+ /** The object ID -- must be unique for each guest
+ * object and is encoded into the context ID. Must
+ * be set manually when initializing the object.
+ *
+ * For guest processes this is the internal PID,
+ * for guest files this is the internal file ID. */
+ uint32_t mObjectID;
+};
#endif // ____H_GUESTIMPLPRIVATE
diff --git a/src/VBox/Main/include/GuestDirectoryImpl.h b/src/VBox/Main/include/GuestDirectoryImpl.h
index 62981067..7c454eaf 100644
--- a/src/VBox/Main/include/GuestDirectoryImpl.h
+++ b/src/VBox/Main/include/GuestDirectoryImpl.h
@@ -29,6 +29,7 @@ class GuestSession;
*/
class ATL_NO_VTABLE GuestDirectory :
public VirtualBoxBase,
+ public GuestObject,
VBOX_SCRIPTABLE_IMPL(IGuestDirectory)
{
public:
@@ -43,7 +44,7 @@ public:
END_COM_MAP()
DECLARE_EMPTY_CTOR_DTOR(GuestDirectory)
- int init(GuestSession *aSession, const Utf8Str &strPath, const Utf8Str &strFilter, uint32_t uFlags);
+ int init(Console *pConsole, GuestSession *pSession, ULONG uDirID, const GuestDirectoryOpenInfo &openInfo);
void uninit(void);
HRESULT FinalConstruct(void);
void FinalRelease(void);
@@ -60,6 +61,10 @@ public:
public:
/** @name Public internal methods.
* @{ */
+ int callbackDispatcher(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
+ static Utf8Str guestErrorToString(int guestRc);
+ int onRemove(void);
+ static HRESULT setErrorExternal(VirtualBoxBase *pInterface, int guestRc);
/** @} */
private:
@@ -70,10 +75,10 @@ private:
struct Data
{
- GuestSession *mSession;
- Utf8Str mName;
- Utf8Str mFilter;
- uint32_t mFlags;
+ /** The directory's open info. */
+ GuestDirectoryOpenInfo mOpenInfo;
+ /** The directory's ID. */
+ uint32_t mID;
GuestProcessTool mProcessTool;
} mData;
};
diff --git a/src/VBox/Main/include/GuestFileImpl.h b/src/VBox/Main/include/GuestFileImpl.h
index cea13081..7890cb48 100644
--- a/src/VBox/Main/include/GuestFileImpl.h
+++ b/src/VBox/Main/include/GuestFileImpl.h
@@ -1,11 +1,11 @@
/* $Id: GuestFileImpl.h $ */
/** @file
- * VirtualBox Main - XXX.
+ * VirtualBox Main - Guest file handling.
*/
/*
- * Copyright (C) 2012 Oracle Corporation
+ * Copyright (C) 2012-2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -20,9 +20,12 @@
#define ____H_GUESTFILEIMPL
#include "VirtualBoxBase.h"
+#include "EventImpl.h"
#include "GuestFsObjInfoImpl.h"
+#include "GuestCtrlImplPrivate.h"
+class Console;
class GuestSession;
class GuestProcess;
@@ -31,6 +34,7 @@ class GuestProcess;
*/
class ATL_NO_VTABLE GuestFile :
public VirtualBoxBase,
+ public GuestObject,
VBOX_SCRIPTABLE_IMPL(IGuestFile)
{
public:
@@ -45,7 +49,7 @@ public:
END_COM_MAP()
DECLARE_EMPTY_CTOR_DTOR(GuestFile)
- int init(GuestSession *pSession, const Utf8Str &strPath, const Utf8Str &strOpenMode, const Utf8Str &strDisposition, uint32_t uCreationMode, int64_t iOffset, int *pGuestRc);
+ int init(Console *pConsole, GuestSession *pSession, ULONG uFileID, const GuestFileOpenInfo &openInfo);
void uninit(void);
HRESULT FinalConstruct(void);
void FinalRelease(void);
@@ -54,11 +58,14 @@ public:
/** @name IFile interface.
* @{ */
STDMETHOD(COMGETTER(CreationMode))(ULONG *aCreationMode);
- STDMETHOD(COMGETTER(Disposition))(ULONG *aDisposition);
+ STDMETHOD(COMGETTER(Disposition))(BSTR *aDisposition);
+ STDMETHOD(COMGETTER(EventSource))(IEventSource ** aEventSource);
STDMETHOD(COMGETTER(FileName))(BSTR *aFileName);
+ STDMETHOD(COMGETTER(Id))(ULONG *aID);
STDMETHOD(COMGETTER(InitialSize))(LONG64 *aInitialSize);
STDMETHOD(COMGETTER(Offset))(LONG64 *aOffset);
- STDMETHOD(COMGETTER(OpenMode))(ULONG *aOpenMode);
+ STDMETHOD(COMGETTER(OpenMode))(BSTR *aOpenMode);
+ STDMETHOD(COMGETTER(Status))(FileStatus_T *aStatus);
STDMETHOD(Close)(void);
STDMETHOD(QueryInfo)(IFsObjInfo **aInfo);
@@ -73,22 +80,49 @@ public:
public:
/** @name Public internal methods.
* @{ */
- static uint32_t getDispositionFromString(const Utf8Str &strDisposition);
- static uint32_t getOpenModeFromString(const Utf8Str &strOpenMode);
+ int callbackDispatcher(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
+ int closeFile(int *pGuestRc);
+ EventSource *getEventSource(void) { return mEventSource; }
+ static Utf8Str guestErrorToString(int guestRc);
+ int onFileNotify(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData);
+ int onGuestDisconnected(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData);
+ int onRemove(void);
+ int openFile(uint32_t uTimeoutMS, int *pGuestRc);
+ int readData(uint32_t uSize, uint32_t uTimeoutMS, void* pvData, uint32_t cbData, uint32_t* pcbRead);
+ int readDataAt(uint64_t uOffset, uint32_t uSize, uint32_t uTimeoutMS, void* pvData, size_t cbData, size_t* pcbRead);
+ int seekAt(int64_t iOffset, GUEST_FILE_SEEKTYPE eSeekType, uint32_t uTimeoutMS, uint64_t *puOffset);
+ static HRESULT setErrorExternal(VirtualBoxBase *pInterface, int guestRc);
+ int setFileStatus(FileStatus_T fileStatus, int fileRc);
+ int waitForOffsetChange(GuestWaitEvent *pEvent, uint32_t uTimeoutMS, uint64_t *puOffset);
+ int waitForRead(GuestWaitEvent *pEvent, uint32_t uTimeoutMS, void *pvData, size_t cbData, uint32_t *pcbRead);
+ int waitForStatusChange(GuestWaitEvent *pEvent, uint32_t uTimeoutMS, FileStatus_T *pFileStatus, int *pGuestRc);
+ int waitForWrite(GuestWaitEvent *pEvent, uint32_t uTimeoutMS, uint32_t *pcbWritten);
+ int writeData(uint32_t uTimeoutMS, void *pvData, uint32_t cbData, uint32_t *pcbWritten);
+ int writeDataAt(uint64_t uOffset, uint32_t uTimeoutMS, void *pvData, uint32_t cbData, uint32_t *pcbWritten);
/** @} */
private:
+ /** This can safely be used without holding any locks.
+ * An AutoCaller suffices to prevent it being destroy while in use and
+ * internally there is a lock providing the necessary serialization. */
+ const ComObjPtr<EventSource> mEventSource;
+
struct Data
{
- /** The associate session this file belongs to. */
- GuestSession *mSession;
- uint32_t mCreationMode;
- uint32_t mDisposition;
- Utf8Str mFileName;
- int64_t mInitialSize;
- uint32_t mOpenMode;
- int64_t mOffset;
+ /** The file's open info. */
+ GuestFileOpenInfo mOpenInfo;
+ /** The file's initial size on open. */
+ uint64_t mInitialSize;
+ /** The file's ID. */
+ uint32_t mID;
+ /** The current file status. */
+ FileStatus_T mStatus;
+ /** The last returned process status
+ * returned from the guest side. */
+ int mLastError;
+ /** The file's current offset. */
+ uint64_t mOffCurrent;
} mData;
};
diff --git a/src/VBox/Main/include/GuestImpl.h b/src/VBox/Main/include/GuestImpl.h
index 5ae18886..1a856eec 100644
--- a/src/VBox/Main/include/GuestImpl.h
+++ b/src/VBox/Main/include/GuestImpl.h
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -21,6 +21,7 @@
#include <iprt/list.h>
#include <iprt/time.h>
#include <VBox/ostypes.h>
+#include <VBox/vmm/stam.h>
#include "AdditionsFacilityImpl.h"
#include "GuestCtrlImplPrivate.h"
@@ -79,6 +80,7 @@ public:
STDMETHOD(COMGETTER(AdditionsRunLevel)) (AdditionsRunLevelType_T *aRunLevel);
STDMETHOD(COMGETTER(AdditionsVersion))(BSTR *a_pbstrAdditionsVersion);
STDMETHOD(COMGETTER(AdditionsRevision))(ULONG *a_puAdditionsRevision);
+ STDMETHOD(COMGETTER(EventSource))(IEventSource ** aEventSource);
STDMETHOD(COMGETTER(Facilities)) (ComSafeArrayOut(IAdditionsFacility *, aFacilities));
STDMETHOD(COMGETTER(Sessions)) (ComSafeArrayOut(IGuestSession *, aSessions));
STDMETHOD(COMGETTER(MemoryBalloonSize)) (ULONG *aMemoryBalloonSize);
@@ -99,21 +101,22 @@ public:
STDMETHOD(DragGHPending)(ULONG uScreenId, ComSafeArrayOut(BSTR, formats), ComSafeArrayOut(DragAndDropAction_T, allowedActions), DragAndDropAction_T *pDefaultAction);
STDMETHOD(DragGHDropped)(IN_BSTR strFormat, DragAndDropAction_T action, IProgress **ppProgress);
STDMETHOD(DragGHGetData)(ComSafeArrayOut(BYTE, data));
+ // Guest control.
+ STDMETHOD(CreateSession)(IN_BSTR aUser, IN_BSTR aPassword, IN_BSTR aDomain, IN_BSTR aSessionName, IGuestSession **aGuestSession);
+ STDMETHOD(FindSession)(IN_BSTR aSessionName, ComSafeArrayOut(IGuestSession *, aSessions));
// Misc stuff
STDMETHOD(InternalGetStatistics)(ULONG *aCpuUser, ULONG *aCpuKernel, ULONG *aCpuIdle,
ULONG *aMemTotal, ULONG *aMemFree, ULONG *aMemBalloon, ULONG *aMemShared, ULONG *aMemCache,
ULONG *aPageTotal, ULONG *aMemAllocTotal, ULONG *aMemFreeTotal, ULONG *aMemBalloonTotal, ULONG *aMemSharedTotal);
- STDMETHOD(UpdateGuestAdditions)(IN_BSTR aSource, ComSafeArrayIn(AdditionsUpdateFlag_T, aFlags), IProgress **aProgress);
- STDMETHOD(CreateSession)(IN_BSTR aUser, IN_BSTR aPassword, IN_BSTR aDomain, IN_BSTR aSessionName, IGuestSession **aGuestSession);
- STDMETHOD(FindSession)(IN_BSTR aSessionName, ComSafeArrayOut(IGuestSession *, aSessions));
+ STDMETHOD(UpdateGuestAdditions)(IN_BSTR aSource, ComSafeArrayIn(IN_BSTR, aArguments), ComSafeArrayIn(AdditionsUpdateFlag_T, aFlags), IProgress **aProgress);
public:
/** @name Static internal methods.
* @{ */
#ifdef VBOX_WITH_GUEST_CONTROL
/** Static callback for handling guest control notifications. */
- static DECLCALLBACK(int) notifyCtrlDispatcher(void *pvExtension, uint32_t u32Function, void *pvParms, uint32_t cbParms);
- static void staticUpdateStats(RTTIMERLR hTimerLR, void *pvUser, uint64_t iTick);
+ static DECLCALLBACK(int) notifyCtrlDispatcher(void *pvExtension, uint32_t u32Function, void *pvData, uint32_t cbData);
+ static DECLCALLBACK(void) staticUpdateStats(RTTIMERLR hTimerLR, void *pvUser, uint64_t iTick);
#endif
/** @} */
@@ -126,6 +129,7 @@ public:
bool facilityIsActive(VBoxGuestFacilityType enmFacility);
void facilityUpdate(VBoxGuestFacilityType a_enmFacility, VBoxGuestFacilityStatus a_enmStatus, uint32_t a_fFlags, PCRTTIMESPEC a_pTimeSpecTS);
void setAdditionsStatus(VBoxGuestFacilityType a_enmFacility, VBoxGuestFacilityStatus a_enmStatus, uint32_t a_fFlags, PCRTTIMESPEC a_pTimeSpecTS);
+ void onUserStateChange(Bstr aUser, Bstr aDomain, VBoxGuestUserState enmState, const uint8_t *puDetails, uint32_t cbDetails);
void setSupportedFeatures(uint32_t aCaps);
HRESULT setStatistic(ULONG aCpuId, GUESTSTATTYPE enmType, ULONG aVal);
BOOL isPageFusionEnabled();
@@ -135,12 +139,11 @@ public:
return setErrorInternal(aResultCode, getStaticClassIID(), getStaticComponentName(), aText, false, true);
}
#ifdef VBOX_WITH_GUEST_CONTROL
- int dispatchToSession(uint32_t uContextID, uint32_t uFunction, void *pvData, size_t cbData);
+ int dispatchToSession(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
uint32_t getAdditionsVersion(void) { return mData.mAdditionsVersionFull; }
Console *getConsole(void) { return mParent; }
int sessionRemove(GuestSession *pSession);
- int sessionCreate(const Utf8Str &strUser, const Utf8Str &strPassword, const Utf8Str &strDomain,
- const Utf8Str &strSessionName, ComObjPtr<GuestSession> &pGuestSession);
+ int sessionCreate(const GuestSessionStartupInfo &ssInfo, const GuestCredentials &guestCreds, ComObjPtr<GuestSession> &pGuestSession);
inline bool sessionExists(uint32_t uSessionID);
#endif
/** @} */
@@ -149,6 +152,8 @@ private:
/** @name Private internal methods.
* @{ */
void updateStats(uint64_t iTick);
+ static int staticEnumStatsCallback(const char *pszName, STAMTYPE enmType, void *pvSample, STAMUNIT enmUnit,
+ STAMVISIBILITY enmVisiblity, const char *pszDesc, void *pvUser);
/** @} */
typedef std::map< AdditionsFacilityType_T, ComObjPtr<AdditionsFacility> > FacilityMap;
@@ -174,21 +179,29 @@ private:
Bstr mInterfaceVersion;
GuestSessions mGuestSessions;
uint32_t mNextSessionID;
- };
+ } mData;
- ULONG mMemoryBalloonSize;
- ULONG mStatUpdateInterval;
- ULONG mCurrentGuestStat[GUESTSTATTYPE_MAX];
- ULONG mGuestValidStats;
- BOOL mCollectVMMStats;
- BOOL mfPageFusionEnabled;
+ ULONG mMemoryBalloonSize;
+ ULONG mStatUpdateInterval;
+ uint64_t mNetStatRx;
+ uint64_t mNetStatTx;
+ uint64_t mNetStatLastTs;
+ ULONG mCurrentGuestStat[GUESTSTATTYPE_MAX];
+ ULONG mVmValidStats;
+ BOOL mCollectVMMStats;
+ BOOL mfPageFusionEnabled;
- Console *mParent;
- Data mData;
+ Console *mParent;
#ifdef VBOX_WITH_GUEST_CONTROL
+ /**
+ * This can safely be used without holding any locks.
+ * An AutoCaller suffices to prevent it being destroy while in use and
+ * internally there is a lock providing the necessary serialization.
+ */
+ const ComObjPtr<EventSource> mEventSource;
/** General extension callback for guest control. */
- HGCMSVCEXTHANDLE mhExtCtrl;
+ HGCMSVCEXTHANDLE mhExtCtrl;
#endif
#ifdef VBOX_WITH_DRAG_AND_DROP
diff --git a/src/VBox/Main/include/GuestProcessImpl.h b/src/VBox/Main/include/GuestProcessImpl.h
index 8b83eb2e..95564b4d 100644
--- a/src/VBox/Main/include/GuestProcessImpl.h
+++ b/src/VBox/Main/include/GuestProcessImpl.h
@@ -1,11 +1,11 @@
/* $Id: GuestProcessImpl.h $ */
/** @file
- * VirtualBox Main - XXX.
+ * VirtualBox Main - Guest process handling.
*/
/*
- * Copyright (C) 2012 Oracle Corporation
+ * Copyright (C) 2012-2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -26,10 +26,11 @@ class Console;
class GuestSession;
/**
- * TODO
+ * Class for handling a guest process.
*/
class ATL_NO_VTABLE GuestProcess :
public VirtualBoxBase,
+ public GuestObject,
VBOX_SCRIPTABLE_IMPL(IGuestProcess)
{
public:
@@ -54,6 +55,7 @@ public:
* @{ */
STDMETHOD(COMGETTER(Arguments))(ComSafeArrayOut(BSTR, aArguments));
STDMETHOD(COMGETTER(Environment))(ComSafeArrayOut(BSTR, aEnvironment));
+ STDMETHOD(COMGETTER(EventSource))(IEventSource ** aEventSource);
STDMETHOD(COMGETTER(ExecutablePath))(BSTR *aExecutablePath);
STDMETHOD(COMGETTER(ExitCode))(LONG *aExitCode);
STDMETHOD(COMGETTER(Name))(BSTR *aName);
@@ -71,82 +73,73 @@ public:
public:
/** @name Public internal methods.
* @{ */
- int callbackDispatcher(uint32_t uContextID, uint32_t uFunction, void *pvData, size_t cbData);
- inline bool callbackExists(uint32_t uContextID);
+ int callbackDispatcher(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
inline int checkPID(uint32_t uPID);
static Utf8Str guestErrorToString(int guestRc);
- bool isReady(void);
- ULONG getProcessID(void) { return mData.mProcessID; }
- int readData(uint32_t uHandle, uint32_t uSize, uint32_t uTimeoutMS, void *pvData, size_t cbData, size_t *pcbRead, int *pGuestRc);
+ int onRemove(void);
+ int readData(uint32_t uHandle, uint32_t uSize, uint32_t uTimeoutMS, void *pvData, size_t cbData, uint32_t *pcbRead, int *pGuestRc);
static HRESULT setErrorExternal(VirtualBoxBase *pInterface, int guestRc);
- int startProcess(int *pGuestRc);
+ int startProcess(uint32_t uTimeoutMS, int *pGuestRc);
int startProcessAsync(void);
- int terminateProcess(void);
+ int terminateProcess(uint32_t uTimeoutMS, int *pGuestRc);
+ static ProcessWaitResult_T waitFlagsToResultEx(uint32_t fWaitFlags, ProcessStatus_T oldStatus, ProcessStatus_T newStatus, uint32_t uProcFlags, uint32_t uProtocol);
+ ProcessWaitResult_T waitFlagsToResult(uint32_t fWaitFlags);
int waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, ProcessWaitResult_T &waitResult, int *pGuestRc);
+ int waitForInputNotify(GuestWaitEvent *pEvent, uint32_t uHandle, uint32_t uTimeoutMS, ProcessInputStatus_T *pInputStatus, uint32_t *pcbProcessed);
+ int waitForOutput(GuestWaitEvent *pEvent, uint32_t uHandle, uint32_t uTimeoutMS, void* pvData, size_t cbData, uint32_t *pcbRead);
+ int waitForStatusChange(GuestWaitEvent *pEvent, uint32_t uTimeoutMS, ProcessStatus_T *pProcessStatus, int *pGuestRc);
+ static bool waitResultImpliesEx(ProcessWaitResult_T waitResult, ProcessStatus_T procStatus, uint32_t uProcFlags, uint32_t uProtocol);
int writeData(uint32_t uHandle, uint32_t uFlags, void *pvData, size_t cbData, uint32_t uTimeoutMS, uint32_t *puWritten, int *pGuestRc);
/** @} */
protected:
/** @name Protected internal methods.
* @{ */
- inline int callbackAdd(GuestCtrlCallback *pCallback, uint32_t *puContextID);
- inline int callbackRemove(uint32_t uContextID);
inline bool isAlive(void);
- int onGuestDisconnected(GuestCtrlCallback *pCallback, PCALLBACKDATACLIENTDISCONNECTED pData);
- int onProcessInputStatus(GuestCtrlCallback *pCallback, PCALLBACKDATAEXECINSTATUS pData);
- int onProcessNotifyIO(GuestCtrlCallback *pCallback, PCALLBACKDATAEXECSTATUS pData);
- int onProcessStatusChange(GuestCtrlCallback *pCallback, PCALLBACKDATAEXECSTATUS pData);
- int onProcessOutput(GuestCtrlCallback *pCallback, PCALLBACKDATAEXECOUT pData);
+ inline bool hasEnded(void);
+ int onGuestDisconnected(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData);
+ int onProcessInputStatus(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData);
+ int onProcessNotifyIO(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData);
+ int onProcessStatusChange(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData);
+ int onProcessOutput(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData);
int prepareExecuteEnv(const char *pszEnv, void **ppvList, ULONG *pcbList, ULONG *pcEnvVars);
- int sendCommand(uint32_t uFunction, uint32_t uParms, PVBOXHGCMSVCPARM paParms);
int setProcessStatus(ProcessStatus_T procStatus, int procRc);
- int signalWaiters(ProcessWaitResult_T enmWaitResult, int rc = VINF_SUCCESS);
static DECLCALLBACK(int) startProcessThread(RTTHREAD Thread, void *pvUser);
/** @} */
private:
+ /**
+ * This can safely be used without holding any locks.
+ * An AutoCaller suffices to prevent it being destroy while in use and
+ * internally there is a lock providing the necessary serialization.
+ */
+ const ComObjPtr<EventSource> mEventSource;
+
struct Data
{
- /** Pointer to parent session. Per definition
- * this objects *always* lives shorter than the
- * parent. */
- GuestSession *mParent;
- /** Pointer to the console object. Needed
- * for HGCM (VMMDev) communication. */
- Console *mConsole;
- /** All related callbacks to this process. */
- GuestCtrlCallbacks mCallbacks;
- /** The process start information. */
+ /** The process startup information. */
GuestProcessStartupInfo mProcess;
/** Exit code if process has been terminated. */
LONG mExitCode;
/** PID reported from the guest. */
ULONG mPID;
- /** Internal, host-side process ID. */
- ULONG mProcessID;
/** The current process status. */
ProcessStatus_T mStatus;
- int mRC;
- /** The next upcoming context ID. */
- ULONG mNextContextID;
- /** The mutex for protecting the waiter(s). */
- RTSEMMUTEX mWaitMutex;
- /** How many waiters? At the moment there can only
- * be one. */
- uint32_t mWaitCount;
- /** The actual process event for doing the waits.
- * At the moment we only support one wait a time. */
- GuestProcessWaitEvent *mWaitEvent;
+ /** The last returned process status
+ * returned from the guest side. */
+ int mLastError;
} mData;
};
/**
* Guest process tool flags.
*/
-/** No flags specified. */
+/** No flags specified; wait until process terminates.
+ * The maximum waiting time is set in the process' startup
+ * info. */
#define GUESTPROCESSTOOL_FLAG_NONE 0
-/** Run until next stream block from stdout has been
+/** Wait until next stream block from stdout has been
* read in completely, then return.
*/
#define GUESTPROCESSTOOL_FLAG_STDOUT_BLOCK RT_BIT(0)
@@ -178,13 +171,18 @@ public:
bool IsRunning(void);
+ static int Run(GuestSession *pGuestSession, const GuestProcessStartupInfo &startupInfo, int *pGuestRc);
+
+ static int RunEx(GuestSession *pGuestSession, const GuestProcessStartupInfo &startupInfo, GuestCtrlStreamObjects *pStrmOutObjects,
+ uint32_t cStrmOutObjects, int *pGuestRc);
+
int TerminatedOk(LONG *pExitCode);
- void Terminate(void);
+ int Terminate(uint32_t uTimeoutMS, int *pGuestRc);
protected:
- GuestSession *pSession;
+ ComObjPtr<GuestSession> pSession;
ComObjPtr<GuestProcess> pProcess;
GuestProcessStartupInfo mStartupInfo;
GuestProcessStream mStdOut;
diff --git a/src/VBox/Main/include/GuestSessionImpl.h b/src/VBox/Main/include/GuestSessionImpl.h
index fc2bc307..263ed6d7 100644
--- a/src/VBox/Main/include/GuestSessionImpl.h
+++ b/src/VBox/Main/include/GuestSessionImpl.h
@@ -1,11 +1,11 @@
/* $Id: GuestSessionImpl.h $ */
/** @file
- * VirtualBox Main - XXX.
+ * VirtualBox Main - Guest session handling.
*/
/*
- * Copyright (C) 2012 Oracle Corporation
+ * Copyright (C) 2012-2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -20,6 +20,7 @@
#define ____H_GUESTSESSIONIMPL
#include "VirtualBoxBase.h"
+#include "EventImpl.h"
#include "GuestCtrlImplPrivate.h"
#include "GuestProcessImpl.h"
@@ -66,6 +67,33 @@ protected:
};
/**
+ * Task for opening a guest session.
+ */
+class SessionTaskOpen : public GuestSessionTask
+{
+public:
+
+ SessionTaskOpen(GuestSession *pSession,
+ uint32_t uFlags,
+ uint32_t uTimeoutMS);
+
+ virtual ~SessionTaskOpen(void);
+
+public:
+
+ int Run(int *pGuestRc);
+ int RunAsync(const Utf8Str &strDesc, ComObjPtr<Progress> &pProgress);
+ static int taskThread(RTTHREAD Thread, void *pvUser);
+
+protected:
+
+ /** Session creation flags. */
+ uint32_t mFlags;
+ /** Session creation timeout (in ms). */
+ uint32_t mTimeoutMS;
+};
+
+/**
* Task for copying files from host to the guest.
*/
class SessionTaskCopyTo : public GuestSessionTask
@@ -130,7 +158,8 @@ class SessionTaskUpdateAdditions : public GuestSessionTask
public:
SessionTaskUpdateAdditions(GuestSession *pSession,
- const Utf8Str &strSource, uint32_t uFlags);
+ const Utf8Str &strSource, const ProcessArguments &aArguments,
+ uint32_t uFlags);
virtual ~SessionTaskUpdateAdditions(void);
@@ -191,6 +220,8 @@ protected:
GuestProcessStartupInfo mProcInfo;
};
+ int addProcessArguments(ProcessArguments &aArgumentsDest,
+ const ProcessArguments &aArgumentsSource);
int copyFileToGuest(GuestSession *pSession, PRTISOFSFILE pISO,
Utf8Str const &strFileSource, const Utf8Str &strFileDest,
bool fOptional, uint32_t *pcbSize);
@@ -201,6 +232,8 @@ protected:
/** The (optionally) specified Guest Additions .ISO on the host
* which will be used for the updating process. */
Utf8Str mSource;
+ /** (Optional) installer command line arguments. */
+ ProcessArguments mArguments;
/** Update flags. */
uint32_t mFlags;
};
@@ -210,6 +243,7 @@ protected:
*/
class ATL_NO_VTABLE GuestSession :
public VirtualBoxBase,
+ public GuestBase,
VBOX_SCRIPTABLE_IMPL(IGuestSession)
{
public:
@@ -223,7 +257,7 @@ public:
END_COM_MAP()
DECLARE_EMPTY_CTOR_DTOR(GuestSession)
- int init(Guest *aGuest, ULONG aSessionID, Utf8Str aUser, Utf8Str aPassword, Utf8Str aDomain, Utf8Str aName);
+ int init(Guest *pGuest, const GuestSessionStartupInfo &ssInfo, const GuestCredentials &guestCreds);
void uninit(void);
HRESULT FinalConstruct(void);
void FinalRelease(void);
@@ -235,13 +269,16 @@ public:
STDMETHOD(COMGETTER(Domain))(BSTR *aDomain);
STDMETHOD(COMGETTER(Name))(BSTR *aName);
STDMETHOD(COMGETTER(Id))(ULONG *aId);
+ STDMETHOD(COMGETTER(Status))(GuestSessionStatus_T *aStatus);
STDMETHOD(COMGETTER(Timeout))(ULONG *aTimeout);
STDMETHOD(COMSETTER(Timeout))(ULONG aTimeout);
+ STDMETHOD(COMGETTER(ProtocolVersion))(ULONG *aVersion);
STDMETHOD(COMGETTER(Environment))(ComSafeArrayOut(BSTR, aEnvironment));
STDMETHOD(COMSETTER(Environment))(ComSafeArrayIn(IN_BSTR, aEnvironment));
STDMETHOD(COMGETTER(Processes))(ComSafeArrayOut(IGuestProcess *, aProcesses));
STDMETHOD(COMGETTER(Directories))(ComSafeArrayOut(IGuestDirectory *, aDirectories));
STDMETHOD(COMGETTER(Files))(ComSafeArrayOut(IGuestFile *, aFiles));
+ STDMETHOD(COMGETTER(EventSource))(IEventSource ** aEventSource);
/** @} */
/** @name IGuestSession methods.
@@ -265,7 +302,8 @@ public:
STDMETHOD(FileCreateTemp)(IN_BSTR aTemplate, ULONG aMode, IN_BSTR aPath, BOOL aSecure, IGuestFile **aFile);
STDMETHOD(FileExists)(IN_BSTR aPath, BOOL *aExists);
STDMETHOD(FileRemove)(IN_BSTR aPath);
- STDMETHOD(FileOpen)(IN_BSTR aPath, IN_BSTR aOpenMode, IN_BSTR aDisposition, ULONG aCreationMode, LONG64 aOffset, IGuestFile **aFile);
+ STDMETHOD(FileOpen)(IN_BSTR aPath, IN_BSTR aOpenMode, IN_BSTR aDisposition, ULONG aCreationMode, IGuestFile **aFile);
+ STDMETHOD(FileOpenEx)(IN_BSTR aPath, IN_BSTR aOpenMode, IN_BSTR aDisposition, IN_BSTR aSharingMode, ULONG aCreationMode, LONG64 aOffset, IGuestFile **aFile);
STDMETHOD(FileQueryInfo)(IN_BSTR aPath, IGuestFsObjInfo **aInfo);
STDMETHOD(FileQuerySize)(IN_BSTR aPath, LONG64 *aSize);
STDMETHOD(FileRename)(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(PathRenameFlag_T, aFlags));
@@ -282,12 +320,16 @@ public:
STDMETHOD(SymlinkRead)(IN_BSTR aSymlink, ComSafeArrayIn(SymlinkReadFlag_T, aFlags), BSTR *aTarget);
STDMETHOD(SymlinkRemoveDirectory)(IN_BSTR aPath);
STDMETHOD(SymlinkRemoveFile)(IN_BSTR aFile);
+ STDMETHOD(WaitFor)(ULONG aWaitFlags, ULONG aTimeoutMS, GuestSessionWaitResult_T *aReason);
+ STDMETHOD(WaitForArray)(ComSafeArrayIn(GuestSessionWaitForFlag_T, aFlags), ULONG aTimeoutMS, GuestSessionWaitResult_T *aReason);
/** @} */
private:
- typedef std::vector <ComObjPtr<GuestDirectory> > SessionDirectories;
- typedef std::vector <ComObjPtr<GuestFile> > SessionFiles;
+ /** Map of guest directories. The key specifies the internal directory ID. */
+ typedef std::map <uint32_t, ComObjPtr<GuestDirectory> > SessionDirectories;
+ /** Map of guest files. The key specifies the internal file ID. */
+ typedef std::map <uint32_t, ComObjPtr<GuestFile> > SessionFiles;
/** Map of guest processes. The key specifies the internal process number.
* To retrieve the process' guest PID use the Id() method of the IProcess interface. */
typedef std::map <uint32_t, ComObjPtr<GuestProcess> > SessionProcesses;
@@ -295,66 +337,100 @@ private:
public:
/** @name Public internal methods.
* @{ */
+ int closeSession(uint32_t uFlags, uint32_t uTimeoutMS, int *pGuestRc);
+ inline bool directoryExists(uint32_t uDirID, ComObjPtr<GuestDirectory> *pDir);
int directoryRemoveFromList(GuestDirectory *pDirectory);
+ int directoryRemoveInternal(const Utf8Str &strPath, uint32_t uFlags, int *pGuestRc);
int directoryCreateInternal(const Utf8Str &strPath, uint32_t uMode, uint32_t uFlags, int *pGuestRc);
- int objectCreateTempInternal(const Utf8Str &strTemplate, const Utf8Str &strPath, bool fDirectory, const Utf8Str &strName, int *pGuestRc);
- int directoryOpenInternal(const Utf8Str &strPath, const Utf8Str &strFilter, uint32_t uFlags, ComObjPtr<GuestDirectory> &pDirectory);
+ int objectCreateTempInternal(const Utf8Str &strTemplate, const Utf8Str &strPath, bool fDirectory, Utf8Str &strName, int *pGuestRc);
+ int directoryOpenInternal(const GuestDirectoryOpenInfo &openInfo, ComObjPtr<GuestDirectory> &pDirectory, int *pGuestRc);
int directoryQueryInfoInternal(const Utf8Str &strPath, GuestFsObjData &objData, int *pGuestRc);
- int dispatchToProcess(uint32_t uContextID, uint32_t uFunction, void *pvData, size_t cbData);
+ int dispatchToDirectory(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
+ int dispatchToFile(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
+ int dispatchToObject(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
+ int dispatchToProcess(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
+ int dispatchToThis(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
+ inline bool fileExists(uint32_t uFileID, ComObjPtr<GuestFile> *pFile);
int fileRemoveFromList(GuestFile *pFile);
int fileRemoveInternal(const Utf8Str &strPath, int *pGuestRc);
- int fileOpenInternal(const Utf8Str &strPath, const Utf8Str &strOpenMode, const Utf8Str &strDisposition,
- uint32_t uCreationMode, int64_t iOffset, ComObjPtr<GuestFile> &pFile, int *pGuestRc);
+ int fileOpenInternal(const GuestFileOpenInfo &openInfo, ComObjPtr<GuestFile> &pFile, int *pGuestRc);
int fileQueryInfoInternal(const Utf8Str &strPath, GuestFsObjData &objData, int *pGuestRc);
int fileQuerySizeInternal(const Utf8Str &strPath, int64_t *pllSize, int *pGuestRc);
int fsQueryInfoInternal(const Utf8Str &strPath, GuestFsObjData &objData, int *pGuestRc);
const GuestCredentials &getCredentials(void);
const GuestEnvironment &getEnvironment(void);
+ EventSource *getEventSource(void) { return mEventSource; }
Utf8Str getName(void);
- ULONG getId(void) { return mData.mId; }
- Guest *getParent(void) { return mData.mParent; }
+ ULONG getId(void) { return mData.mSession.mID; }
+ static Utf8Str guestErrorToString(int guestRc);
+ HRESULT isReadyExternal(void);
+ int onRemove(void);
+ int onSessionStatusChange(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData);
+ int startSessionInternal(int *pGuestRc);
+ int startSessionAsync(void);
+ static DECLCALLBACK(int)
+ startSessionThread(RTTHREAD Thread, void *pvUser);
+ Guest *getParent(void) { return mParent; }
uint32_t getProtocolVersion(void) { return mData.mProtocolVersion; }
+ int pathRenameInternal(const Utf8Str &strSource, const Utf8Str &strDest, uint32_t uFlags, int *pGuestRc);
int processRemoveFromList(GuestProcess *pProcess);
int processCreateExInteral(GuestProcessStartupInfo &procInfo, ComObjPtr<GuestProcess> &pProgress);
inline bool processExists(uint32_t uProcessID, ComObjPtr<GuestProcess> *pProcess);
inline int processGetByPID(ULONG uPID, ComObjPtr<GuestProcess> *pProcess);
+ int sendCommand(uint32_t uFunction, uint32_t uParms, PVBOXHGCMSVCPARM paParms);
+ static HRESULT setErrorExternal(VirtualBoxBase *pInterface, int guestRc);
+ int setSessionStatus(GuestSessionStatus_T sessionStatus, int sessionRc);
+ int signalWaiters(GuestSessionWaitResult_T enmWaitResult, int rc /*= VINF_SUCCESS */);
int startTaskAsync(const Utf8Str &strTaskDesc, GuestSessionTask *pTask, ComObjPtr<Progress> &pProgress);
int queryInfo(void);
+ int waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, GuestSessionWaitResult_T &waitResult, int *pGuestRc);
+ int waitForStatusChange(GuestWaitEvent *pEvent, uint32_t fWaitFlags, uint32_t uTimeoutMS, GuestSessionStatus_T *pSessionStatus, int *pGuestRc);
/** @} */
private:
+ /** Pointer to the parent (Guest). */
+ Guest *mParent;
+ /**
+ * The session's event source. This source is used for
+ * serving the internal listener as well as all other
+ * external listeners that may register to it.
+ *
+ * Note: This can safely be used without holding any locks.
+ * An AutoCaller suffices to prevent it being destroy while in use and
+ * internally there is a lock providing the necessary serialization.
+ */
+ const ComObjPtr<EventSource> mEventSource;
+
struct Data
{
- /** Guest control protocol version to be used.
- * Guest Additions < VBox 4.2 have version 1,
- * any newer version will have version 2. */
- uint32_t mProtocolVersion;
- /** Flag indicating if this is an internal session
- * or not. Internal session are not accessible by clients. */
- bool fInternal;
- /** Pointer to the parent (Guest). */
- Guest *mParent;
/** The session credentials. */
- GuestCredentials mCredentials;
- /** The (optional) session name. */
- Utf8Str mName;
- /** The session ID. */
- ULONG mId;
- /** The session timeout. Default is 30s. */
- ULONG mTimeout;
+ GuestCredentials mCredentials;
+ /** The session's startup info. */
+ GuestSessionStartupInfo mSession;
+ /** The session's current status. */
+ GuestSessionStatus_T mStatus;
/** The session's environment block. Can be
* overwritten/extended by ProcessCreate(Ex). */
- GuestEnvironment mEnvironment;
+ GuestEnvironment mEnvironment;
/** Directory objects bound to this session. */
- SessionDirectories mDirectories;
+ SessionDirectories mDirectories;
/** File objects bound to this session. */
- SessionFiles mFiles;
+ SessionFiles mFiles;
/** Process objects bound to this session. */
- SessionProcesses mProcesses;
+ SessionProcesses mProcesses;
+ /** Guest control protocol version to be used.
+ * Guest Additions < VBox 4.3 have version 1,
+ * any newer version will have version 2. */
+ uint32_t mProtocolVersion;
+ /** Session timeout (in ms). */
+ uint32_t mTimeout;
/** Total number of session objects (processes,
* files, ...). */
- uint32_t mNumObjects;
+ uint32_t mNumObjects;
+ /** The last returned session status
+ * returned from the guest side. */
+ int mRC;
} mData;
};
diff --git a/src/VBox/Main/include/HGCM.h b/src/VBox/Main/include/HGCM.h
index f96d8432..acf1528b 100644
--- a/src/VBox/Main/include/HGCM.h
+++ b/src/VBox/Main/include/HGCM.h
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 2006-2007 Oracle Corporation
+ * Copyright (C) 2006-2010 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Main/include/HGCMObjects.h b/src/VBox/Main/include/HGCMObjects.h
index f7f51884..27c9c967 100644
--- a/src/VBox/Main/include/HGCMObjects.h
+++ b/src/VBox/Main/include/HGCMObjects.h
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2006-2007 Oracle Corporation
+ * Copyright (C) 2006-2010 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Main/include/HGCMThread.h b/src/VBox/Main/include/HGCMThread.h
index fb01cebc..ab0abcc7 100644
--- a/src/VBox/Main/include/HGCMThread.h
+++ b/src/VBox/Main/include/HGCMThread.h
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 2006-2007 Oracle Corporation
+ * Copyright (C) 2006-2010 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Main/include/HostHardwareLinux.h b/src/VBox/Main/include/HostHardwareLinux.h
index 6469ced1..b30da8a2 100644
--- a/src/VBox/Main/include/HostHardwareLinux.h
+++ b/src/VBox/Main/include/HostHardwareLinux.h
@@ -7,7 +7,7 @@
*/
/*
- * Copyright (C) 2008-2009 Oracle Corporation
+ * Copyright (C) 2008-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Main/include/HostImpl.h b/src/VBox/Main/include/HostImpl.h
index 56decbfc..a8f34e01 100644
--- a/src/VBox/Main/include/HostImpl.h
+++ b/src/VBox/Main/include/HostImpl.h
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2006-2011 Oracle Corporation
+ * Copyright (C) 2006-2012 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -61,9 +61,13 @@ public:
STDMETHOD(COMGETTER(USBDevices))(ComSafeArrayOut(IHostUSBDevice *, aUSBDevices));
STDMETHOD(COMGETTER(USBDeviceFilters))(ComSafeArrayOut(IHostUSBDeviceFilter *, aUSBDeviceFilters));
STDMETHOD(COMGETTER(NetworkInterfaces))(ComSafeArrayOut(IHostNetworkInterface *, aNetworkInterfaces));
+ STDMETHOD(COMGETTER(NameServers))(ComSafeArrayOut(BSTR, aNameServers));
+ STDMETHOD(COMGETTER(DomainName))(BSTR *aDomainName);
+ STDMETHOD(COMGETTER(SearchStrings))(ComSafeArrayOut(BSTR, aSearchStrings));
STDMETHOD(COMGETTER(ProcessorCount))(ULONG *count);
STDMETHOD(COMGETTER(ProcessorOnlineCount))(ULONG *count);
STDMETHOD(COMGETTER(ProcessorCoreCount))(ULONG *count);
+ STDMETHOD(COMGETTER(ProcessorOnlineCoreCount))(ULONG *count);
STDMETHOD(GetProcessorSpeed)(ULONG cpuId, ULONG *speed);
STDMETHOD(GetProcessorDescription)(ULONG cpuId, BSTR *description);
STDMETHOD(GetProcessorFeature)(ProcessorFeature_T feature, BOOL *supported);
@@ -74,6 +78,7 @@ public:
STDMETHOD(COMGETTER(OSVersion))(BSTR *version);
STDMETHOD(COMGETTER(UTCTime))(LONG64 *aUTCTime);
STDMETHOD(COMGETTER(Acceleration3DAvailable))(BOOL *aSupported);
+ STDMETHOD(COMGETTER(VideoInputDevices))(ComSafeArrayOut(IHostVideoInputDevice*, aVideoInputDevices));
// IHost methods
STDMETHOD(CreateHostOnlyNetworkInterface)(IHostNetworkInterface **aHostNetworkInterface,
@@ -146,6 +151,12 @@ private:
HRESULT updateNetIfList();
+#ifndef RT_OS_WINDOWS
+ HRESULT parseResolvConf();
+#else
+ HRESULT fetchNameResolvingInformation();
+#endif
+
#ifdef VBOX_WITH_RESOURCE_USAGE_API
void registerMetrics(PerformanceCollector *aCollector);
void registerDiskMetrics(PerformanceCollector *aCollector);
diff --git a/src/VBox/Main/include/HostNetworkInterfaceImpl.h b/src/VBox/Main/include/HostNetworkInterfaceImpl.h
index 54449c33..4055d1e8 100644
--- a/src/VBox/Main/include/HostNetworkInterfaceImpl.h
+++ b/src/VBox/Main/include/HostNetworkInterfaceImpl.h
@@ -6,7 +6,7 @@
*/
/*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -59,6 +59,7 @@ public:
// IHostNetworkInterface properties
STDMETHOD(COMGETTER(Name))(BSTR *aInterfaceName);
+ STDMETHOD(COMGETTER(ShortName))(BSTR *aShortName);
STDMETHOD(COMGETTER(Id))(BSTR *aGuid);
STDMETHOD(COMGETTER(DHCPEnabled))(BOOL *aDHCPEnabled);
STDMETHOD(COMGETTER(IPAddress))(BSTR *aIPAddress);
@@ -78,8 +79,10 @@ public:
STDMETHOD(DHCPRediscover)();
HRESULT setVirtualBox(VirtualBox *pVBox);
+#ifdef VBOX_WITH_RESOURCE_USAGE_API
void registerMetrics(PerformanceCollector *aCollector, ComPtr<IUnknown> objptr);
void unregisterMetrics(PerformanceCollector *aCollector, ComPtr<IUnknown> objptr);
+#endif
private:
Bstr composeNetworkName(const Utf8Str szShortName);
diff --git a/src/VBox/Main/include/HostPower.h b/src/VBox/Main/include/HostPower.h
index 0d7ba548..c7774c33 100644
--- a/src/VBox/Main/include/HostPower.h
+++ b/src/VBox/Main/include/HostPower.h
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2006-2008 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -19,7 +19,6 @@
#define ____H_HOSTPOWER
#include "VirtualBoxBase.h"
-#include "MachineImpl.h"
#include <vector>
@@ -28,27 +27,16 @@
# include <Carbon/Carbon.h>
#endif /* RT_OS_DARWIN */
-typedef enum
-{
- HostPowerEvent_Suspend,
- HostPowerEvent_Resume,
- HostPowerEvent_BatteryLow
-} HostPowerEvent;
-
class HostPowerService
{
-public:
-
- HostPowerService (VirtualBox *aVirtualBox);
+ public:
+ HostPowerService(VirtualBox *aVirtualBox);
virtual ~HostPowerService();
+ void notify(Reason_T aReason);
- void notify (HostPowerEvent aEvent);
-
-protected:
-
- VirtualBox *mVirtualBox;
-
- std::vector< ComPtr<IConsole> > mConsoles;
+ protected:
+ VirtualBox *mVirtualBox;
+ std::vector<ComPtr<IInternalSessionControl> > mSessionControls;
};
# ifdef RT_OS_WINDOWS
@@ -64,7 +52,7 @@ public:
private:
- static DECLCALLBACK(int) NotificationThread (RTTHREAD ThreadSelf, void *pInstance);
+ static DECLCALLBACK(int) NotificationThread(RTTHREAD ThreadSelf, void *pInstance);
static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
HWND mHwnd;
@@ -78,16 +66,16 @@ class HostPowerServiceDarwin : public HostPowerService
{
public:
- HostPowerServiceDarwin (VirtualBox *aVirtualBox);
+ HostPowerServiceDarwin(VirtualBox *aVirtualBox);
virtual ~HostPowerServiceDarwin();
private:
- static DECLCALLBACK(int) powerChangeNotificationThread (RTTHREAD ThreadSelf, void *pInstance);
- static void powerChangeNotificationHandler (void *pvData, io_service_t service, natural_t messageType, void *pMessageArgument);
- static void lowPowerHandler (void *pvData);
+ static DECLCALLBACK(int) powerChangeNotificationThread(RTTHREAD ThreadSelf, void *pInstance);
+ static void powerChangeNotificationHandler(void *pvData, io_service_t service, natural_t messageType, void *pMessageArgument);
+ static void lowPowerHandler(void *pvData);
- void checkBatteryCriticalLevel (bool *pfCriticalChanged = NULL);
+ void checkBatteryCriticalLevel(bool *pfCriticalChanged = NULL);
/* Private member vars */
RTTHREAD mThread; /* Our message thread. */
diff --git a/src/VBox/Main/include/HostUSBDeviceImpl.h b/src/VBox/Main/include/HostUSBDeviceImpl.h
index e04f1727..57023e1e 100644
--- a/src/VBox/Main/include/HostUSBDeviceImpl.h
+++ b/src/VBox/Main/include/HostUSBDeviceImpl.h
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2006-2010 Oracle Corporation
+ * Copyright (C) 2006-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Main/include/HostVideoInputDeviceImpl.h b/src/VBox/Main/include/HostVideoInputDeviceImpl.h
new file mode 100644
index 00000000..5e385455
--- /dev/null
+++ b/src/VBox/Main/include/HostVideoInputDeviceImpl.h
@@ -0,0 +1,71 @@
+/* $Id: HostVideoInputDeviceImpl.h $ */
+
+/** @file
+ *
+ * A host video capture device description.
+ */
+
+/*
+ * Copyright (C) 2013 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef HOSTVIDEOINPUTDEVICE_IMPL_H_
+#define HOSTVIDEOINPUTDEVICE_IMPL_H_
+
+#include "HostVideoInputDeviceWrap.h"
+
+#include <list>
+
+class HostVideoInputDevice;
+
+typedef std::list<ComObjPtr<HostVideoInputDevice> > HostVideoInputDeviceList;
+
+class ATL_NO_VTABLE HostVideoInputDevice :
+ public HostVideoInputDeviceWrap
+{
+public:
+
+ DECLARE_EMPTY_CTOR_DTOR(HostVideoInputDevice)
+
+ HRESULT FinalConstruct();
+ void FinalRelease();
+
+ /* Public initializer/uninitializer for internal purposes only. */
+ HRESULT init(const com::Utf8Str &name, const com::Utf8Str &path, const com::Utf8Str &alias);
+ void uninit();
+
+ static HRESULT queryHostDevices(VirtualBox *pVirtualBox, HostVideoInputDeviceList *pList);
+
+private:
+
+ // wrapped IHostVideoInputDevice properties
+ virtual HRESULT getName(com::Utf8Str &aName) { aName = m.name; return S_OK; }
+ virtual HRESULT getPath(com::Utf8Str &aPath) { aPath = m.path; return S_OK; }
+ virtual HRESULT getAlias(com::Utf8Str &aAlias) { aAlias = m.alias; return S_OK; }
+
+ /* Data. */
+ struct Data
+ {
+ Data()
+ {
+ }
+
+ com::Utf8Str name;
+ com::Utf8Str path;
+ com::Utf8Str alias;
+ };
+
+ Data m;
+};
+
+#endif // HOSTVIDEOINPUTDEVICE_IMPL_H_
+
+/* vi: set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/src/VBox/Main/include/KeyboardImpl.h b/src/VBox/Main/include/KeyboardImpl.h
index 4b8446f4..a94e67bf 100644
--- a/src/VBox/Main/include/KeyboardImpl.h
+++ b/src/VBox/Main/include/KeyboardImpl.h
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2006-2010 Oracle Corporation
+ * Copyright (C) 2006-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -85,8 +85,9 @@ public:
private:
- static DECLCALLBACK(void *) drvQueryInterface(PPDMIBASE pInterface, const char *pszIID);
+ static DECLCALLBACK(void) keyboardLedStatusChange(PPDMIKEYBOARDCONNECTOR pInterface, PDMKEYBLEDS enmLeds);
static DECLCALLBACK(void) keyboardSetActive(PPDMIKEYBOARDCONNECTOR pInterface, bool fActive);
+ static DECLCALLBACK(void *) drvQueryInterface(PPDMIBASE pInterface, const char *pszIID);
static DECLCALLBACK(int) drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
static DECLCALLBACK(void) drvDestruct(PPDMDRVINS pDrvIns);
diff --git a/src/VBox/Main/include/Logging.h b/src/VBox/Main/include/Logging.h
index c6385e22..4de5f576 100644
--- a/src/VBox/Main/include/Logging.h
+++ b/src/VBox/Main/include/Logging.h
@@ -40,6 +40,9 @@
#else
# define LOG_GROUP LOG_GROUP_MAIN
#endif
+#ifndef VBOXSVC_LOG_DEFAULT
+# define VBOXSVC_LOG_DEFAULT "all"
+#endif
#include <VBox/log.h>
diff --git a/src/VBox/Main/include/MachineDebuggerImpl.h b/src/VBox/Main/include/MachineDebuggerImpl.h
index d92cbe28..ab5a6b65 100644
--- a/src/VBox/Main/include/MachineDebuggerImpl.h
+++ b/src/VBox/Main/include/MachineDebuggerImpl.h
@@ -6,7 +6,7 @@
*/
/*
- * Copyright (C) 2006-2008 Oracle Corporation
+ * Copyright (C) 2006-2012 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -22,6 +22,7 @@
#include "VirtualBoxBase.h"
#include <iprt/log.h>
+#include <VBox/vmm/em.h>
class Console;
@@ -57,6 +58,8 @@ public:
STDMETHOD(COMSETTER(RecompileUser))(BOOL a_fEnable);
STDMETHOD(COMGETTER(RecompileSupervisor))(BOOL *a_pfEnabled);
STDMETHOD(COMSETTER(RecompileSupervisor))(BOOL a_fEnable);
+ STDMETHOD(COMGETTER(ExecuteAllInIEM))(BOOL *a_pfEnabled);
+ STDMETHOD(COMSETTER(ExecuteAllInIEM))(BOOL a_fEnable);
STDMETHOD(COMGETTER(PATMEnabled))(BOOL *a_pfEnabled);
STDMETHOD(COMSETTER(PATMEnabled))(BOOL a_fEnable);
STDMETHOD(COMGETTER(CSAMEnabled))(BOOL *a_pfEnabled);
@@ -72,6 +75,7 @@ public:
STDMETHOD(COMGETTER(HWVirtExEnabled))(BOOL *a_pfEnabled);
STDMETHOD(COMGETTER(HWVirtExNestedPagingEnabled))(BOOL *a_pfEnabled);
STDMETHOD(COMGETTER(HWVirtExVPIDEnabled))(BOOL *a_pfEnabled);
+ STDMETHOD(COMGETTER(HWVirtExUXEnabled))(BOOL *a_pfEnabled);
STDMETHOD(COMGETTER(PAEEnabled))(BOOL *a_pfEnabled);
STDMETHOD(COMGETTER(OSName))(BSTR *a_pbstrName);
STDMETHOD(COMGETTER(OSVersion))(BSTR *a_pbstrVersion);
@@ -108,6 +112,8 @@ public:
private:
// private methods
bool queueSettings() const;
+ HRESULT getEmExecPolicyProperty(EMEXECPOLICY enmPolicy, BOOL *pfEnforced);
+ HRESULT setEmExecPolicyProperty(EMEXECPOLICY enmPolicy, BOOL fEnforce);
/** RTLogGetFlags, RTLogGetGroupSettings and RTLogGetDestinations function. */
typedef DECLCALLBACK(int) FNLOGGETSTR(PRTLOGGER, char *, size_t);
@@ -119,6 +125,7 @@ private:
/** @name Flags whether settings have been queued because they could not be sent
* to the VM (not up yet, etc.)
* @{ */
+ uint8_t maiQueuedEmExecPolicyParams[EMEXECPOLICY_END];
int mSingleStepQueued;
int mRecompileUserQueued;
int mRecompileSupervisorQueued;
diff --git a/src/VBox/Main/include/MachineImpl.h b/src/VBox/Main/include/MachineImpl.h
index 888861a4..0ad42659 100644
--- a/src/VBox/Main/include/MachineImpl.h
+++ b/src/VBox/Main/include/MachineImpl.h
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -31,6 +31,7 @@
#include "ParallelPortImpl.h"
#include "BIOSSettingsImpl.h"
#include "StorageControllerImpl.h" // required for MachineImpl.h to compile on Windows
+#include "USBControllerImpl.h" // required for MachineImpl.h to compile on Windows
#include "BandwidthControlImpl.h"
#include "BandwidthGroupImpl.h"
#include "VBox/settings.h"
@@ -64,6 +65,7 @@ class Mouse;
class Display;
class MachineDebugger;
class USBController;
+class USBDeviceFilters;
class Snapshot;
class SharedFolder;
class HostUSBDevice;
@@ -222,6 +224,8 @@ public:
struct UserData
{
settings::MachineUserData s;
+ typedef std::vector<uint8_t> IconBlob;
+ IconBlob mIcon;
};
/**
@@ -238,8 +242,6 @@ public:
* Data structure to hold information about a guest property.
*/
struct GuestProperty {
- /** Property name */
- Utf8Str strName;
/** Property value */
Utf8Str strValue;
/** Property timestamp */
@@ -251,67 +253,75 @@ public:
HWData();
~HWData();
- Bstr mHWVersion;
- Guid mHardwareUUID; /**< If Null, use mData.mUuid. */
- ULONG mMemorySize;
- ULONG mMemoryBalloonSize;
- BOOL mPageFusionEnabled;
- ULONG mVRAMSize;
- ULONG mVideoCaptureWidth;
- ULONG mVideoCaptureHeight;
- Bstr mVideoCaptureFile;
- BOOL mVideoCaptureEnabled;
- ULONG mMonitorCount;
- BOOL mHWVirtExEnabled;
- BOOL mHWVirtExExclusive;
- BOOL mHWVirtExNestedPagingEnabled;
- BOOL mHWVirtExLargePagesEnabled;
- BOOL mHWVirtExVPIDEnabled;
- BOOL mHWVirtExForceEnabled;
- BOOL mAccelerate2DVideoEnabled;
- BOOL mPAEEnabled;
- BOOL mSyntheticCpu;
- ULONG mCPUCount;
- BOOL mCPUHotPlugEnabled;
- ULONG mCpuExecutionCap;
- BOOL mAccelerate3DEnabled;
- BOOL mHPETEnabled;
-
- BOOL mCPUAttached[SchemaDefs::MaxCPUCount];
-
- settings::CpuIdLeaf mCpuIdStdLeafs[11];
- settings::CpuIdLeaf mCpuIdExtLeafs[11];
-
- DeviceType_T mBootOrder[SchemaDefs::MaxBootPosition];
+ Bstr mHWVersion;
+ Guid mHardwareUUID; /**< If Null, use mData.mUuid. */
+ ULONG mMemorySize;
+ ULONG mMemoryBalloonSize;
+ BOOL mPageFusionEnabled;
+ GraphicsControllerType_T mGraphicsControllerType;
+ ULONG mVRAMSize;
+ ULONG mVideoCaptureWidth;
+ ULONG mVideoCaptureHeight;
+ ULONG mVideoCaptureRate;
+ ULONG mVideoCaptureFPS;
+ Utf8Str mVideoCaptureFile;
+ BOOL mVideoCaptureEnabled;
+ BOOL maVideoCaptureScreens[SchemaDefs::MaxGuestMonitors];
+ ULONG mMonitorCount;
+ BOOL mHWVirtExEnabled;
+ BOOL mHWVirtExNestedPagingEnabled;
+ BOOL mHWVirtExLargePagesEnabled;
+ BOOL mHWVirtExVPIDEnabled;
+ BOOL mHWVirtExUXEnabled;
+ BOOL mHWVirtExForceEnabled;
+ BOOL mAccelerate2DVideoEnabled;
+ BOOL mPAEEnabled;
+ settings::Hardware::LongModeType mLongMode;
+ BOOL mSyntheticCpu;
+ BOOL mTripleFaultReset;
+ ULONG mCPUCount;
+ BOOL mCPUHotPlugEnabled;
+ ULONG mCpuExecutionCap;
+ BOOL mAccelerate3DEnabled;
+ BOOL mHPETEnabled;
+
+ BOOL mCPUAttached[SchemaDefs::MaxCPUCount];
+
+ settings::CpuIdLeaf mCpuIdStdLeafs[11];
+ settings::CpuIdLeaf mCpuIdExtLeafs[11];
+
+ DeviceType_T mBootOrder[SchemaDefs::MaxBootPosition];
typedef std::list<ComObjPtr<SharedFolder> > SharedFolderList;
- SharedFolderList mSharedFolders;
+ SharedFolderList mSharedFolders;
- ClipboardMode_T mClipboardMode;
- DragAndDropMode_T mDragAndDropMode;
+ ClipboardMode_T mClipboardMode;
+ DragAndDropMode_T mDragAndDropMode;
- typedef std::list<GuestProperty> GuestPropertyList;
- GuestPropertyList mGuestProperties;
- Utf8Str mGuestPropertyNotificationPatterns;
+ typedef std::map<Utf8Str, GuestProperty> GuestPropertyMap;
+ GuestPropertyMap mGuestProperties;
+ Utf8Str mGuestPropertyNotificationPatterns;
- FirmwareType_T mFirmwareType;
- KeyboardHIDType_T mKeyboardHIDType;
- PointingHIDType_T mPointingHIDType;
- ChipsetType_T mChipsetType;
- BOOL mEmulatedUSBCardReaderEnabled;
+ FirmwareType_T mFirmwareType;
+ KeyboardHIDType_T mKeyboardHIDType;
+ PointingHIDType_T mPointingHIDType;
+ ChipsetType_T mChipsetType;
+ BOOL mEmulatedUSBCardReaderEnabled;
- BOOL mIOCacheEnabled;
- ULONG mIOCacheSize;
+ BOOL mIOCacheEnabled;
+ ULONG mIOCacheSize;
typedef std::list<ComObjPtr<PCIDeviceAttachment> > PCIDeviceAssignmentList;
PCIDeviceAssignmentList mPCIDeviceAssignments;
- settings::Debugging mDebugging;
- settings::Autostart mAutostart;
+ settings::Debugging mDebugging;
+ settings::Autostart mAutostart;
+
+ Utf8Str mDefaultFrontend;
};
/**
- * Hard disk and other media data.
+ * Hard disk and other media data.
*
* The usage policy is the same as for HWData, but a separate structure
* is necessary because hard disk data requires different procedures when
@@ -406,39 +416,46 @@ public:
STDMETHOD(COMSETTER(CPUHotPlugEnabled))(BOOL enabled);
STDMETHOD(COMGETTER(CPUExecutionCap))(ULONG *aExecutionCap);
STDMETHOD(COMSETTER(CPUExecutionCap))(ULONG aExecutionCap);
- STDMETHOD(COMGETTER(EmulatedUSBCardReaderEnabled))(BOOL *enabled);
- STDMETHOD(COMSETTER(EmulatedUSBCardReaderEnabled))(BOOL enabled);
- STDMETHOD(COMGETTER(EmulatedUSBWebcameraEnabled))(BOOL *enabled);
- STDMETHOD(COMSETTER(EmulatedUSBWebcameraEnabled))(BOOL enabled);
+ STDMETHOD(COMGETTER(EmulatedUSBCardReaderEnabled))(BOOL *aEnabled);
+ STDMETHOD(COMSETTER(EmulatedUSBCardReaderEnabled))(BOOL aEnabled);
STDMETHOD(COMGETTER(HPETEnabled))(BOOL *enabled);
STDMETHOD(COMSETTER(HPETEnabled))(BOOL enabled);
STDMETHOD(COMGETTER(MemoryBalloonSize))(ULONG *memoryBalloonSize);
STDMETHOD(COMSETTER(MemoryBalloonSize))(ULONG memoryBalloonSize);
STDMETHOD(COMGETTER(PageFusionEnabled))(BOOL *enabled);
STDMETHOD(COMSETTER(PageFusionEnabled))(BOOL enabled);
+ STDMETHOD(COMGETTER(GraphicsControllerType))(GraphicsControllerType_T *aGraphicsController);
+ STDMETHOD(COMSETTER(GraphicsControllerType))(GraphicsControllerType_T aGraphicsController);
STDMETHOD(COMGETTER(VRAMSize))(ULONG *memorySize);
STDMETHOD(COMSETTER(VRAMSize))(ULONG memorySize);
+ STDMETHOD(COMGETTER(Accelerate3DEnabled))(BOOL *aEnabled);
+ STDMETHOD(COMSETTER(Accelerate3DEnabled))(BOOL aEnabled);
+ STDMETHOD(COMGETTER(Accelerate2DVideoEnabled))(BOOL *aEnabled);
+ STDMETHOD(COMSETTER(Accelerate2DVideoEnabled))(BOOL aEnabled);
+ STDMETHOD(COMGETTER(MonitorCount))(ULONG *monitorCount);
+ STDMETHOD(COMSETTER(MonitorCount))(ULONG monitorCount);
STDMETHOD(COMGETTER(VideoCaptureEnabled))(BOOL *u8VideoRecEnabled);
STDMETHOD(COMSETTER(VideoCaptureEnabled))(BOOL u8VideoRecEnabled);
+ STDMETHOD(COMGETTER(VideoCaptureScreens))(ComSafeArrayOut(BOOL, aScreens));
+ STDMETHOD(COMSETTER(VideoCaptureScreens))(ComSafeArrayIn(BOOL, aScreens));
STDMETHOD(COMGETTER(VideoCaptureFile))(BSTR * ppChVideoRecFilename);
STDMETHOD(COMSETTER(VideoCaptureFile))(IN_BSTR pChVideoRecFilename);
- STDMETHOD(COMGETTER(VideoCaptureWidth))(ULONG *u32VideoRecHorzRes);
- STDMETHOD(COMSETTER(VideoCaptureWidth))(ULONG u32VideoRecHorzRes);
- STDMETHOD(COMGETTER(VideoCaptureHeight))(ULONG *u32VideoRecVertRes);
- STDMETHOD(COMSETTER(VideoCaptureHeight))(ULONG u32VideoRecVertRes);
- STDMETHOD(COMGETTER(MonitorCount))(ULONG *monitorCount);
- STDMETHOD(COMSETTER(MonitorCount))(ULONG monitorCount);
- STDMETHOD(COMGETTER(Accelerate3DEnabled))(BOOL *enabled);
- STDMETHOD(COMSETTER(Accelerate3DEnabled))(BOOL enabled);
- STDMETHOD(COMGETTER(Accelerate2DVideoEnabled))(BOOL *enabled);
- STDMETHOD(COMSETTER(Accelerate2DVideoEnabled))(BOOL enabled);
+ STDMETHOD(COMGETTER(VideoCaptureWidth))(ULONG *aHorzRes);
+ STDMETHOD(COMSETTER(VideoCaptureWidth))(ULONG aorzRes);
+ STDMETHOD(COMGETTER(VideoCaptureHeight))(ULONG *aVertRes);
+ STDMETHOD(COMSETTER(VideoCaptureHeight))(ULONG aVertRes);
+ STDMETHOD(COMGETTER(VideoCaptureRate))(ULONG *aRate);
+ STDMETHOD(COMSETTER(VideoCaptureRate))(ULONG aRate);
+ STDMETHOD(COMGETTER(VideoCaptureFPS))(ULONG *aFPS);
+ STDMETHOD(COMSETTER(VideoCaptureFPS))(ULONG aFPS);
STDMETHOD(COMGETTER(BIOSSettings))(IBIOSSettings **biosSettings);
STDMETHOD(COMGETTER(SnapshotFolder))(BSTR *aSavedStateFolder);
STDMETHOD(COMSETTER(SnapshotFolder))(IN_BSTR aSavedStateFolder);
STDMETHOD(COMGETTER(MediumAttachments))(ComSafeArrayOut(IMediumAttachment *, aAttachments));
STDMETHOD(COMGETTER(VRDEServer))(IVRDEServer **vrdeServer);
STDMETHOD(COMGETTER(AudioAdapter))(IAudioAdapter **audioAdapter);
- STDMETHOD(COMGETTER(USBController))(IUSBController * *aUSBController);
+ STDMETHOD(COMGETTER(USBControllers))(ComSafeArrayOut(IUSBController *, aUSBControllers));
+ STDMETHOD(COMGETTER(USBDeviceFilters))(IUSBDeviceFilters * *aUSBDeviceFilters);
STDMETHOD(COMGETTER(SettingsFilePath))(BSTR *aFilePath);
STDMETHOD(COMGETTER(SettingsModified))(BOOL *aModified);
STDMETHOD(COMGETTER(SessionState))(SessionState_T *aSessionState);
@@ -505,6 +522,11 @@ public:
STDMETHOD(COMSETTER(AutostartDelay))(ULONG uDelay);
STDMETHOD(COMGETTER(AutostopType))(AutostopType_T *penmAutostopType);
STDMETHOD(COMSETTER(AutostopType))(AutostopType_T enmAutostopType);
+ STDMETHOD(COMGETTER(DefaultFrontend))(BSTR *aDefaultFrontend);
+ STDMETHOD(COMSETTER(DefaultFrontend))(IN_BSTR aDefaultFrontend);
+ STDMETHOD(COMGETTER(Icon))(ComSafeArrayOut(BYTE, aIcon));
+ STDMETHOD(COMSETTER(Icon))(ComSafeArrayIn(BYTE, aIcon));
+ STDMETHOD(COMGETTER(USBProxyAvailable))(BOOL *aAvailable);
// IMachine methods
STDMETHOD(LockMachine)(ISession *aSession, LockType_T lockType);
@@ -521,6 +543,7 @@ public:
STDMETHOD(TemporaryEjectDevice)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice, BOOL aTempEject);
STDMETHOD(NonRotationalDevice)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice, BOOL aNonRotational);
STDMETHOD(SetAutoDiscardForDevice)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice, BOOL aDiscard);
+ STDMETHOD(SetHotPluggableForDevice)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice, BOOL aHotPluggable);
STDMETHOD(SetNoBandwidthGroupForDevice)(IN_BSTR aControllerName, LONG aControllerPort,
LONG aDevice);
STDMETHOD(SetBandwidthGroupForDevice)(IN_BSTR aControllerName, LONG aControllerPort,
@@ -545,11 +568,12 @@ public:
STDMETHOD(RemoveAllCPUIDLeaves)();
STDMETHOD(GetHWVirtExProperty)(HWVirtExPropertyType_T property, BOOL *aVal);
STDMETHOD(SetHWVirtExProperty)(HWVirtExPropertyType_T property, BOOL aVal);
+ STDMETHOD(SetSettingsFilePath)(IN_BSTR aFilePath, IProgress **aProgress);
STDMETHOD(SaveSettings)();
STDMETHOD(DiscardSettings)();
STDMETHOD(Unregister)(CleanupMode_T cleanupMode, ComSafeArrayOut(IMedium*, aMedia));
- STDMETHOD(Delete)(ComSafeArrayIn(IMedium*, aMedia), IProgress **aProgress);
- STDMETHOD(Export)(IAppliance *aAppliance, IN_BSTR location, IVirtualSystemDescription **aDescription);
+ STDMETHOD(DeleteConfig)(ComSafeArrayIn(IMedium*, aMedia), IProgress **aProgress);
+ STDMETHOD(ExportTo)(IAppliance *aAppliance, IN_BSTR location, IVirtualSystemDescription **aDescription);
STDMETHOD(FindSnapshot)(IN_BSTR aNameOrId, ISnapshot **aSnapshot);
STDMETHOD(CreateSharedFolder)(IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable, BOOL aAutoMount);
STDMETHOD(RemoveSharedFolder)(IN_BSTR aName);
@@ -569,6 +593,10 @@ public:
STDMETHOD(GetStorageControllerByName(IN_BSTR aName, IStorageController **storageController));
STDMETHOD(GetStorageControllerByInstance(ULONG aInstance, IStorageController **storageController));
STDMETHOD(SetStorageControllerBootable)(IN_BSTR aName, BOOL fBootable);
+ STDMETHOD(AddUSBController)(IN_BSTR aName, USBControllerType_T aConnectionType, IUSBController **controller);
+ STDMETHOD(RemoveUSBController(IN_BSTR aName));
+ STDMETHOD(GetUSBControllerByName(IN_BSTR aName, IUSBController **usbController));
+ STDMETHOD(GetUSBControllerCountByType(USBControllerType_T aType, ULONG *aControllers));
STDMETHOD(QuerySavedGuestScreenInfo)(ULONG uScreenId, ULONG *puOriginX, ULONG *puOriginY, ULONG *puWidth, ULONG *puHeight, BOOL *pfEnabled);
STDMETHOD(QuerySavedThumbnailSize)(ULONG aScreenId, ULONG *aSize, ULONG *aWidth, ULONG *aHeight);
STDMETHOD(ReadSavedThumbnailToArray)(ULONG aScreenId, BOOL aBGR, ULONG *aWidth, ULONG *aHeight, ComSafeArrayOut(BYTE, aData));
@@ -718,7 +746,8 @@ public:
virtual HRESULT onClipboardModeChange(ClipboardMode_T /* aClipboardMode */) { return S_OK; }
virtual HRESULT onDragAndDropModeChange(DragAndDropMode_T /* aDragAndDropMode */) { return S_OK; }
virtual HRESULT onBandwidthGroupChange(IBandwidthGroup * /* aBandwidthGroup */) { return S_OK; }
- virtual HRESULT onStorageDeviceChange(IMediumAttachment * /* mediumAttachment */, BOOL /* remove */) { return S_OK; }
+ virtual HRESULT onStorageDeviceChange(IMediumAttachment * /* mediumAttachment */, BOOL /* remove */, BOOL /* silent */) { return S_OK; }
+ virtual HRESULT onVideoCaptureChange() { return S_OK; }
HRESULT saveRegistryEntry(settings::MachineRegistryEntry &data);
@@ -730,6 +759,10 @@ public:
void composeSavedStateFilename(Utf8Str &strStateFilePath);
+ void getDefaultVideoCaptureFile(Utf8Str &strFile);
+
+ bool isUSBControllerPresent();
+
HRESULT launchVMProcess(IInternalSessionControl *aControl,
const Utf8Str &strType,
const Utf8Str &strEnvironment,
@@ -748,33 +781,6 @@ public:
return rc;
}
-#if defined(RT_OS_WINDOWS)
-
- bool isSessionOpen(ComObjPtr<SessionMachine> &aMachine,
- ComPtr<IInternalSessionControl> *aControl = NULL,
- HANDLE *aIPCSem = NULL, bool aAllowClosing = false);
- bool isSessionSpawning(RTPROCESS *aPID = NULL);
-
- bool isSessionOpenOrClosing(ComObjPtr<SessionMachine> &aMachine,
- ComPtr<IInternalSessionControl> *aControl = NULL,
- HANDLE *aIPCSem = NULL)
- { return isSessionOpen(aMachine, aControl, aIPCSem, true /* aAllowClosing */); }
-
-#elif defined(RT_OS_OS2)
-
- bool isSessionOpen(ComObjPtr<SessionMachine> &aMachine,
- ComPtr<IInternalSessionControl> *aControl = NULL,
- HMTX *aIPCSem = NULL, bool aAllowClosing = false);
-
- bool isSessionSpawning(RTPROCESS *aPID = NULL);
-
- bool isSessionOpenOrClosing(ComObjPtr<SessionMachine> &aMachine,
- ComPtr<IInternalSessionControl> *aControl = NULL,
- HMTX *aIPCSem = NULL)
- { return isSessionOpen(aMachine, aControl, aIPCSem, true /* aAllowClosing */); }
-
-#else
-
bool isSessionOpen(ComObjPtr<SessionMachine> &aMachine,
ComPtr<IInternalSessionControl> *aControl = NULL,
bool aAllowClosing = false);
@@ -784,8 +790,6 @@ public:
ComPtr<IInternalSessionControl> *aControl = NULL)
{ return isSessionOpen(aMachine, aControl, true /* aAllowClosing */); }
-#endif
-
bool checkForSpawnFailure();
HRESULT prepareRegister();
@@ -814,6 +818,8 @@ public:
protected:
+ class ClientToken;
+
HRESULT checkStateDependency(StateDependency aDepType);
Machine *getMachine();
@@ -858,6 +864,12 @@ protected:
HRESULT getMediumAttachmentsOfController(CBSTR aName,
MediaData::AttachmentList &aAttachments);
+ HRESULT getUSBControllerByName(const Utf8Str &aName,
+ ComObjPtr<USBController> &aUSBController,
+ bool aSetError = false);
+
+ ULONG getUSBControllerCountByType(USBControllerType_T enmType);
+
enum
{
/* flags for #saveSettings() */
@@ -887,7 +899,7 @@ protected:
HRESULT createImplicitDiffs(IProgress *aProgress,
ULONG aWeight,
bool aOnline);
- HRESULT deleteImplicitDiffs();
+ HRESULT deleteImplicitDiffs(bool aOnline);
MediumAttachment* findAttachment(const MediaData::AttachmentList &ll,
IN_BSTR aControllerName,
@@ -921,6 +933,8 @@ protected:
static DECLCALLBACK(int) deleteThread(RTTHREAD Thread, void *pvUser);
HRESULT deleteTaskWorker(DeleteTask &task);
+ Utf8Str getExtraData(const Utf8Str &strKey);
+
#ifdef VBOX_WITH_GUEST_PROPS
HRESULT getGuestPropertyFromService(IN_BSTR aName, BSTR *aValue,
LONG64 *aTimestamp, BSTR *aFlags) const;
@@ -943,6 +957,7 @@ protected:
#endif /* VBOX_WITH_GUEST_PROPS */
#ifdef VBOX_WITH_RESOURCE_USAGE_API
+ void getDiskList(MediaList &list);
void registerMetrics(PerformanceCollector *aCollector, Machine *aMachine, RTPROCESS pid);
pm::CollectorGuest *mCollectorGuest;
@@ -962,18 +977,22 @@ protected:
// the following fields need special backup/rollback/commit handling,
// so they cannot be a part of HWData
- const ComObjPtr<VRDEServer> mVRDEServer;
- const ComObjPtr<SerialPort> mSerialPorts[SchemaDefs::SerialPortCount];
- const ComObjPtr<ParallelPort> mParallelPorts[SchemaDefs::ParallelPortCount];
- const ComObjPtr<AudioAdapter> mAudioAdapter;
- const ComObjPtr<USBController> mUSBController;
- const ComObjPtr<BIOSSettings> mBIOSSettings;
+ const ComObjPtr<VRDEServer> mVRDEServer;
+ const ComObjPtr<SerialPort> mSerialPorts[SchemaDefs::SerialPortCount];
+ const ComObjPtr<ParallelPort> mParallelPorts[SchemaDefs::ParallelPortCount];
+ const ComObjPtr<AudioAdapter> mAudioAdapter;
+ const ComObjPtr<USBDeviceFilters> mUSBDeviceFilters;
+ const ComObjPtr<BIOSSettings> mBIOSSettings;
+ const ComObjPtr<BandwidthControl> mBandwidthControl;
+
typedef std::vector<ComObjPtr<NetworkAdapter> > NetworkAdapterVector;
- NetworkAdapterVector mNetworkAdapters;
- const ComObjPtr<BandwidthControl> mBandwidthControl;
+ NetworkAdapterVector mNetworkAdapters;
typedef std::list<ComObjPtr<StorageController> > StorageControllerList;
- Backupable<StorageControllerList> mStorageControllers;
+ Backupable<StorageControllerList> mStorageControllers;
+
+ typedef std::list<ComObjPtr<USBController> > USBControllerList;
+ Backupable<USBControllerList> mUSBControllers;
uint64_t uRegistryNeedsSaving;
@@ -1017,9 +1036,16 @@ public:
HRESULT FinalConstruct();
void FinalRelease();
+ struct Uninit
+ {
+ enum Reason { Unexpected, Abnormal, Normal };
+ };
+
// public initializer/uninitializer for internal purposes only
HRESULT init(Machine *aMachine);
void uninit() { uninit(Uninit::Unexpected); }
+ void uninit(Uninit::Reason aReason);
+
// util::Lockable interface
RWLockHandle *lockHandle() const;
@@ -1027,7 +1053,6 @@ public:
// IInternalMachineControl methods
STDMETHOD(SetRemoveSavedStateFile)(BOOL aRemove);
STDMETHOD(UpdateState)(MachineState_T machineState);
- STDMETHOD(GetIPCId)(BSTR *id);
STDMETHOD(BeginPowerUp)(IProgress *aProgress);
STDMETHOD(EndPowerUp)(LONG iResult);
STDMETHOD(BeginPoweringDown)(IProgress **aProgress);
@@ -1051,11 +1076,7 @@ public:
STDMETHOD(DeleteSnapshot)(IConsole *aInitiator, IN_BSTR aStartId,
IN_BSTR aEndID, BOOL fDeleteAllChildren,
MachineState_T *aMachineState, IProgress **aProgress);
- STDMETHOD(FinishOnlineMergeMedium)(IMediumAttachment *aMediumAttachment,
- IMedium *aSource, IMedium *aTarget,
- BOOL fMergeForward,
- IMedium *pParentForTarget,
- ComSafeArrayIn(IMedium *, aChildrenToReparent));
+ STDMETHOD(FinishOnlineMergeMedium)();
STDMETHOD(RestoreSnapshot)(IConsole *aInitiator,
ISnapshot *aSnapshot,
MachineState_T *aMachineState,
@@ -1064,17 +1085,18 @@ public:
ComSafeArrayOut(LONG64, aTimestamps), ComSafeArrayOut(BSTR, aFlags));
STDMETHOD(PushGuestProperty)(IN_BSTR aName, IN_BSTR aValue,
LONG64 aTimestamp, IN_BSTR aFlags);
- STDMETHOD(LockMedia)() { return lockMedia(); }
- STDMETHOD(UnlockMedia)() { unlockMedia(); return S_OK; }
+ STDMETHOD(LockMedia)();
+ STDMETHOD(UnlockMedia)();
STDMETHOD(EjectMedium)(IMediumAttachment *aAttachment,
IMediumAttachment **aNewAttachment);
- STDMETHOD(ReportGuestStatistics)(ULONG aValidStats, ULONG aCpuUser,
- ULONG aCpuKernel, ULONG aCpuIdle,
- ULONG aMemTotal, ULONG aMemFree,
- ULONG aMemBalloon, ULONG aMemShared,
- ULONG aMemCache, ULONG aPageTotal,
- ULONG aAllocVMM, ULONG aFreeVMM,
- ULONG aBalloonedVMM, ULONG aSharedVMM);
+ STDMETHOD(ReportVmStatistics)(ULONG aValidStats, ULONG aCpuUser,
+ ULONG aCpuKernel, ULONG aCpuIdle,
+ ULONG aMemTotal, ULONG aMemFree,
+ ULONG aMemBalloon, ULONG aMemShared,
+ ULONG aMemCache, ULONG aPageTotal,
+ ULONG aAllocVMM, ULONG aFreeVMM,
+ ULONG aBalloonedVMM, ULONG aSharedVMM,
+ ULONG aVmNetRx, ULONG aVmNetTx);
// public methods only for internal purposes
@@ -1083,8 +1105,17 @@ public:
return true;
}
+#ifndef VBOX_WITH_GENERIC_SESSION_WATCHER
bool checkForDeath();
+ void getTokenId(Utf8Str &strTokenId);
+#else /* VBOX_WITH_GENERIC_SESSION_WATCHER */
+ IToken *getToken();
+#endif /* VBOX_WITH_GENERIC_SESSION_WATCHER */
+ // getClientToken must be only used by callers who can guarantee that
+ // the object cannot be deleted in the mean time, i.e. have a caller/lock.
+ ClientToken *getClientToken();
+
HRESULT onNetworkAdapterChange(INetworkAdapter *networkAdapter, BOOL changeAdapter);
HRESULT onNATRedirectRuleChange(ULONG ulSlot, BOOL aNatRuleRemove, IN_BSTR aRuleName,
NATProtocol_T aProto, IN_BSTR aHostIp, LONG aHostPort, IN_BSTR aGuestIp, LONG aGuestPort);
@@ -1093,8 +1124,8 @@ public:
HRESULT onSerialPortChange(ISerialPort *serialPort);
HRESULT onParallelPortChange(IParallelPort *parallelPort);
HRESULT onCPUChange(ULONG aCPU, BOOL aRemove);
- HRESULT onCPUExecutionCapChange(ULONG aCpuExecutionCap);
HRESULT onVRDEServerChange(BOOL aRestart);
+ HRESULT onVideoCaptureChange();
HRESULT onUSBControllerChange();
HRESULT onUSBDeviceAttach(IUSBDevice *aDevice,
IVirtualBoxErrorInfo *aError,
@@ -1105,16 +1136,20 @@ public:
HRESULT onClipboardModeChange(ClipboardMode_T aClipboardMode);
HRESULT onDragAndDropModeChange(DragAndDropMode_T aDragAndDropMode);
HRESULT onBandwidthGroupChange(IBandwidthGroup *aBandwidthGroup);
- HRESULT onStorageDeviceChange(IMediumAttachment *aMediumAttachment, BOOL aRemove);
+ HRESULT onStorageDeviceChange(IMediumAttachment *aMediumAttachment, BOOL aRemove, BOOL aSilent);
+ HRESULT onCPUExecutionCapChange(ULONG aCpuExecutionCap);
bool hasMatchingUSBFilter(const ComObjPtr<HostUSBDevice> &aDevice, ULONG *aMaskedIfs);
+ HRESULT lockMedia();
+ void unlockMedia();
+
private:
struct ConsoleTaskData
{
ConsoleTaskData()
- : mLastState(MachineState_Null)
+ : mLastState(MachineState_Null), mDeleteSnapshotInfo(NULL)
{ }
MachineState_T mLastState;
@@ -1123,15 +1158,13 @@ private:
// used when taking snapshot
ComObjPtr<Snapshot> mSnapshot;
+ // used when deleting online snapshot
+ void *mDeleteSnapshotInfo;
+
// used when saving state (either as part of a snapshot or separate)
Utf8Str strStateFilePath;
};
- struct Uninit
- {
- enum Reason { Unexpected, Abnormal, Normal };
- };
-
struct SnapshotTask;
struct DeleteSnapshotTask;
struct RestoreSnapshotTask;
@@ -1139,8 +1172,6 @@ private:
friend struct DeleteSnapshotTask;
friend struct RestoreSnapshotTask;
- void uninit(Uninit::Reason aReason);
-
HRESULT endSavingState(HRESULT aRC, const Utf8Str &aErrMsg);
void releaseSavedStateFile(const Utf8Str &strSavedStateFile, Snapshot *pSnapshotToIgnore);
@@ -1156,14 +1187,16 @@ private:
ComObjPtr<Medium> &aTarget,
bool &fMergeForward,
ComObjPtr<Medium> &pParentForTarget,
- MediaList &aChildrenToReparent,
+ MediumLockList * &aChildrenToReparent,
bool &fNeedOnlineMerge,
- MediumLockList * &aMediumLockList);
+ MediumLockList * &aMediumLockList,
+ ComPtr<IToken> &aHDLockToken);
void cancelDeleteSnapshotMedium(const ComObjPtr<Medium> &aHD,
const ComObjPtr<Medium> &aSource,
- const MediaList &aChildrenToReparent,
+ MediumLockList *aChildrenToReparent,
bool fNeedsOnlineMerge,
MediumLockList *aMediumLockList,
+ const ComPtr<IToken> &aHDLockToken,
const Guid &aMediumId,
const Guid &aSnapshotId);
HRESULT onlineMergeMedium(const ComObjPtr<MediumAttachment> &aMediumAttachment,
@@ -1171,14 +1204,11 @@ private:
const ComObjPtr<Medium> &aTarget,
bool fMergeForward,
const ComObjPtr<Medium> &pParentForTarget,
- const MediaList &aChildrenToReparent,
+ MediumLockList *aChildrenToReparent,
MediumLockList *aMediumLockList,
ComObjPtr<Progress> &aProgress,
bool *pfNeedsMachineSaveSettings);
- HRESULT lockMedia();
- void unlockMedia();
-
HRESULT setMachineState(MachineState_T aMachineState);
HRESULT updateMachineStateOnClient();
@@ -1186,27 +1216,10 @@ private:
ConsoleTaskData mConsoleTaskData;
- /** interprocess semaphore handle for this machine */
-#if defined(RT_OS_WINDOWS)
- HANDLE mIPCSem;
- Bstr mIPCSemName;
- friend bool Machine::isSessionOpen(ComObjPtr<SessionMachine> &aMachine,
- ComPtr<IInternalSessionControl> *aControl,
- HANDLE *aIPCSem, bool aAllowClosing);
-#elif defined(RT_OS_OS2)
- HMTX mIPCSem;
- Bstr mIPCSemName;
- friend bool Machine::isSessionOpen(ComObjPtr<SessionMachine> &aMachine,
- ComPtr<IInternalSessionControl> *aControl,
- HMTX *aIPCSem, bool aAllowClosing);
-#elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER)
- int mIPCSem;
-# ifdef VBOX_WITH_NEW_SYS_V_KEYGEN
- Bstr mIPCKey;
-# endif /*VBOX_WITH_NEW_SYS_V_KEYGEN */
-#else
-# error "Port me!"
-#endif
+ /** client token for this machine */
+ ClientToken *mClientToken;
+
+ int miNATNetworksStarted;
static DECLCALLBACK(int) taskHandler(RTTHREAD thread, void *pvUser);
};
diff --git a/src/VBox/Main/include/Matching.h b/src/VBox/Main/include/Matching.h
index 0f5bbc4f..2f01f692 100644
--- a/src/VBox/Main/include/Matching.h
+++ b/src/VBox/Main/include/Matching.h
@@ -5,7 +5,7 @@
*/
/*
- * Copyright (C) 2006-2007 Oracle Corporation
+ * Copyright (C) 2006-2010 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Main/include/MediumAttachmentImpl.h b/src/VBox/Main/include/MediumAttachmentImpl.h
index 819317f0..1f3f3d3b 100644
--- a/src/VBox/Main/include/MediumAttachmentImpl.h
+++ b/src/VBox/Main/include/MediumAttachmentImpl.h
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2006-2011 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -51,6 +51,7 @@ public:
bool fTempEject,
bool fNonRotational,
bool fDiscard,
+ bool fHotPluggable,
const Utf8Str &strBandwidthGroup);
HRESULT initCopy(Machine *aParent, MediumAttachment *aThat);
void uninit();
@@ -70,6 +71,7 @@ public:
STDMETHOD(COMGETTER(NonRotational))(BOOL *aNonRotational);
STDMETHOD(COMGETTER(Discard))(BOOL *aDiscard);
STDMETHOD(COMGETTER(BandwidthGroup))(IBandwidthGroup **aBwGroup);
+ STDMETHOD(COMGETTER(HotPluggable))(BOOL *aHotPluggable);
// public internal methods
void rollback();
@@ -90,6 +92,7 @@ public:
bool getNonRotational() const;
bool getDiscard() const;
const Utf8Str& getBandwidthGroup() const;
+ bool getHotPluggable() const;
bool matches(CBSTR aControllerName, LONG aPort, LONG aDevice);
@@ -116,6 +119,9 @@ public:
void updateParentMachine(Machine * const pMachine);
+ /** Must be called from under this object's write lock. */
+ void updateHotPluggable(bool aHotPluggable);
+
/** Get a unique and somewhat descriptive name for logging. */
const char* getLogName(void) const { return mLogName.c_str(); }
diff --git a/src/VBox/Main/include/MediumFormatImpl.h b/src/VBox/Main/include/MediumFormatImpl.h
index feac8a71..2acdc6e8 100644
--- a/src/VBox/Main/include/MediumFormatImpl.h
+++ b/src/VBox/Main/include/MediumFormatImpl.h
@@ -2,11 +2,11 @@
/** @file
*
- * VirtualBox COM class implementation
+ * MediumFormat COM class implementation
*/
/*
- * Copyright (C) 2008-2011 Oracle Corporation
+ * Copyright (C) 2008-2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -17,14 +17,11 @@
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
-#ifndef ____H_MEDIUMFORMAT
-#define ____H_MEDIUMFORMAT
+#ifndef MEDIUMFORMAT_IMPL_H_
+#define MEDIUMFORMAT_IMPL_H_
-#include "VirtualBoxBase.h"
+#include "MediumFormatWrap.h"
-#include <VBox/com/array.h>
-
-#include <list>
struct VDBACKENDINFO;
@@ -38,8 +35,7 @@ struct VDBACKENDINFO;
* wait!
*/
class ATL_NO_VTABLE MediumFormat :
- public VirtualBoxBase,
- VBOX_SCRIPTABLE_IMPL(IMediumFormat)
+ public MediumFormatWrap
{
public:
@@ -52,31 +48,8 @@ public:
Utf8Str strDefaultValue;
};
- typedef std::list<Utf8Str> StrList;
- typedef std::list<DeviceType_T> DeviceTypeList;
- typedef std::list<Property> PropertyList;
-
- struct Data
- {
- Data() : capabilities((MediumFormatCapabilities_T)0) {}
-
- const Utf8Str strId;
- const Utf8Str strName;
- const StrList llFileExtensions;
- const DeviceTypeList llDeviceTypes;
- const MediumFormatCapabilities_T capabilities;
- const PropertyList llProperties;
- };
-
- VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(MediumFormat, IMediumFormat)
-
- DECLARE_NOT_AGGREGATABLE(MediumFormat)
-
- DECLARE_PROTECT_FINAL_CONSTRUCT()
-
- BEGIN_COM_MAP(MediumFormat)
- VBOX_DEFAULT_INTERFACE_ENTRIES(IMediumFormat)
- END_COM_MAP()
+ typedef std::vector<Property> PropertyArray;
+ typedef std::vector<com::Utf8Str> StrArray;
DECLARE_EMPTY_CTOR_DTOR(MediumFormat)
@@ -87,39 +60,53 @@ public:
HRESULT init(const VDBACKENDINFO *aVDInfo);
void uninit();
- // IMediumFormat properties
- STDMETHOD(COMGETTER(Id))(BSTR *aId);
- STDMETHOD(COMGETTER(Name))(BSTR *aName);
- STDMETHOD(COMGETTER(Capabilities))(ULONG *aCaps);
-
- // IMediumFormat methods
- STDMETHOD(DescribeFileExtensions)(ComSafeArrayOut(BSTR, aFileExtensions),
- ComSafeArrayOut(DeviceType_T, aDeviceTypes));
- STDMETHOD(DescribeProperties)(ComSafeArrayOut(BSTR, aNames),
- ComSafeArrayOut(BSTR, aDescriptions),
- ComSafeArrayOut(DataType_T, aTypes),
- ComSafeArrayOut(ULONG, aFlags),
- ComSafeArrayOut(BSTR, aDefaults));
-
- // public methods only for internal purposes
-
// public methods for internal purposes only
// (ensure there is a caller and a read lock before calling them!)
/** Const, no need to lock */
- const Utf8Str& getId() const { return m.strId; }
+ const Utf8Str &i_getId() const { return m.strId; }
/** Const, no need to lock */
- const StrList& getFileExtensions() const { return m.llFileExtensions; }
+ const StrArray &i_getFileExtensions() const { return m.maFileExtensions; }
/** Const, no need to lock */
- MediumFormatCapabilities_T getCapabilities() const { return m.capabilities; }
+ MediumFormatCapabilities_T i_getCapabilities() const { return m.capabilities; }
/** Const, no need to lock */
- const PropertyList& getProperties() const { return m.llProperties; }
+ const PropertyArray &i_getProperties() const { return m.maProperties; }
private:
+ // wrapped IMediumFormat properties
+ HRESULT getId(com::Utf8Str &aId);
+ HRESULT getName(com::Utf8Str &aName);
+ HRESULT getCapabilities(std::vector<MediumFormatCapabilities_T> &aCapabilities);
+
+ // wrapped IMediumFormat methods
+ HRESULT describeFileExtensions(std::vector<com::Utf8Str> &aExtensions,
+ std::vector<DeviceType_T> &aTypes);
+ HRESULT describeProperties(std::vector<com::Utf8Str> &aNames,
+ std::vector<com::Utf8Str> &aDescriptions,
+ std::vector<DataType_T> &aTypes,
+ std::vector<ULONG> &aFlags,
+ std::vector<com::Utf8Str> &aDefaults);
+
+ // types
+ typedef std::vector<DeviceType_T> DeviceTypeArray;
+
+ // data
+ struct Data
+ {
+ Data() : capabilities((MediumFormatCapabilities_T)0) {}
+
+ const Utf8Str strId;
+ const Utf8Str strName;
+ const StrArray maFileExtensions;
+ const DeviceTypeArray maDeviceTypes;
+ const MediumFormatCapabilities_T capabilities;
+ const PropertyArray maProperties;
+ };
+
Data m;
};
-#endif // ____H_MEDIUMFORMAT
+#endif // MEDIUMFORMAT_IMPL_H_
/* vi: set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/src/VBox/Main/include/MediumImpl.h b/src/VBox/Main/include/MediumImpl.h
index 33bff7b6..4f64d414 100644
--- a/src/VBox/Main/include/MediumImpl.h
+++ b/src/VBox/Main/include/MediumImpl.h
@@ -6,7 +6,7 @@
*/
/*
- * Copyright (C) 2008-2012 Oracle Corporation
+ * Copyright (C) 2008-2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -103,9 +103,8 @@ public:
STDMETHOD(COMGETTER(Description))(BSTR *aDescription);
STDMETHOD(COMSETTER(Description))(IN_BSTR aDescription);
STDMETHOD(COMGETTER(State))(MediumState_T *aState);
- STDMETHOD(COMGETTER(Variant))(ULONG *aVariant);
+ STDMETHOD(COMGETTER(Variant))(ComSafeArrayOut(MediumVariant_T, aVariant));
STDMETHOD(COMGETTER(Location))(BSTR *aLocation);
- STDMETHOD(COMSETTER(Location))(IN_BSTR aLocation);
STDMETHOD(COMGETTER(Name))(BSTR *aName);
STDMETHOD(COMGETTER(DeviceType))(DeviceType_T *aDeviceType);
STDMETHOD(COMGETTER(HostDrive))(BOOL *aHostDrive);
@@ -131,10 +130,8 @@ public:
STDMETHOD(RefreshState)(MediumState_T *aState);
STDMETHOD(GetSnapshotIds)(IN_BSTR aMachineId,
ComSafeArrayOut(BSTR, aSnapshotIds));
- STDMETHOD(LockRead)(MediumState_T *aState);
- STDMETHOD(UnlockRead)(MediumState_T *aState);
- STDMETHOD(LockWrite)(MediumState_T *aState);
- STDMETHOD(UnlockWrite)(MediumState_T *aState);
+ STDMETHOD(LockRead)(IToken **aToken);
+ STDMETHOD(LockWrite)(IToken **aToken);
STDMETHOD(Close)();
STDMETHOD(GetProperty)(IN_BSTR aName, BSTR *aValue);
STDMETHOD(SetProperty)(IN_BSTR aName, IN_BSTR aValue);
@@ -144,17 +141,18 @@ public:
STDMETHOD(SetProperties)(ComSafeArrayIn(IN_BSTR, aNames),
ComSafeArrayIn(IN_BSTR, aValues));
STDMETHOD(CreateBaseStorage)(LONG64 aLogicalSize,
- ULONG aVariant,
+ ComSafeArrayIn(MediumVariant_T, aVariant),
IProgress **aProgress);
STDMETHOD(DeleteStorage)(IProgress **aProgress);
STDMETHOD(CreateDiffStorage)(IMedium *aTarget,
- ULONG aVariant,
+ ComSafeArrayIn(MediumVariant_T, aVariant),
IProgress **aProgress);
STDMETHOD(MergeTo)(IMedium *aTarget, IProgress **aProgress);
- STDMETHOD(CloneTo)(IMedium *aTarget, ULONG aVariant,
+ STDMETHOD(CloneTo)(IMedium *aTarget, ComSafeArrayIn(MediumVariant_T, aVariant),
IMedium *aParent, IProgress **aProgress);
- STDMETHOD(CloneToBase)(IMedium *aTarget, ULONG aVariant,
+ STDMETHOD(CloneToBase)(IMedium *aTarget, ComSafeArrayIn(MediumVariant_T, aVariant),
IProgress **aProgress);
+ STDMETHOD(SetLocation)(IN_BSTR aLocation, IProgress **aProgress);
STDMETHOD(Compact)(IProgress **aProgress);
STDMETHOD(Resize)(LONG64 aLogicalSize, IProgress **aProgress);
STDMETHOD(Reset)(IProgress **aProgress);
@@ -225,31 +223,36 @@ public:
Utf8Str getPreferredDiffFormat();
HRESULT close(AutoCaller &autoCaller);
+ HRESULT unlockRead(MediumState_T *aState);
+ HRESULT unlockWrite(MediumState_T *aState);
HRESULT deleteStorage(ComObjPtr<Progress> *aProgress, bool aWait);
HRESULT markForDeletion();
HRESULT unmarkForDeletion();
HRESULT markLockedForDeletion();
HRESULT unmarkLockedForDeletion();
+ HRESULT queryPreferredMergeDirection(const ComObjPtr<Medium> &pOther,
+ bool &fMergeForward);
+
HRESULT prepareMergeTo(const ComObjPtr<Medium> &pTarget,
const Guid *aMachineId,
const Guid *aSnapshotId,
bool fLockMedia,
bool &fMergeForward,
ComObjPtr<Medium> &pParentForTarget,
- MediaList &aChildrenToReparent,
+ MediumLockList * &aChildrenToReparent,
MediumLockList * &aMediumLockList);
HRESULT mergeTo(const ComObjPtr<Medium> &pTarget,
bool fMergeForward,
const ComObjPtr<Medium> &pParentForTarget,
- const MediaList &aChildrenToReparent,
+ MediumLockList *aChildrenToReparent,
MediumLockList *aMediumLockList,
ComObjPtr<Progress> *aProgress,
bool aWait);
- void cancelMergeTo(const MediaList &aChildrenToReparent,
+ void cancelMergeTo(MediumLockList *aChildrenToReparent,
MediumLockList *aMediumLockList);
- HRESULT fixParentUuidOfChildren(const MediaList &childrenToReparent);
+ HRESULT fixParentUuidOfChildren(MediumLockList *pChildrenToReparent);
HRESULT exportFile(const char *aFilename,
const ComObjPtr<MediumFormat> &aFormat,
diff --git a/src/VBox/Main/include/MediumLock.h b/src/VBox/Main/include/MediumLock.h
index eaa12f8b..a65ebd03 100644
--- a/src/VBox/Main/include/MediumLock.h
+++ b/src/VBox/Main/include/MediumLock.h
@@ -6,7 +6,7 @@
*/
/*
- * Copyright (C) 2010 Oracle Corporation
+ * Copyright (C) 2010-2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -89,11 +89,18 @@ public:
bool GetLockRequest() const;
/**
+ * Check if this medium object has been locked by this MediumLock.
+ */
+ bool IsLocked() const;
+
+ /**
* Acquire a medium lock.
*
* @return COM status code
+ * @param aIgnoreLockedMedia If set ignore all media which is already
+ * locked in an incompatible way.
*/
- HRESULT Lock();
+ HRESULT Lock(bool aIgnoreLockedMedia = false);
/**
* Release a medium lock.
@@ -104,6 +111,7 @@ public:
private:
ComObjPtr<Medium> mMedium;
+ ComPtr<IToken> mToken;
AutoCaller mMediumCaller;
bool mLockWrite;
bool mIsLocked;
@@ -207,8 +215,14 @@ public:
* Acquire all medium locks "atomically", i.e. all or nothing.
*
* @return COM status code
+ * @param aSkipOverLockedMedia If set ignore all media which is already
+ * locked for reading or writing. For callers
+ * which need to know which medium objects
+ * have been locked by this lock list you
+ * can iterate over the list and check the
+ * MediumLock state.
*/
- HRESULT Lock();
+ HRESULT Lock(bool aSkipOverLockedMedia = false);
/**
* Release all medium locks.
diff --git a/src/VBox/Main/include/MouseImpl.h b/src/VBox/Main/include/MouseImpl.h
index 4bbb6a18..404c7594 100644
--- a/src/VBox/Main/include/MouseImpl.h
+++ b/src/VBox/Main/include/MouseImpl.h
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2006-2008 Oracle Corporation
+ * Copyright (C) 2006-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -21,9 +21,7 @@
#include "VirtualBoxBase.h"
#include "ConsoleEvents.h"
#include "ConsoleImpl.h"
-#ifndef VBOXBFE_WITHOUT_COM
#include "EventImpl.h"
-#endif
#include <VBox/vmm/pdmdrv.h>
/** Maximum number of devices supported */
@@ -33,9 +31,7 @@ typedef struct DRVMAINMOUSE DRVMAINMOUSE, *PDRVMAINMOUSE;
class ATL_NO_VTABLE Mouse :
public VirtualBoxBase
-#ifndef VBOXBFE_WITHOUT_COM
, VBOX_SCRIPTABLE_IMPL(IMouse)
-#endif
{
public:
@@ -55,12 +51,13 @@ public:
void FinalRelease();
// public initializer/uninitializer for internal purposes only
- HRESULT init(Console *parent);
+ HRESULT init(ConsoleMouseInterface *parent);
void uninit();
// IMouse properties
STDMETHOD(COMGETTER(AbsoluteSupported)) (BOOL *absoluteSupported);
STDMETHOD(COMGETTER(RelativeSupported)) (BOOL *relativeSupported);
+ STDMETHOD(COMGETTER(MultiTouchSupported)) (BOOL *multiTouchSupported);
STDMETHOD(COMGETTER(NeedsHostCursor)) (BOOL *needsHostCursor);
// IMouse methods
@@ -68,13 +65,13 @@ public:
LONG buttonState);
STDMETHOD(PutMouseEventAbsolute)(LONG x, LONG y, LONG dz, LONG dw,
LONG buttonState);
-#ifndef VBOXBFE_WITHOUT_COM
+ STDMETHOD(PutEventMultiTouch)(LONG aCount, ComSafeArrayIn(LONG64, aContacts), ULONG aScanTime);
+ STDMETHOD(PutEventMultiTouchString)(LONG aCount, IN_BSTR aContacts, ULONG aScanTime);
STDMETHOD(COMGETTER(EventSource)) (IEventSource ** aEventSource);
-#endif
static const PDMDRVREG DrvReg;
- Console *getParent() const
+ ConsoleMouseInterface *getParent() const
{
return mParent;
}
@@ -89,68 +86,53 @@ public:
private:
static DECLCALLBACK(void *) drvQueryInterface(PPDMIBASE pInterface, const char *pszIID);
- static DECLCALLBACK(void) mouseReportModes (PPDMIMOUSECONNECTOR pInterface, bool fRel, bool fAbs);
+ static DECLCALLBACK(void) mouseReportModes (PPDMIMOUSECONNECTOR pInterface, bool fRel, bool fAbs, bool fMT);
static DECLCALLBACK(int) drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
static DECLCALLBACK(void) drvDestruct(PPDMDRVINS pDrvIns);
HRESULT updateVMMDevMouseCaps(uint32_t fCapsAdded, uint32_t fCapsRemoved);
HRESULT reportRelEventToMouseDev(int32_t dx, int32_t dy, int32_t dz,
int32_t dw, uint32_t fButtons);
- HRESULT reportAbsEventToMouseDev(int32_t mouseXAbs, int32_t mouseYAbs,
- int32_t dz, int32_t dw, uint32_t fButtons);
- HRESULT reportAbsEventToVMMDev(int32_t mouseXAbs, int32_t mouseYAbs);
- HRESULT reportAbsEvent(int32_t mouseXAbs, int32_t mouseYAbs,
- int32_t dz, int32_t dw, uint32_t fButtons,
- bool fUsesVMMDevEvent);
- HRESULT convertDisplayRes(LONG x, LONG y, int32_t *pcX, int32_t *pcY,
+ HRESULT reportAbsEventToMouseDev(int32_t x, int32_t y, int32_t dz,
+ int32_t dw, uint32_t fButtons);
+ HRESULT reportMTEventToMouseDev(int32_t x, int32_t z, uint32_t cContact,
+ uint32_t fContact);
+ HRESULT reportMultiTouchEventToDevice(uint8_t cContacts, const uint64_t *pau64Contacts, uint32_t u32ScanTime);
+ HRESULT reportAbsEventToVMMDev(int32_t x, int32_t y);
+ HRESULT reportAbsEvent(int32_t x, int32_t y, int32_t dz, int32_t dw,
+ uint32_t fButtons, bool fUsesVMMDevEvent);
+ HRESULT convertDisplayRes(LONG x, LONG y, int32_t *pxAdj, int32_t *pyAdj,
bool *pfValid);
+ HRESULT putEventMultiTouch(LONG aCount, LONG64 *paContacts, ULONG aScanTime);
- void getDeviceCaps(bool *pfAbs, bool *pfRel);
+ void getDeviceCaps(bool *pfAbs, bool *pfRel, bool *fMT);
void sendMouseCapsNotifications(void);
bool guestNeedsHostCursor(void);
bool vmmdevCanAbs(void);
bool deviceCanAbs(void);
bool supportsAbs(void);
bool supportsRel(void);
+ bool supportsMT(void);
-#ifdef VBOXBFE_WITHOUT_COM
- Console *mParent;
-#else
- Console * const mParent;
-#endif
+ ConsoleMouseInterface * const mParent;
/** Pointer to the associated mouse driver. */
struct DRVMAINMOUSE *mpDrv[MOUSE_MAX_DEVICES];
uint32_t mfVMMDevGuestCaps; /** We cache this to avoid access races */
- int32_t mcLastAbsX;
- int32_t mcLastAbsY;
+ int32_t mcLastX;
+ int32_t mcLastY;
uint32_t mfLastButtons;
-#ifndef VBOXBFE_WITHOUT_COM
const ComObjPtr<EventSource> mEventSource;
VBoxEventDesc mMouseEvent;
- void fireMouseEvent(bool fAbsolute, LONG x, LONG y, LONG dz, LONG dw, LONG Buttons);
-#else
- void fireMouseEvent(bool fAbsolute, LONG x, LONG y, LONG dz, LONG dw, LONG Buttons)
- {}
-#endif
-};
-
-#ifdef VBOXBFE_WITHOUT_COM
-/** @todo make this a member of Console */
-extern Mouse *gMouse;
+ void fireMouseEvent(bool fAbsolute, LONG x, LONG y, LONG dz, LONG dw,
+ LONG fButtons);
-/** @todo can we get these from the API somehow? */
-enum
-{
- MouseButtonState_LeftButton = 1,
- MouseButtonState_RightButton = 2,
- MouseButtonState_MiddleButton = 4,
- MouseButtonState_XButton1 = 8,
- MouseButtonState_XButton2 = 16
+ void fireMultiTouchEvent(uint8_t cContacts,
+ const LONG64 *paContacts,
+ uint32_t u32ScanTime);
};
-#endif
#endif // !____H_MOUSEIMPL
/* vi: set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/src/VBox/Main/include/NATNetworkImpl.h b/src/VBox/Main/include/NATNetworkImpl.h
new file mode 100644
index 00000000..1ce0769c
--- /dev/null
+++ b/src/VBox/Main/include/NATNetworkImpl.h
@@ -0,0 +1,147 @@
+/* $Id: NATNetworkImpl.h $ */
+/** @file
+ * INATNetwork implementation header, lives in VBoxSVC.
+ */
+
+/*
+ * Copyright (C) 2006-2011 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef ____H_H_NATNETWORKIMPL
+#define ____H_H_NATNETWORKIMPL
+
+#include "VirtualBoxBase.h"
+
+#ifdef VBOX_WITH_HOSTNETIF_API
+struct NETIFINFO;
+#endif
+
+namespace settings
+{
+ struct NATNetwork;
+ struct NATRule;
+}
+
+#ifdef RT_OS_WINDOWS
+# define NATSR_EXECUTABLE_NAME "VBoxNetNAT.exe"
+#else
+# define NATSR_EXECUTABLE_NAME "VBoxNetNAT"
+#endif
+
+enum ADDRESSLOOKUPTYPE
+{
+ ADDR_GATEWAY,
+ ADDR_DHCP,
+ ADDR_DHCPLOWERIP,
+ ADDR_ANY
+};
+
+class NATNetworkServiceRunner: public NetworkServiceRunner
+{
+public:
+ NATNetworkServiceRunner(): NetworkServiceRunner(NATSR_EXECUTABLE_NAME){}
+ ~NATNetworkServiceRunner(){}
+};
+
+class ATL_NO_VTABLE NATNetwork :
+ public VirtualBoxBase,
+ VBOX_SCRIPTABLE_IMPL(INATNetwork)
+{
+public:
+
+ VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(NATNetwork, INATNetwork)
+
+ DECLARE_NOT_AGGREGATABLE (NATNetwork)
+
+ DECLARE_PROTECT_FINAL_CONSTRUCT()
+
+ BEGIN_COM_MAP (NATNetwork)
+ VBOX_DEFAULT_INTERFACE_ENTRIES(INATNetwork)
+ END_COM_MAP()
+
+ DECLARE_EMPTY_CTOR_DTOR (NATNetwork)
+
+ HRESULT FinalConstruct();
+ void FinalRelease();
+
+ HRESULT init(VirtualBox *aVirtualBox,
+ IN_BSTR aName);
+
+
+ HRESULT init(VirtualBox *aVirtualBox,
+ const settings::NATNetwork &data);
+ HRESULT saveSettings(settings::NATNetwork &data);
+ void uninit();
+ // INATNetwork::EventSource
+ STDMETHOD(COMGETTER(EventSource))(IEventSource **IEventSource);
+ // INATNetwork properties
+ STDMETHOD(COMGETTER(Enabled))(BOOL *aEnabled);
+ STDMETHOD(COMSETTER(Enabled))(BOOL aEnabled);
+
+ STDMETHOD(COMGETTER(NetworkName))(BSTR *aName);
+ STDMETHOD(COMSETTER(NetworkName))(IN_BSTR aName);
+
+ STDMETHOD(COMGETTER(Gateway))(BSTR *aIPGateway);
+
+ STDMETHOD(COMGETTER(Network))(BSTR *aIPNetwork);
+ STDMETHOD(COMSETTER(Network))(IN_BSTR aIPNetwork);
+
+ STDMETHOD(COMGETTER(IPv6Enabled))(BOOL *aEnabled);
+ STDMETHOD(COMSETTER(IPv6Enabled))(BOOL aEnabled);
+
+ STDMETHOD(COMGETTER(IPv6Prefix))(BSTR *aName);
+ STDMETHOD(COMSETTER(IPv6Prefix))(IN_BSTR aName);
+
+ STDMETHOD(COMGETTER(AdvertiseDefaultIPv6RouteEnabled))(BOOL *aEnabled);
+ STDMETHOD(COMSETTER(AdvertiseDefaultIPv6RouteEnabled))(BOOL aEnabled);
+
+ STDMETHOD(COMGETTER(NeedDhcpServer))(BOOL *aEnabled);
+ STDMETHOD(COMSETTER(NeedDhcpServer))(BOOL aEnabled);
+
+ STDMETHOD(COMGETTER(LocalMappings))(ComSafeArrayOut(BSTR, aLocalMappings));
+ STDMETHOD(AddLocalMapping)(IN_BSTR aHostId, LONG aOffset);
+
+ STDMETHOD(COMGETTER(LoopbackIp6))(LONG *aLoopbackIp6);
+ STDMETHOD(COMSETTER(LoopbackIp6))(LONG aLoopbackIp6);
+
+ STDMETHOD(COMGETTER(PortForwardRules4))(ComSafeArrayOut(BSTR, aPortForwardRules4));
+ STDMETHOD(COMGETTER(PortForwardRules6))(ComSafeArrayOut(BSTR, aPortForwardRules6));
+
+ STDMETHOD(AddPortForwardRule)(BOOL aIsIpv6,
+ IN_BSTR aPortForwardRuleName,
+ NATProtocol_T aProto,
+ IN_BSTR aHostIp,
+ USHORT aHostPort,
+ IN_BSTR aGuestIp,
+ USHORT aGuestPort);
+ STDMETHOD(RemovePortForwardRule)(BOOL aIsIpv6, IN_BSTR aPortForwardRuleName);
+
+ STDMETHOD(Start)(IN_BSTR aTrunkType);
+ STDMETHOD(Stop)();
+
+private:
+ int recalculateIpv4AddressAssignments();
+ int findFirstAvailableOffset(ADDRESSLOOKUPTYPE, uint32_t *);
+
+ typedef std::map<Utf8Str, settings::NATRule> NATRuleMap;
+ typedef NATRuleMap::const_iterator constNATRuleMapIterator;
+
+ void GetPortForwardRulesFromMap(ComSafeArrayOut(BSTR, aPortForwardRules), NATRuleMap& aRules);
+ /** weak VirtualBox parent */
+ VirtualBox * const mVirtualBox;
+
+ const Bstr mName;
+ struct Data;
+ struct Data *m;
+
+};
+
+#endif // !____H_H_NATNETWORKIMPL
diff --git a/src/VBox/Main/include/DHCPServerRunner.h b/src/VBox/Main/include/NATNetworkServiceRunner.h
index b1308455..0c39bb0d 100644
--- a/src/VBox/Main/include/DHCPServerRunner.h
+++ b/src/VBox/Main/include/NATNetworkServiceRunner.h
@@ -1,10 +1,10 @@
-/* $Id: DHCPServerRunner.h $ */
+/* $Id: NATNetworkServiceRunner.h $ */
/** @file
- * VirtualBox Main - interface for VBox DHCP server
+ * VirtualBox Main - interface for VBox NAT Network service
*/
/*
- * Copyright (C) 2009 Oracle Corporation
+ * Copyright (C) 2009-2010 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -22,40 +22,30 @@
typedef enum
{
- DHCPCFG_NAME = 1,
- DHCPCFG_NETNAME,
- DHCPCFG_TRUNKTYPE,
- DHCPCFG_TRUNKNAME,
- DHCPCFG_MACADDRESS,
- DHCPCFG_IPADDRESS,
- DHCPCFG_LEASEDB,
- DHCPCFG_VERBOSE,
- DHCPCFG_GATEWAY,
- DHCPCFG_LOWERIP,
- DHCPCFG_UPPERIP,
- DHCPCFG_NETMASK,
- DHCPCFG_HELP,
- DHCPCFG_VERSION,
- DHCPCFG_BEGINCONFIG,
- DHCPCFG_NOTOPT_MAXVAL
-}DHCPCFG;
+ NATSCCFG_NAME = 1,
+ NATSCCFG_TRUNKTYPE,
+ NATSCCFG_MACADDRESS,
+ NATSCCFG_IPADDRESS,
+ NATSCCFG_NETMASK,
+ NATSCCFG_PORTFORWARD4,
+ NATSCCFG_PORTFORWARD6,
+ NATSCCFG_NOTOPT_MAXVAL
+}NATSCCFG;
#define TRUNKTYPE_WHATEVER "whatever"
-#define TRUNKTYPE_NETFLT "netflt"
-#define TRUNKTYPE_NETADP "netadp"
#define TRUNKTYPE_SRVNAT "srvnat"
-class DHCPServerRunner
+class NATNetworkServiceRunner
{
public:
- DHCPServerRunner();
- ~DHCPServerRunner() { stop(); /* don't leave abandoned servers */}
+ NATNetworkServiceRunner();
+ ~NATNetworkServiceRunner() { stop(); /* don't leave abandoned networks */}
- int setOption(DHCPCFG opt, const char *val, bool enabled)
+ int setOption(NATSCCFG opt, const char *val, bool enabled)
{
- if(opt == 0 || opt >= DHCPCFG_NOTOPT_MAXVAL)
+ if (opt == 0 || opt >= NATSCCFG_NOTOPT_MAXVAL)
return VERR_INVALID_PARAMETER;
- if(isRunning())
+ if (isRunning())
return VERR_INVALID_STATE;
mOptions[opt] = val;
@@ -63,7 +53,7 @@ public:
return VINF_SUCCESS;
}
- int setOption(DHCPCFG opt, const com::Utf8Str &val, bool enabled)
+ int setOption(NATSCCFG opt, const com::Utf8Str &val, bool enabled)
{
return setOption(opt, val.c_str(), enabled);
}
@@ -74,7 +64,7 @@ public:
void detachFromServer();
private:
- com::Utf8Str mOptions[DHCPCFG_NOTOPT_MAXVAL];
- bool mOptionEnabled[DHCPCFG_NOTOPT_MAXVAL];
+ com::Utf8Str mOptions[NATSCCFG_NOTOPT_MAXVAL];
+ bool mOptionEnabled[NATSCCFG_NOTOPT_MAXVAL];
RTPROCESS mProcess;
};
diff --git a/src/VBox/Main/include/NetworkAdapterImpl.h b/src/VBox/Main/include/NetworkAdapterImpl.h
index 32601549..a99a9573 100644
--- a/src/VBox/Main/include/NetworkAdapterImpl.h
+++ b/src/VBox/Main/include/NetworkAdapterImpl.h
@@ -154,6 +154,8 @@ private:
void generateMACAddress();
HRESULT updateMacAddress(Utf8Str aMacAddress);
void updateBandwidthGroup(BandwidthGroup *aBwGroup);
+ HRESULT checkAndSwitchFromNatNetworking(IN_BSTR aNatNetworkName);
+ HRESULT switchToNatNetworking(IN_BSTR aNatNetworkName);
Machine * const mParent;
const ComObjPtr<NetworkAdapter> mPeer;
diff --git a/src/VBox/Main/include/NetworkServiceRunner.h b/src/VBox/Main/include/NetworkServiceRunner.h
new file mode 100644
index 00000000..f0ec275d
--- /dev/null
+++ b/src/VBox/Main/include/NetworkServiceRunner.h
@@ -0,0 +1,57 @@
+/* $Id: NetworkServiceRunner.h $ */
+/** @file
+ * VirtualBox Main - interface for VBox DHCP server.
+ */
+
+/*
+ * Copyright (C) 2009-2010 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#include <iprt/err.h>
+#include <iprt/types.h>
+#include <iprt/string.h>
+#include <iprt/mem.h>
+#include <VBox/com/string.h>
+
+#include <string>
+
+#define TRUNKTYPE_WHATEVER "whatever"
+#define TRUNKTYPE_NETFLT "netflt"
+#define TRUNKTYPE_NETADP "netadp"
+#define TRUNKTYPE_SRVNAT "srvnat"
+
+class NetworkServiceRunner
+{
+public:
+ NetworkServiceRunner(const char *aProcName);
+ virtual ~NetworkServiceRunner();
+
+ int setOption(const std::string& key, const std::string& val);
+
+ int start();
+ int stop();
+ bool isRunning();
+
+ void detachFromServer();
+
+ static const std::string kNsrKeyName;
+ static const std::string kNsrKeyNetwork;
+ static const std::string kNsrKeyTrunkType;
+ static const std::string kNsrTrunkName;
+ static const std::string kNsrMacAddress;
+ static const std::string kNsrIpAddress;
+ static const std::string kNsrIpNetmask;
+ static const std::string kNsrKeyNeedMain;
+
+private:
+ struct Data;
+ Data *m;
+};
diff --git a/src/VBox/Main/include/Nvram.h b/src/VBox/Main/include/Nvram.h
index 4f95e71d..0a444b7b 100644
--- a/src/VBox/Main/include/Nvram.h
+++ b/src/VBox/Main/include/Nvram.h
@@ -30,16 +30,21 @@ class Nvram
public:
Nvram(Console *console);
virtual ~Nvram();
- static const PDMDRVREG DrvReg;
+
Console *getParent(void) { return mParent; }
- struct NVRAM *mpDrv;
+
+ static const PDMDRVREG DrvReg;
private:
static DECLCALLBACK(void *) drvNvram_QueryInterface(PPDMIBASE pInterface, const char *pszIID);
static DECLCALLBACK(int) drvNvram_Construct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
static DECLCALLBACK(void) drvNvram_Destruct(PPDMDRVINS pDrvIns);
+ /** Pointer to the parent object. */
Console * const mParent;
+ /** Pointer to the driver instance data.
+ * Can be NULL during init and termination. */
+ struct NVRAM *mpDrv;
};
#endif /* !____H_NVRAM */
diff --git a/src/VBox/Main/include/PCIDeviceAttachmentImpl.h b/src/VBox/Main/include/PCIDeviceAttachmentImpl.h
index e162be1f..8120be5d 100644
--- a/src/VBox/Main/include/PCIDeviceAttachmentImpl.h
+++ b/src/VBox/Main/include/PCIDeviceAttachmentImpl.h
@@ -23,68 +23,6 @@
#include "VirtualBoxBase.h"
#include <VBox/settings.h>
-class ATL_NO_VTABLE PCIAddress :
- public VirtualBoxBase,
- VBOX_SCRIPTABLE_IMPL(IPCIAddress)
-{
-public:
- VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(PCIAddress, IPCIAddress)
-
- DECLARE_NOT_AGGREGATABLE(PCIAddress)
-
- DECLARE_PROTECT_FINAL_CONSTRUCT()
-
- BEGIN_COM_MAP(PCIAddress)
- VBOX_DEFAULT_INTERFACE_ENTRIES(IPCIAddress)
- END_COM_MAP()
-
- PCIAddress() { }
- ~PCIAddress() { }
-
- // public initializer/uninitializer for internal purposes only
- HRESULT init(LONG aAddess);
- void uninit();
-
- HRESULT FinalConstruct();
- void FinalRelease();
-
- // IPCIAddress properties
- STDMETHOD(COMGETTER(Bus))(SHORT *aBus)
- {
- *aBus = mBus;
- return S_OK;
- }
- STDMETHOD(COMSETTER(Bus))(SHORT aBus)
- {
- mBus = aBus;
- return S_OK;
- }
- STDMETHOD(COMGETTER(Device))(SHORT *aDevice)
- {
- *aDevice = mDevice;
- return S_OK;
- }
- STDMETHOD(COMSETTER(Device))(SHORT aDevice)
- {
- mDevice = aDevice;
- return S_OK;
- }
-
- STDMETHOD(COMGETTER(DevFunction))(SHORT *aDevFunction)
- {
- *aDevFunction = mFn;
- return S_OK;
- }
- STDMETHOD(COMSETTER(DevFunction))(SHORT aDevFunction)
- {
- mFn = aDevFunction;
- return S_OK;
- }
-
-private:
- SHORT mBus, mDevice, mFn;
-};
-
class ATL_NO_VTABLE PCIDeviceAttachment :
public VirtualBoxBase,
VBOX_SCRIPTABLE_IMPL(IPCIDeviceAttachment)
diff --git a/src/VBox/Main/include/Performance.h b/src/VBox/Main/include/Performance.h
index d3905237..c1e8ed25 100644
--- a/src/VBox/Main/include/Performance.h
+++ b/src/VBox/Main/include/Performance.h
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2008 Oracle Corporation
+ * Copyright (C) 2008-2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -32,6 +32,8 @@
#include <vector>
#include <queue>
+#include "MediumImpl.h"
+
/* Forward decl. */
class Machine;
@@ -153,33 +155,39 @@ namespace pm
*/
typedef enum
{
- GUESTSTATMASK_NONE = 0x00000000,
- GUESTSTATMASK_CPUUSER = 0x00000001,
- GUESTSTATMASK_CPUKERNEL = 0x00000002,
- GUESTSTATMASK_CPUIDLE = 0x00000004,
- GUESTSTATMASK_MEMTOTAL = 0x00000008,
- GUESTSTATMASK_MEMFREE = 0x00000010,
- GUESTSTATMASK_MEMBALLOON = 0x00000020,
- GUESTSTATMASK_MEMSHARED = 0x00000040,
- GUESTSTATMASK_MEMCACHE = 0x00000080,
- GUESTSTATMASK_PAGETOTAL = 0x00000100,
- GUESTSTATMASK_ALLOCVMM = 0x00000200,
- GUESTSTATMASK_FREEVMM = 0x00000400,
- GUESTSTATMASK_BALOONVMM = 0x00000800,
- GUESTSTATMASK_SHAREDVMM = 0x00001000
- } GUESTSTATMASK;
-
- const ULONG GUESTSTATS_CPULOAD =
- GUESTSTATMASK_CPUUSER|GUESTSTATMASK_CPUKERNEL|GUESTSTATMASK_CPUIDLE;
- const ULONG GUESTSTATS_RAMUSAGE =
- GUESTSTATMASK_MEMTOTAL|GUESTSTATMASK_MEMFREE|GUESTSTATMASK_MEMBALLOON|
- GUESTSTATMASK_MEMSHARED|GUESTSTATMASK_MEMCACHE|
- GUESTSTATMASK_PAGETOTAL;
- const ULONG GUESTSTATS_VMMRAM =
- GUESTSTATMASK_ALLOCVMM|GUESTSTATMASK_FREEVMM|
- GUESTSTATMASK_BALOONVMM|GUESTSTATMASK_SHAREDVMM;
- const ULONG GUESTSTATS_ALL = GUESTSTATS_CPULOAD|GUESTSTATS_RAMUSAGE|GUESTSTATS_VMMRAM;
-
+ VMSTATMASK_NONE = 0x00000000,
+ VMSTATMASK_GUEST_CPUUSER = 0x00000001,
+ VMSTATMASK_GUEST_CPUKERNEL = 0x00000002,
+ VMSTATMASK_GUEST_CPUIDLE = 0x00000004,
+ VMSTATMASK_GUEST_MEMTOTAL = 0x00000008,
+ VMSTATMASK_GUEST_MEMFREE = 0x00000010,
+ VMSTATMASK_GUEST_MEMBALLOON = 0x00000020,
+ VMSTATMASK_GUEST_MEMSHARED = 0x00000040,
+ VMSTATMASK_GUEST_MEMCACHE = 0x00000080,
+ VMSTATMASK_GUEST_PAGETOTAL = 0x00000100,
+ VMSTATMASK_VMM_ALLOC = 0x00010000,
+ VMSTATMASK_VMM_FREE = 0x00020000,
+ VMSTATMASK_VMM_BALOON = 0x00040000,
+ VMSTATMASK_VMM_SHARED = 0x00080000,
+ VMSTATMASK_NET_RX = 0x01000000,
+ VMSTATMASK_NET_TX = 0x02000000
+ } VMSTATMASK;
+
+ const ULONG VMSTATS_GUEST_CPULOAD =
+ VMSTATMASK_GUEST_CPUUSER | VMSTATMASK_GUEST_CPUKERNEL |
+ VMSTATMASK_GUEST_CPUIDLE;
+ const ULONG VMSTATS_GUEST_RAMUSAGE =
+ VMSTATMASK_GUEST_MEMTOTAL | VMSTATMASK_GUEST_MEMFREE |
+ VMSTATMASK_GUEST_MEMBALLOON | VMSTATMASK_GUEST_MEMSHARED |
+ VMSTATMASK_GUEST_MEMCACHE | VMSTATMASK_GUEST_PAGETOTAL;
+ const ULONG VMSTATS_VMM_RAM =
+ VMSTATMASK_VMM_ALLOC | VMSTATMASK_VMM_FREE|
+ VMSTATMASK_VMM_BALOON | VMSTATMASK_VMM_SHARED;
+ const ULONG VMSTATS_NET_RATE =
+ VMSTATMASK_NET_RX | VMSTATMASK_NET_TX;
+ const ULONG VMSTATS_ALL =
+ VMSTATS_GUEST_CPULOAD | VMSTATS_GUEST_RAMUSAGE |
+ VMSTATS_VMM_RAM | VMSTATS_NET_RATE;
class CollectorGuest;
class CollectorGuestRequest
@@ -190,7 +198,7 @@ namespace pm
virtual ~CollectorGuestRequest() {};
void setGuest(CollectorGuest *aGuest) { mCGuest = aGuest; };
CollectorGuest *getGuest() { return mCGuest; };
- virtual int execute() = 0;
+ virtual HRESULT execute() = 0;
virtual void debugPrint(void *aObject, const char *aFunction, const char *aText) = 0;
protected:
@@ -203,7 +211,7 @@ namespace pm
public:
CGRQEnable(ULONG aMask)
: mMask(aMask) {};
- int execute();
+ HRESULT execute();
void debugPrint(void *aObject, const char *aFunction, const char *aText);
private:
@@ -215,7 +223,7 @@ namespace pm
public:
CGRQDisable(ULONG aMask)
: mMask(aMask) {};
- int execute();
+ HRESULT execute();
void debugPrint(void *aObject, const char *aFunction, const char *aText);
private:
@@ -226,7 +234,7 @@ namespace pm
{
public:
CGRQAbort() {};
- int execute();
+ HRESULT execute();
void debugPrint(void *aObject, const char *aFunction, const char *aText);
};
@@ -265,12 +273,13 @@ namespace pm
ULONG aMemBalloon, ULONG aMemShared,
ULONG aMemCache, ULONG aPageTotal,
ULONG aAllocVMM, ULONG aFreeVMM,
- ULONG aBalloonedVMM, ULONG aSharedVMM);
+ ULONG aBalloonedVMM, ULONG aSharedVMM,
+ ULONG aVmNetRx, ULONG aVmNetTx);
int enable(ULONG mask);
int disable(ULONG mask);
int enqueueRequest(CollectorGuestRequest *aRequest);
- int enableInternal(ULONG mask);
+ HRESULT enableInternal(ULONG mask);
int disableInternal(ULONG mask);
const com::Utf8Str& getVMName() const { return mMachineName; };
@@ -289,6 +298,8 @@ namespace pm
ULONG getFreeVMM() { return mFreeVMM; };
ULONG getBalloonedVMM() { return mBalloonedVMM; };
ULONG getSharedVMM() { return mSharedVMM; };
+ ULONG getVmNetRx() { return mVmNetRx; };
+ ULONG getVmNetTx() { return mVmNetTx; };
private:
int enableVMMStats(bool mCollectVMMStats);
@@ -316,6 +327,8 @@ namespace pm
ULONG mFreeVMM;
ULONG mBalloonedVMM;
ULONG mSharedVMM;
+ ULONG mVmNetRx;
+ ULONG mVmNetTx;
};
typedef std::list<CollectorGuest*> CollectorGuestList;
@@ -343,6 +356,8 @@ namespace pm
};
/* Collector Hardware Abstraction Layer *********************************/
+ typedef std::list<RTCString> DiskList;
+
class CollectorHAL
{
public:
@@ -357,6 +372,8 @@ namespace pm
virtual int getHostMemoryUsage(ULONG *total, ULONG *used, ULONG *available);
/** Returns file system counters in megabytes. */
virtual int getHostFilesystemUsage(const char *name, ULONG *total, ULONG *used, ULONG *available);
+ /** Returns disk size in bytes. */
+ virtual int getHostDiskSize(const char *name, uint64_t *size);
/** Returns CPU usage in 1/1000th per cent by a particular process. */
virtual int getProcessCpuLoad(RTPROCESS process, ULONG *user, ULONG *kernel);
/** Returns the amount of memory used by a process in kilobytes. */
@@ -370,13 +387,13 @@ namespace pm
virtual int getRawHostDiskLoad(const char *name, uint64_t *disk_ms, uint64_t *total_ms);
/** Returns process' CPU usage counter in platform-specific units. */
virtual int getRawProcessCpuLoad(RTPROCESS process, uint64_t *user, uint64_t *kernel, uint64_t *total);
+
+ /** Returns the lists of disks (aggregate and physical) used by the specified file system. */
+ virtual int getDiskListByFs(const char *name, DiskList& listUsage, DiskList& listLoad);
};
extern CollectorHAL *createHAL();
- typedef std::list<RTCString> DiskList;
- extern int getDiskListByFs(const char *name, DiskList& list);
-
/* Base Metrics *********************************************************/
class BaseMetric
{
@@ -455,6 +472,7 @@ namespace pm
HostCpuLoadRaw(CollectorHAL *hal, ComPtr<IUnknown> object, SubMetric *user, SubMetric *kernel, SubMetric *idle)
: HostCpuLoad(hal, object, user, kernel, idle), mUserPrev(0), mKernelPrev(0), mIdlePrev(0) {};
+ void init(ULONG period, ULONG length);
void preCollect(CollectorHints& hints, uint64_t iTick);
void collect();
private:
@@ -501,6 +519,27 @@ namespace pm
SubMetric *mAvailable;
};
+ class HostNetworkSpeed : public BaseMetric
+ {
+ public:
+ HostNetworkSpeed(CollectorHAL *hal, ComPtr<IUnknown> object, com::Utf8Str name, com::Utf8Str shortname, com::Utf8Str /* ifname */, uint32_t speed, SubMetric *linkspeed)
+ : BaseMetric(hal, name, object), mShortName(shortname), mSpeed(speed), mLinkSpeed(linkspeed) {};
+ ~HostNetworkSpeed() { delete mLinkSpeed; };
+
+ void init(ULONG period, ULONG length);
+
+ void preCollect(CollectorHints& /* hints */, uint64_t /* iTick */) {};
+ void collect() { if (mSpeed) mLinkSpeed->put(mSpeed); };
+ const char *getUnit() { return "mbit/s"; };
+ ULONG getMinValue() { return 0; };
+ ULONG getMaxValue() { return INT32_MAX; };
+ ULONG getScale() { return 1; }
+ private:
+ com::Utf8Str mShortName;
+ uint32_t mSpeed;
+ SubMetric *mLinkSpeed;
+ };
+
class HostNetworkLoadRaw : public BaseMetric
{
public:
@@ -549,6 +588,25 @@ namespace pm
SubMetric *mAvailable;
};
+ class HostDiskUsage : public BaseMetric
+ {
+ public:
+ HostDiskUsage(CollectorHAL *hal, ComPtr<IUnknown> object, com::Utf8Str name, com::Utf8Str diskname, SubMetric *total)
+ : BaseMetric(hal, name, object), mDiskName(diskname), mTotal(total) {};
+ ~HostDiskUsage() { delete mTotal; };
+
+ void init(ULONG period, ULONG length);
+ void preCollect(CollectorHints& hints, uint64_t iTick);
+ void collect();
+ const char *getUnit() { return "mB"; };
+ ULONG getMinValue() { return 0; };
+ ULONG getMaxValue() { return INT32_MAX; };
+ ULONG getScale() { return 1; }
+ private:
+ com::Utf8Str mDiskName;
+ SubMetric *mTotal;
+ };
+
class HostDiskLoadRaw : public BaseMetric
{
public:
@@ -660,6 +718,52 @@ namespace pm
#ifndef VBOX_COLLECTOR_TEST_CASE
+ typedef std::list<ComObjPtr<Medium> > MediaList;
+ class MachineDiskUsage : public BaseMetric
+ {
+ public:
+ MachineDiskUsage(CollectorHAL *hal, ComPtr<IUnknown> object, MediaList &disks, SubMetric *used)
+ : BaseMetric(hal, "Disk/Usage", object), mDisks(disks), mUsed(used) {};
+ ~MachineDiskUsage() { delete mUsed; };
+
+ void init(ULONG period, ULONG length);
+ void preCollect(CollectorHints& hints, uint64_t iTick);
+ void collect();
+ const char *getUnit() { return "mB"; };
+ ULONG getMinValue() { return 0; };
+ ULONG getMaxValue() { return INT32_MAX; };
+ ULONG getScale() { return 1; }
+ private:
+ MediaList mDisks;
+ SubMetric *mUsed;
+ };
+
+ /*
+ * Although MachineNetRate is measured for VM, not for the guest, it is
+ * derived from BaseGuestMetric since it uses the same mechanism for
+ * data collection -- values get pushed by Guest class along with other
+ * guest statistics.
+ */
+ class MachineNetRate : public BaseGuestMetric
+ {
+ public:
+ MachineNetRate(CollectorGuest *cguest, ComPtr<IUnknown> object, SubMetric *rx, SubMetric *tx)
+ : BaseGuestMetric(cguest, "Net/Rate", object), mRx(rx), mTx(tx) {};
+ ~MachineNetRate() { delete mRx; delete mTx; };
+
+ void init(ULONG period, ULONG length);
+ void preCollect(CollectorHints& hints, uint64_t iTick);
+ void collect();
+ int enable();
+ int disable();
+ const char *getUnit() { return "B/s"; };
+ ULONG getMinValue() { return 0; };
+ ULONG getMaxValue() { return INT32_MAX; };
+ ULONG getScale() { return 1; }
+ private:
+ SubMetric *mRx, *mTx;
+ };
+
class GuestCpuLoad : public BaseGuestMetric
{
public:
diff --git a/src/VBox/Main/include/PerformanceImpl.h b/src/VBox/Main/include/PerformanceImpl.h
index 26e83b4d..4ffbe77a 100644
--- a/src/VBox/Main/include/PerformanceImpl.h
+++ b/src/VBox/Main/include/PerformanceImpl.h
@@ -6,7 +6,7 @@
*/
/*
- * Copyright (C) 2008-2009 Oracle Corporation
+ * Copyright (C) 2008-2012 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Main/include/ProgressCombinedImpl.h b/src/VBox/Main/include/ProgressCombinedImpl.h
deleted file mode 100644
index c6454d6e..00000000
--- a/src/VBox/Main/include/ProgressCombinedImpl.h
+++ /dev/null
@@ -1,192 +0,0 @@
-/* $Id: ProgressCombinedImpl.h $ */
-/** @file
- *
- * VirtualBox COM class implementation
- */
-
-/*
- * Copyright (C) 2006-2010 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- */
-
-#ifndef ____H_PROGRESSCOMBINEDIMPL
-#define ____H_PROGRESSCOMBINEDIMPL
-
-#include "ProgressImpl.h"
-#include "AutoCaller.h"
-
-#include <vector>
-
-/**
- * The CombinedProgress class allows to combine several progress objects to a
- * single progress component. This single progress component will treat all
- * operations of individual progress objects as a single sequence of operations
- * that follow each other in the same order as progress objects are passed to
- * the #init() method.
- *
- * @note CombinedProgress is legacy code and deprecated. It does not support
- * weighted operations, all suboperations are assumed to take the same
- * amount of time. For new code, please use IProgress directly which
- * has supported multiple weighted suboperations since VirtualBox 3.0.
- *
- * Individual progress objects are sequentially combined so that this progress
- * object:
- *
- * - is cancelable only if all progresses are cancelable.
- * - is canceled once a progress that follows next to successfully completed
- * ones reports it was canceled.
- * - is completed successfully only after all progresses are completed
- * successfully.
- * - is completed unsuccessfully once a progress that follows next to
- * successfully completed ones reports it was completed unsuccessfully;
- * the result code and error info of the unsuccessful progress
- * will be reported as the result code and error info of this progress.
- * - returns N as the operation number, where N equals to the number of
- * operations in all successfully completed progresses starting from the
- * first one plus the operation number of the next (not yet complete)
- * progress; the operation description of the latter one is reported as
- * the operation description of this progress object.
- * - returns P as the percent value, where P equals to the sum of percents
- * of all successfully completed progresses starting from the
- * first one plus the percent value of the next (not yet complete)
- * progress, normalized to 100%.
- *
- * @note It's the responsibility of the combined progress object creator to
- * complete individual progresses in the right order: if, let's say, the
- * last progress is completed before all previous ones,
- * #WaitForCompletion(-1) will most likely give 100% CPU load because it
- * will be in a loop calling a method that returns immediately.
- */
-class ATL_NO_VTABLE CombinedProgress :
- public Progress
-{
-
-public:
- VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(CombinedProgress, IProgress)
-
- DECLARE_NOT_AGGREGATABLE(CombinedProgress)
-
- DECLARE_PROTECT_FINAL_CONSTRUCT()
-
- BEGIN_COM_MAP (CombinedProgress)
- VBOX_DEFAULT_INTERFACE_ENTRIES (IProgress)
- END_COM_MAP()
-
- HRESULT FinalConstruct();
- void FinalRelease();
-
- // public initializer/uninitializer for internal purposes only
-
- HRESULT init (
-#if !defined (VBOX_COM_INPROC)
- VirtualBox *aParent,
-#endif
- IUnknown *aInitiator,
- CBSTR aDescription,
- IProgress *aProgress1, IProgress *aProgress2,
- OUT_GUID aId = NULL);
-
- /**
- * Initializes the combined progress object given the first and the last
- * normal progress object from the list.
- *
- * @param aParent See ProgressBase::init().
- * @param aInitiator See ProgressBase::init().
- * @param aDescription See ProgressBase::init().
- * @param aFirstProgress Iterator of the first normal progress object.
- * @param aSecondProgress Iterator of the last normal progress object.
- * @param aId See ProgressBase::init().
- */
- template <typename InputIterator>
- HRESULT init (
-#if !defined (VBOX_COM_INPROC)
- VirtualBox *aParent,
-#endif
- IUnknown *aInitiator,
- CBSTR aDescription,
- InputIterator aFirstProgress, InputIterator aLastProgress,
- OUT_GUID aId = NULL)
- {
- /* Enclose the state transition NotReady->InInit->Ready */
- AutoInitSpan autoInitSpan (this);
- AssertReturn (autoInitSpan.isOk(), E_FAIL);
-
- mProgresses = ProgressVector (aFirstProgress, aLastProgress);
-
- HRESULT rc = protectedInit (autoInitSpan,
-#if !defined (VBOX_COM_INPROC)
- aParent,
-#endif
- aInitiator, aDescription, aId);
-
- /* Confirm a successful initialization when it's the case */
- if (SUCCEEDED(rc))
- autoInitSpan.setSucceeded();
-
- return rc;
- }
-
-protected:
-
- HRESULT protectedInit (AutoInitSpan &aAutoInitSpan,
-#if !defined (VBOX_COM_INPROC)
- VirtualBox *aParent,
-#endif
- IUnknown *aInitiator,
- CBSTR aDescription, OUT_GUID aId);
-
-public:
-
- void uninit();
-
- // IProgress properties
- STDMETHOD(COMGETTER(Percent)) (ULONG *aPercent);
- STDMETHOD(COMGETTER(Completed)) (BOOL *aCompleted);
- STDMETHOD(COMGETTER(Canceled)) (BOOL *aCanceled);
- STDMETHOD(COMGETTER(ResultCode)) (LONG *aResultCode);
- STDMETHOD(COMGETTER(ErrorInfo)) (IVirtualBoxErrorInfo **aErrorInfo);
- STDMETHOD(COMGETTER(Operation)) (ULONG *aCount);
- STDMETHOD(COMGETTER(OperationDescription)) (BSTR *aOperationDescription);
- STDMETHOD(COMGETTER(OperationPercent)) (ULONG *aOperationPercent);
- STDMETHOD(COMSETTER(Timeout)) (ULONG aTimeout);
- STDMETHOD(COMGETTER(Timeout)) (ULONG *aTimeout);
-
- // IProgress methods
- STDMETHOD(WaitForCompletion) (LONG aTimeout);
- STDMETHOD(WaitForOperationCompletion) (ULONG aOperation, LONG aTimeout);
- STDMETHOD(Cancel)();
-
- STDMETHOD(SetCurrentOperationProgress)(ULONG aPercent)
- {
- NOREF(aPercent);
- return E_NOTIMPL;
- }
-
- STDMETHOD(SetNextOperation)(IN_BSTR bstrNextOperationDescription, ULONG ulNextOperationsWeight)
- {
- NOREF(bstrNextOperationDescription); NOREF(ulNextOperationsWeight);
- return E_NOTIMPL;
- }
-
- // public methods only for internal purposes
-
-private:
-
- HRESULT checkProgress();
-
- typedef std::vector <ComPtr<IProgress> > ProgressVector;
- ProgressVector mProgresses;
-
- size_t mProgress;
- ULONG mCompletedOperations;
-};
-
-#endif /* ____H_PROGRESSCOMBINEDIMPL */
-
diff --git a/src/VBox/Main/include/ProgressImpl.h b/src/VBox/Main/include/ProgressImpl.h
index a04d4b06..6b012742 100644
--- a/src/VBox/Main/include/ProgressImpl.h
+++ b/src/VBox/Main/include/ProgressImpl.h
@@ -5,7 +5,7 @@
*/
/*
- * Copyright (C) 2006-2010 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -26,68 +26,17 @@
////////////////////////////////////////////////////////////////////////////////
/**
- * Base component class for progress objects.
+ * Class for progress objects.
*/
-class ATL_NO_VTABLE ProgressBase :
+class ATL_NO_VTABLE Progress :
public VirtualBoxBase,
VBOX_SCRIPTABLE_IMPL(IProgress)
{
protected:
-// VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(ProgressBase, IProgress)
-// cannot be added here or Windows will not buuld; as a result, ProgressBase cannot be
-// instantiated, but we're not doing that anyway (but only its children)
-
- DECLARE_EMPTY_CTOR_DTOR (ProgressBase)
-
- HRESULT FinalConstruct();
-
- // protected initializer/uninitializer for internal purposes only
- HRESULT protectedInit(AutoInitSpan &aAutoInitSpan,
-#if !defined (VBOX_COM_INPROC)
- VirtualBox *aParent,
-#endif
- IUnknown *aInitiator,
- CBSTR aDescription, OUT_GUID aId = NULL);
- HRESULT protectedInit(AutoInitSpan &aAutoInitSpan);
- void protectedUninit(AutoUninitSpan &aAutoUninitSpan);
-
-public:
-
- // IProgress properties
- STDMETHOD(COMGETTER(Id)) (BSTR *aId);
- STDMETHOD(COMGETTER(Description)) (BSTR *aDescription);
- STDMETHOD(COMGETTER(Initiator)) (IUnknown **aInitiator);
+ DECLARE_EMPTY_CTOR_DTOR (Progress)
- // IProgress properties
- STDMETHOD(COMGETTER(Cancelable)) (BOOL *aCancelable);
- STDMETHOD(COMGETTER(Percent)) (ULONG *aPercent);
- STDMETHOD(COMGETTER(TimeRemaining)) (LONG *aTimeRemaining);
- STDMETHOD(COMGETTER(Completed)) (BOOL *aCompleted);
- STDMETHOD(COMGETTER(Canceled)) (BOOL *aCanceled);
- STDMETHOD(COMGETTER(ResultCode)) (LONG *aResultCode);
- STDMETHOD(COMGETTER(ErrorInfo)) (IVirtualBoxErrorInfo **aErrorInfo);
- STDMETHOD(COMGETTER(OperationCount)) (ULONG *aOperationCount);
- STDMETHOD(COMGETTER(Operation)) (ULONG *aOperation);
- STDMETHOD(COMGETTER(OperationDescription)) (BSTR *aOperationDescription);
- STDMETHOD(COMGETTER(OperationPercent)) (ULONG *aOperationPercent);
- STDMETHOD(COMGETTER(OperationWeight)) (ULONG *aOperationWeight);
- STDMETHOD(COMSETTER(Timeout)) (ULONG aTimeout);
- STDMETHOD(COMGETTER(Timeout)) (ULONG *aTimeout);
-
- // public methods only for internal purposes
-
- bool setCancelCallback(void (*pfnCallback)(void *), void *pvUser);
-
-
- // unsafe inline public methods for internal purposes only (ensure there is
- // a caller and a read lock before calling them!)
-
- BOOL getCompleted() const { return mCompleted; }
- HRESULT getResultCode() const { return mResultCode; }
- double calcTotalPercent();
-protected:
void checkForAutomaticTimeout(void);
#if !defined (VBOX_COM_INPROC)
@@ -123,16 +72,6 @@ protected:
ULONG m_ulCurrentOperationWeight; // weight of current operation, given to setNextOperation()
ULONG m_ulOperationPercent; // percentage of current operation, set with setCurrentOperationProgress()
ULONG m_cMsTimeout; /**< Automatic timeout value. 0 means none. */
-};
-
-////////////////////////////////////////////////////////////////////////////////
-
-/**
- * Normal progress object.
- */
-class ATL_NO_VTABLE Progress :
- public ProgressBase
-{
public:
VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(Progress, IProgress)
@@ -236,7 +175,17 @@ public:
ULONG aOperationCount,
CBSTR aOperationDescription);
+// initializer/uninitializer for internal purposes only
+ HRESULT init(AutoInitSpan &aAutoInitSpan,
+#if !defined (VBOX_COM_INPROC)
+ VirtualBox *aParent,
+#endif
+ IUnknown *aInitiator,
+ CBSTR aDescription, OUT_GUID aId = NULL);
+ HRESULT init(AutoInitSpan &aAutoInitSpan);
+ void init(AutoUninitSpan &aAutoUninitSpan);
void uninit();
+ void uninit(AutoUninitSpan &aAutoUninitSpan);
// IProgress methods
STDMETHOD(WaitForCompletion)(LONG aTimeout);
@@ -264,6 +213,38 @@ public:
va_list va);
bool notifyPointOfNoReturn(void);
+ // IProgress properties
+ STDMETHOD(COMGETTER(Id)) (BSTR *aId);
+ STDMETHOD(COMGETTER(Description)) (BSTR *aDescription);
+ STDMETHOD(COMGETTER(Initiator)) (IUnknown **aInitiator);
+
+ // IProgress properties
+ STDMETHOD(COMGETTER(Cancelable)) (BOOL *aCancelable);
+ STDMETHOD(COMGETTER(Percent)) (ULONG *aPercent);
+ STDMETHOD(COMGETTER(TimeRemaining)) (LONG *aTimeRemaining);
+ STDMETHOD(COMGETTER(Completed)) (BOOL *aCompleted);
+ STDMETHOD(COMGETTER(Canceled)) (BOOL *aCanceled);
+ STDMETHOD(COMGETTER(ResultCode)) (LONG *aResultCode);
+ STDMETHOD(COMGETTER(ErrorInfo)) (IVirtualBoxErrorInfo **aErrorInfo);
+ STDMETHOD(COMGETTER(OperationCount)) (ULONG *aOperationCount);
+ STDMETHOD(COMGETTER(Operation)) (ULONG *aOperation);
+ STDMETHOD(COMGETTER(OperationDescription)) (BSTR *aOperationDescription);
+ STDMETHOD(COMGETTER(OperationPercent)) (ULONG *aOperationPercent);
+ STDMETHOD(COMGETTER(OperationWeight)) (ULONG *aOperationWeight);
+ STDMETHOD(COMSETTER(Timeout)) (ULONG aTimeout);
+ STDMETHOD(COMGETTER(Timeout)) (ULONG *aTimeout);
+
+ // public methods only for internal purposes
+
+ bool setCancelCallback(void (*pfnCallback)(void *), void *pvUser);
+
+
+ // unsafe inline public methods for internal purposes only (ensure there is
+ // a caller and a read lock before calling them!)
+ BOOL getCompleted() const { return mCompleted; }
+ HRESULT getResultCode() const { return mResultCode; }
+ double calcTotalPercent();
+
private:
RTSEMEVENTMULTI mCompletedSem;
diff --git a/src/VBox/Main/include/ProgressProxyImpl.h b/src/VBox/Main/include/ProgressProxyImpl.h
index 87ebd708..66f2b31c 100644
--- a/src/VBox/Main/include/ProgressProxyImpl.h
+++ b/src/VBox/Main/include/ProgressProxyImpl.h
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2006-2010 Oracle Corporation
+ * Copyright (C) 2006-2012 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Main/include/RemoteUSBBackend.h b/src/VBox/Main/include/RemoteUSBBackend.h
index dd6685c9..baf47a48 100644
--- a/src/VBox/Main/include/RemoteUSBBackend.h
+++ b/src/VBox/Main/include/RemoteUSBBackend.h
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2006-2007 Oracle Corporation
+ * Copyright (C) 2006-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Main/include/RemoteUSBDeviceImpl.h b/src/VBox/Main/include/RemoteUSBDeviceImpl.h
index 2285ee93..e92552e6 100644
--- a/src/VBox/Main/include/RemoteUSBDeviceImpl.h
+++ b/src/VBox/Main/include/RemoteUSBDeviceImpl.h
@@ -7,7 +7,7 @@
*/
/*
- * Copyright (C) 2006-2009 Oracle Corporation
+ * Copyright (C) 2006-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Main/include/SessionImpl.h b/src/VBox/Main/include/SessionImpl.h
index dd93411a..f6a3db13 100644
--- a/src/VBox/Main/include/SessionImpl.h
+++ b/src/VBox/Main/include/SessionImpl.h
@@ -1,10 +1,9 @@
/** @file
- *
* VBox Client Session COM Class definition
*/
/*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -25,14 +24,6 @@
# include "win/resource.h"
#endif
-/** @def VBOX_WITH_SYS_V_IPC_SESSION_WATCHER
- * Use SYS V IPC for watching a session.
- * This is defined in the Makefile since it's also used by MachineImpl.h/cpp.
- */
-#ifdef DOXYGEN_RUNNING
-# define VBOX_WITH_SYS_V_IPC_SESSION_WATCHER
-#endif
-
#ifdef RT_OS_WINDOWS
[threading(free)]
#endif
@@ -80,7 +71,11 @@ public:
// IInternalSessionControl methods
STDMETHOD(GetPID)(ULONG *aPid);
STDMETHOD(GetRemoteConsole)(IConsole **aConsole);
- STDMETHOD(AssignMachine)(IMachine *aMachine, LockType_T aLockType);
+#ifndef VBOX_WITH_GENERIC_SESSION_WATCHER
+ STDMETHOD(AssignMachine)(IMachine *aMachine, LockType_T aLockType, IN_BSTR aTokenId);
+#else /* VBOX_WITH_GENERIC_SESSION_WATCHER */
+ STDMETHOD(AssignMachine)(IMachine *aMachine, LockType_T aLockType, IToken *aToken);
+#endif /* VBOX_WITH_GENERIC_SESSION_WATCHER */
STDMETHOD(AssignRemoteMachine)(IMachine *aMachine, IConsole *aConsole);
STDMETHOD(UpdateMachineState)(MachineState_T aMachineState);
STDMETHOD(Uninitialize)();
@@ -92,6 +87,7 @@ public:
STDMETHOD(OnCPUChange)(ULONG aCPU, BOOL aRemove);
STDMETHOD(OnCPUExecutionCapChange)(ULONG aExecutionCap);
STDMETHOD(OnVRDEServerChange)(BOOL aRestart);
+ STDMETHOD(OnVideoCaptureChange)();
STDMETHOD(OnUSBControllerChange)();
STDMETHOD(OnSharedFolderChange)(BOOL aGlobal);
STDMETHOD(OnClipboardModeChange)(ClipboardMode_T aClipboardMode);
@@ -100,7 +96,7 @@ public:
STDMETHOD(OnUSBDeviceDetach)(IN_BSTR aId, IVirtualBoxErrorInfo *aError);
STDMETHOD(OnShowWindow)(BOOL aCheck, BOOL *aCanShow, LONG64 *aWinId);
STDMETHOD(OnBandwidthGroupChange)(IBandwidthGroup *aBandwidthGroup);
- STDMETHOD(OnStorageDeviceChange)(IMediumAttachment *aMediumAttachment, BOOL aRemove);
+ STDMETHOD(OnStorageDeviceChange)(IMediumAttachment *aMediumAttachment, BOOL aRemove, BOOL aSilent);
STDMETHOD(AccessGuestProperty)(IN_BSTR aName, IN_BSTR aValue, IN_BSTR aFlags,
BOOL aIsSetter, BSTR *aRetValue, LONG64 *aRetTimestamp, BSTR *aRetFlags);
STDMETHOD(EnumerateGuestProperties)(IN_BSTR aPatterns,
@@ -110,43 +106,34 @@ public:
ComSafeArrayOut(BSTR, aFlags));
STDMETHOD(OnlineMergeMedium)(IMediumAttachment *aMediumAttachment,
ULONG aSourceIdx, ULONG aTargetIdx,
- IMedium *aSource, IMedium *aTarget,
- BOOL aMergeForward, IMedium *aParentForTarget,
- ComSafeArrayIn(IMedium *, aChildrenToReparent),
IProgress *aProgress);
STDMETHOD(EnableVMMStatistics)(BOOL aEnable);
+ STDMETHOD(PauseWithReason)(Reason_T aReason);
+ STDMETHOD(ResumeWithReason)(Reason_T aReason);
+ STDMETHOD(SaveStateWithReason)(Reason_T aReason, IProgress **aProgress);
private:
HRESULT unlockMachine(bool aFinalRelease, bool aFromServer);
- HRESULT grabIPCSemaphore();
- void releaseIPCSemaphore();
SessionState_T mState;
SessionType_T mType;
ComPtr<IInternalMachineControl> mControl;
+#ifndef VBOX_COM_INPROC_API_CLIENT
ComObjPtr<Console> mConsole;
+#endif
ComPtr<IMachine> mRemoteMachine;
ComPtr<IConsole> mRemoteConsole;
ComPtr<IVirtualBox> mVirtualBox;
- /* interprocess semaphore handle (id) for the opened machine */
-#if defined(RT_OS_WINDOWS)
- HANDLE mIPCSem;
- HANDLE mIPCThreadSem;
-#elif defined(RT_OS_OS2)
- RTTHREAD mIPCThread;
- RTSEMEVENT mIPCThreadSem;
-#elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER)
- int mIPCSem;
-#else
-# error "Port me!"
-#endif
+ class ClientTokenHolder;
+
+ ClientTokenHolder *mClientTokenHolder;
};
-#endif // ____H_SESSIONIMPL
+#endif // !____H_SESSIONIMPL
/* vi: set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/src/VBox/Main/include/SharedFolderImpl.h b/src/VBox/Main/include/SharedFolderImpl.h
index a4ee94ac..d14a7b58 100644
--- a/src/VBox/Main/include/SharedFolderImpl.h
+++ b/src/VBox/Main/include/SharedFolderImpl.h
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2006-2010 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -99,9 +99,12 @@ private:
VirtualBoxBase * const mParent;
/* weak parents (only one of them is not null) */
+#if !defined(VBOX_COM_INPROC)
Machine * const mMachine;
- Console * const mConsole;
VirtualBox * const mVirtualBox;
+#else
+ Console * const mConsole;
+#endif
struct Data; // opaque data struct, defined in SharedFolderImpl.cpp
Data *m;
diff --git a/src/VBox/Main/include/SnapshotImpl.h b/src/VBox/Main/include/SnapshotImpl.h
index 1e94e5ea..e86bbbcd 100644
--- a/src/VBox/Main/include/SnapshotImpl.h
+++ b/src/VBox/Main/include/SnapshotImpl.h
@@ -100,6 +100,8 @@ public:
const Utf8Str& getStateFilePath() const;
+ uint32_t getDepth();
+
ULONG getChildrenCount();
ULONG getAllChildrenCount();
ULONG getAllChildrenCountImpl();
diff --git a/src/VBox/Main/include/StorageControllerImpl.h b/src/VBox/Main/include/StorageControllerImpl.h
index 98e8d473..1292804a 100644
--- a/src/VBox/Main/include/StorageControllerImpl.h
+++ b/src/VBox/Main/include/StorageControllerImpl.h
@@ -6,7 +6,7 @@
*/
/*
- * Copyright (C) 2008 Oracle Corporation
+ * Copyright (C) 2008-2012 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Main/include/SystemPropertiesImpl.h b/src/VBox/Main/include/SystemPropertiesImpl.h
index e910b982..3f77949a 100644
--- a/src/VBox/Main/include/SystemPropertiesImpl.h
+++ b/src/VBox/Main/include/SystemPropertiesImpl.h
@@ -6,7 +6,7 @@
*/
/*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -69,6 +69,10 @@ public:
STDMETHOD(COMGETTER(SerialPortCount))(ULONG *count);
STDMETHOD(COMGETTER(ParallelPortCount))(ULONG *count);
STDMETHOD(COMGETTER(MaxBootPosition))(ULONG *aMaxBootPosition);
+ STDMETHOD(COMGETTER(ExclusiveHwVirt))(BOOL *aExclusiveHwVirt);
+ STDMETHOD(COMSETTER(ExclusiveHwVirt))(BOOL aExclusiveHwVirt);
+ STDMETHOD(COMGETTER(LoggingLevel))(BSTR *aLoggingLevel);
+ STDMETHOD(COMSETTER(LoggingLevel))(IN_BSTR aLoggingLevel);
STDMETHOD(COMGETTER(DefaultMachineFolder))(BSTR *aDefaultMachineFolder);
STDMETHOD(COMSETTER(DefaultMachineFolder))(IN_BSTR aDefaultMachineFolder);
STDMETHOD(COMGETTER(MediumFormats))(ComSafeArrayOut(IMediumFormat *, aMediumFormats));
@@ -95,6 +99,8 @@ public:
STDMETHOD(COMSETTER(AutostartDatabasePath))(IN_BSTR aAutostartDbPath);
STDMETHOD(COMGETTER(DefaultAdditionsISO))(BSTR *aDefaultAdditionsISO);
STDMETHOD(COMSETTER(DefaultAdditionsISO))(IN_BSTR aDefaultAdditionsISO);
+ STDMETHOD(COMGETTER(DefaultFrontend))(BSTR *aDefaultFrontend);
+ STDMETHOD(COMSETTER(DefaultFrontend))(IN_BSTR aDefaultFrontend);
STDMETHOD(GetMaxNetworkAdapters)(ChipsetType_T aChipset, ULONG *aMaxInstances);
STDMETHOD(GetMaxNetworkAdaptersOfType)(ChipsetType_T aChipset, NetworkAttachmentType_T aType, ULONG *aMaxInstances);
@@ -104,6 +110,7 @@ public:
STDMETHOD(GetMaxInstancesOfStorageBus)(ChipsetType_T aChipset, StorageBus_T aBus, ULONG *aMaxInstances);
STDMETHOD(GetDeviceTypesForStorageBus)(StorageBus_T aBus, ComSafeArrayOut(DeviceType_T, aDeviceTypes));
STDMETHOD(GetDefaultIoCacheSettingForStorageController)(StorageControllerType_T aControllerType, BOOL *aEnabled);
+ STDMETHOD(GetMaxInstancesOfUSBControllerType)(ChipsetType_T aChipset, USBControllerType_T aType, ULONG *aMaxInstances);
// public methods only for internal purposes
@@ -122,6 +129,7 @@ private:
HRESULT getUserHomeDirectory(Utf8Str &strPath);
HRESULT setDefaultMachineFolder(const Utf8Str &aPath);
+ HRESULT setLoggingLevel(const Utf8Str &aLoggingLevel);
HRESULT setDefaultHardDiskFormat(const Utf8Str &aFormat);
HRESULT setVRDEAuthLibrary(const Utf8Str &aPath);
@@ -129,6 +137,7 @@ private:
HRESULT setDefaultVRDEExtPack(const Utf8Str &aPath);
HRESULT setAutostartDatabasePath(const Utf8Str &aPath);
HRESULT setDefaultAdditionsISO(const Utf8Str &aPath);
+ HRESULT setDefaultFrontend(const Utf8Str &aPath);
VirtualBox * const mParent;
diff --git a/src/VBox/Main/include/TokenImpl.h b/src/VBox/Main/include/TokenImpl.h
new file mode 100644
index 00000000..1bb49639
--- /dev/null
+++ b/src/VBox/Main/include/TokenImpl.h
@@ -0,0 +1,107 @@
+/* $Id: TokenImpl.h $ */
+
+/** @file
+ *
+ * Token COM class implementations: MachineToken and MediumLockToken
+ */
+
+/*
+ * Copyright (C) 2013 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef TOKEN_IMPL_H_
+#define TOKEN_IMPL_H_
+
+#include "TokenWrap.h"
+#include "MachineImpl.h"
+
+
+/**
+ * The MachineToken class automates cleanup of a SessionMachine object.
+ */
+class ATL_NO_VTABLE MachineToken :
+ public TokenWrap
+{
+public:
+
+ DECLARE_EMPTY_CTOR_DTOR(MachineToken)
+
+ HRESULT FinalConstruct();
+ void FinalRelease();
+
+ // public initializer/uninitializer for internal purposes only
+ HRESULT init(const ComObjPtr<SessionMachine> &pSessionMachine);
+ void uninit(bool fAbandon);
+
+private:
+
+ // wrapped IToken methods
+ HRESULT abandon(AutoCaller &aAutoCaller);
+ HRESULT dummy();
+
+ // data
+ struct Data
+ {
+ Data()
+ {
+ }
+
+ ComObjPtr<SessionMachine> pSessionMachine;
+ };
+
+ Data m;
+};
+
+
+class Medium;
+
+/**
+ * The MediumLockToken class automates cleanup of a Medium lock.
+ */
+class ATL_NO_VTABLE MediumLockToken :
+ public TokenWrap
+{
+public:
+
+ DECLARE_EMPTY_CTOR_DTOR(MediumLockToken)
+
+ HRESULT FinalConstruct();
+ void FinalRelease();
+
+ // public initializer/uninitializer for internal purposes only
+ HRESULT init(const ComObjPtr<Medium> &pMedium, bool fWrite);
+ void uninit();
+
+private:
+
+ // wrapped IToken methods
+ HRESULT abandon(AutoCaller &aAutoCaller);
+ HRESULT dummy();
+
+ // data
+ struct Data
+ {
+ Data() :
+ fWrite(false)
+ {
+ }
+
+ ComObjPtr<Medium> pMedium;
+ bool fWrite;
+ };
+
+ Data m;
+};
+
+
+#endif // TOKEN_IMPL_H_
+
+/* vi: set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/src/VBox/Main/include/USBControllerImpl.h b/src/VBox/Main/include/USBControllerImpl.h
index 63ba58f2..814f4b53 100644
--- a/src/VBox/Main/include/USBControllerImpl.h
+++ b/src/VBox/Main/include/USBControllerImpl.h
@@ -51,47 +51,27 @@ public:
void FinalRelease();
// public initializer/uninitializer for internal purposes only
- HRESULT init(Machine *aParent);
- HRESULT init(Machine *aParent, USBController *aThat);
+ HRESULT init(Machine *aParent, const Utf8Str &aName, USBControllerType_T enmType);
+ HRESULT init(Machine *aParent, USBController *aThat, bool fReshare = false);
HRESULT initCopy(Machine *aParent, USBController *aThat);
void uninit();
// IUSBController properties
- STDMETHOD(COMGETTER(Enabled))(BOOL *aEnabled);
- STDMETHOD(COMSETTER(Enabled))(BOOL aEnabled);
- STDMETHOD(COMGETTER(EnabledEHCI))(BOOL *aEnabled);
- STDMETHOD(COMSETTER(EnabledEHCI))(BOOL aEnabled);
- STDMETHOD(COMGETTER(ProxyAvailable))(BOOL *aEnabled);
+ STDMETHOD(COMGETTER(Name))(BSTR *aName);
+ STDMETHOD(COMGETTER(Type))(USBControllerType_T *enmType);
STDMETHOD(COMGETTER(USBStandard))(USHORT *aUSBStandard);
- STDMETHOD(COMGETTER(DeviceFilters))(ComSafeArrayOut(IUSBDeviceFilter *, aDevicesFilters));
-
- // IUSBController methods
- STDMETHOD(CreateDeviceFilter)(IN_BSTR aName, IUSBDeviceFilter **aFilter);
- STDMETHOD(InsertDeviceFilter)(ULONG aPosition, IUSBDeviceFilter *aFilter);
- STDMETHOD(RemoveDeviceFilter)(ULONG aPosition, IUSBDeviceFilter **aFilter);
// public methods only for internal purposes
- HRESULT loadSettings(const settings::USBController &data);
- HRESULT saveSettings(settings::USBController &data);
-
void rollback();
void commit();
void copyFrom(USBController *aThat);
+ void unshare();
-#ifdef VBOX_WITH_USB
- HRESULT onDeviceFilterChange(USBDeviceFilter *aFilter,
- BOOL aActiveChanged = FALSE);
-
- bool hasMatchingFilter(const ComObjPtr<HostUSBDevice> &aDevice, ULONG *aMaskedIfs);
- bool hasMatchingFilter(IUSBDevice *aUSBDevice, ULONG *aMaskedIfs);
-
- HRESULT notifyProxy(bool aInsertFilters);
-#endif /* VBOX_WITH_USB */
+ const Utf8Str &getName() const;
+ USBControllerType_T getControllerType() const;
- // public methods for internal purposes only
- // (ensure there is a caller and a read lock before calling them!)
- Machine* getMachine();
+ ComObjPtr<USBController> getPeer();
private:
diff --git a/src/VBox/Main/include/USBDeviceFilterImpl.h b/src/VBox/Main/include/USBDeviceFilterImpl.h
index 562d7693..aaa8ced7 100644
--- a/src/VBox/Main/include/USBDeviceFilterImpl.h
+++ b/src/VBox/Main/include/USBDeviceFilterImpl.h
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2006-2009 Oracle Corporation
+ * Copyright (C) 2006-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -23,7 +23,7 @@
#include "Matching.h"
#include <VBox/usbfilter.h>
-class USBController;
+class USBDeviceFilters;
class Host;
namespace settings
{
@@ -82,12 +82,12 @@ public:
void FinalRelease();
// public initializer/uninitializer for internal purposes only
- HRESULT init(USBController *aParent,
+ HRESULT init(USBDeviceFilters *aParent,
const settings::USBDeviceFilter &data);
- HRESULT init(USBController *aParent, IN_BSTR aName);
- HRESULT init(USBController *aParent, USBDeviceFilter *aThat,
+ HRESULT init(USBDeviceFilters *aParent, IN_BSTR aName);
+ HRESULT init(USBDeviceFilters *aParent, USBDeviceFilter *aThat,
bool aReshare = false);
- HRESULT initCopy(USBController *aParent, USBDeviceFilter *aThat);
+ HRESULT initCopy(USBDeviceFilters *aParent, USBDeviceFilter *aThat);
void uninit();
// IUSBDeviceFilter properties
@@ -142,8 +142,8 @@ private:
HRESULT usbFilterFieldSetter(USBFILTERIDX aIdx, IN_BSTR aStr);
HRESULT usbFilterFieldSetter(USBFILTERIDX aIdx, const Utf8Str &strNew);
- USBController * const mParent;
- USBDeviceFilter * const mPeer;
+ USBDeviceFilters * const mParent;
+ USBDeviceFilter * const mPeer;
Backupable<Data> mData;
@@ -153,7 +153,7 @@ private:
(not touched by the class itself except that in init()/uninit()) */
bool mInList;
- friend class USBController;
+ friend class USBDeviceFilters;
};
// HostUSBDeviceFilter
diff --git a/src/VBox/Main/include/USBDeviceFiltersImpl.h b/src/VBox/Main/include/USBDeviceFiltersImpl.h
new file mode 100644
index 00000000..190430f5
--- /dev/null
+++ b/src/VBox/Main/include/USBDeviceFiltersImpl.h
@@ -0,0 +1,99 @@
+/* $Id: USBDeviceFiltersImpl.h $ */
+
+/** @file
+ *
+ * VBox USBDeviceFilters COM Class declaration.
+ */
+
+/*
+ * Copyright (C) 2013 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef ____H_USBDEVICEFILTERSIMPL
+#define ____H_USBDEVICEFILTERSIMPL
+
+#include "VirtualBoxBase.h"
+
+class HostUSBDevice;
+class USBDeviceFilter;
+
+namespace settings
+{
+ struct USB;
+}
+
+class ATL_NO_VTABLE USBDeviceFilters :
+ public VirtualBoxBase,
+ VBOX_SCRIPTABLE_IMPL(IUSBDeviceFilters)
+{
+public:
+ VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(USBDeviceFilters, IUSBDeviceFilters)
+
+ DECLARE_NOT_AGGREGATABLE(USBDeviceFilters)
+
+ DECLARE_PROTECT_FINAL_CONSTRUCT()
+
+ BEGIN_COM_MAP(USBDeviceFilters)
+ VBOX_DEFAULT_INTERFACE_ENTRIES(IUSBDeviceFilters)
+ END_COM_MAP()
+
+ DECLARE_EMPTY_CTOR_DTOR(USBDeviceFilters)
+
+ HRESULT FinalConstruct();
+ void FinalRelease();
+
+ // public initializer/uninitializer for internal purposes only
+ HRESULT init(Machine *aParent);
+ HRESULT init(Machine *aParent, USBDeviceFilters *aThat);
+ HRESULT initCopy(Machine *aParent, USBDeviceFilters *aThat);
+ void uninit();
+
+ // IUSBDeviceFilters attributes
+ STDMETHOD(COMGETTER(DeviceFilters))(ComSafeArrayOut(IUSBDeviceFilter *, aDevicesFilters));
+
+ // IUSBDeviceFilters methods
+ STDMETHOD(CreateDeviceFilter)(IN_BSTR aName, IUSBDeviceFilter **aFilter);
+ STDMETHOD(InsertDeviceFilter)(ULONG aPosition, IUSBDeviceFilter *aFilter);
+ STDMETHOD(RemoveDeviceFilter)(ULONG aPosition, IUSBDeviceFilter **aFilter);
+
+ // public methods only for internal purposes
+
+ HRESULT loadSettings(const settings::USB &data);
+ HRESULT saveSettings(settings::USB &data);
+
+ void rollback();
+ void commit();
+ void copyFrom(USBDeviceFilters *aThat);
+
+#ifdef VBOX_WITH_USB
+ HRESULT onDeviceFilterChange(USBDeviceFilter *aFilter,
+ BOOL aActiveChanged = FALSE);
+
+ bool hasMatchingFilter(const ComObjPtr<HostUSBDevice> &aDevice, ULONG *aMaskedIfs);
+ bool hasMatchingFilter(IUSBDevice *aUSBDevice, ULONG *aMaskedIfs);
+
+ HRESULT notifyProxy(bool aInsertFilters);
+#endif /* VBOX_WITH_USB */
+
+ // public methods for internal purposes only
+ // (ensure there is a caller and a read lock before calling them!)
+ Machine* getMachine();
+
+private:
+
+ void printList();
+
+ struct Data;
+ Data *m;
+};
+
+#endif //!____H_USBDEVICEFILTERSIMPL
+/* vi: set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/src/VBox/Main/include/USBDeviceImpl.h b/src/VBox/Main/include/USBDeviceImpl.h
index 162fb6e8..2ea81ef6 100644
--- a/src/VBox/Main/include/USBDeviceImpl.h
+++ b/src/VBox/Main/include/USBDeviceImpl.h
@@ -5,7 +5,7 @@
*/
/*
- * Copyright (C) 2006-2009 Oracle Corporation
+ * Copyright (C) 2006-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Main/include/USBGetDevices.h b/src/VBox/Main/include/USBGetDevices.h
index fd0b29ff..2b0e35f6 100644
--- a/src/VBox/Main/include/USBGetDevices.h
+++ b/src/VBox/Main/include/USBGetDevices.h
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2006-2010 Oracle Corporation
+ * Copyright (C) 2006-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Main/include/UsbWebcamInterface.h b/src/VBox/Main/include/UsbWebcamInterface.h
new file mode 100644
index 00000000..2604c731
--- /dev/null
+++ b/src/VBox/Main/include/UsbWebcamInterface.h
@@ -0,0 +1,66 @@
+/* $Id: UsbWebcamInterface.h $ */
+/** @file
+ * VirtualBox PDM Driver for Emulated USB Webcam
+ */
+
+/*
+ * Copyright (C) 2011-2013 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef ____H_USBWEBCAMINTERFACE
+#define ____H_USBWEBCAMINTERFACE
+
+#include <VBox/vmm/pdmdrv.h>
+#define VRDE_VIDEOIN_WITH_VRDEINTERFACE /* Get the VRDE interface definitions. */
+#include <VBox/RemoteDesktop/VRDEVideoIn.h>
+
+class ConsoleVRDPServer;
+typedef struct EMWEBCAMDRV EMWEBCAMDRV;
+typedef struct EMWEBCAMREMOTE EMWEBCAMREMOTE;
+
+class EmWebcam
+{
+ public:
+ EmWebcam(ConsoleVRDPServer *pServer);
+ virtual ~EmWebcam();
+
+ static const PDMDRVREG DrvReg;
+
+ void EmWebcamConstruct(EMWEBCAMDRV *pDrv);
+ void EmWebcamDestruct(EMWEBCAMDRV *pDrv);
+
+ /* Callbacks. */
+ void EmWebcamCbNotify(uint32_t u32Id, const void *pvData, uint32_t cbData);
+ void EmWebcamCbDeviceDesc(int rcRequest, void *pDeviceCtx, void *pvUser,
+ const VRDEVIDEOINDEVICEDESC *pDeviceDesc, uint32_t cbDeviceDesc);
+ void EmWebcamCbControl(int rcRequest, void *pDeviceCtx, void *pvUser,
+ const VRDEVIDEOINCTRLHDR *pControl, uint32_t cbControl);
+ void EmWebcamCbFrame(int rcRequest, void *pDeviceCtx,
+ const VRDEVIDEOINPAYLOADHDR *pFrame, uint32_t cbFrame);
+
+ /* Methods for the PDM driver. */
+ int SendControl(EMWEBCAMDRV *pDrv, void *pvUser, uint64_t u64DeviceId,
+ const VRDEVIDEOINCTRLHDR *pControl, uint32_t cbControl);
+
+ private:
+ static DECLCALLBACK(void *) drvQueryInterface(PPDMIBASE pInterface, const char *pszIID);
+ static DECLCALLBACK(int) drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
+ static DECLCALLBACK(void) drvDestruct(PPDMDRVINS pDrvIns);
+
+ ConsoleVRDPServer * const mParent;
+
+ EMWEBCAMDRV *mpDrv;
+ EMWEBCAMREMOTE *mpRemote;
+ uint64_t volatile mu64DeviceIdSrc;
+};
+
+#endif /* !____H_USBWEBCAMINTERFACE */
+/* vi: set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/src/VBox/Main/include/VFSExplorerImpl.h b/src/VBox/Main/include/VFSExplorerImpl.h
index 95871432..e87e1d96 100644
--- a/src/VBox/Main/include/VFSExplorerImpl.h
+++ b/src/VBox/Main/include/VFSExplorerImpl.h
@@ -6,7 +6,7 @@
*/
/*
- * Copyright (C) 2009 Oracle Corporation
+ * Copyright (C) 2009-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -55,7 +55,7 @@ class ATL_NO_VTABLE VFSExplorer :
STDMETHOD(Cd)(IN_BSTR aDir, IProgress **aProgress);
STDMETHOD(CdUp)(IProgress **aProgress);
- STDMETHOD(EntryList)(ComSafeArrayOut(BSTR, aNames), ComSafeArrayOut(VFSFileType_T, aTypes), ComSafeArrayOut(ULONG, aSizes), ComSafeArrayOut(ULONG, aModes));
+ STDMETHOD(EntryList)(ComSafeArrayOut(BSTR, aNames), ComSafeArrayOut(VFSFileType_T, aTypes), ComSafeArrayOut(LONG64, aSizes), ComSafeArrayOut(ULONG, aModes));
STDMETHOD(Exists)(ComSafeArrayIn(IN_BSTR, aNames), ComSafeArrayOut(BSTR, aExists));
diff --git a/src/VBox/Main/include/VMMDev.h b/src/VBox/Main/include/VMMDev.h
index 3258bdfe..3fe366ad 100644
--- a/src/VBox/Main/include/VMMDev.h
+++ b/src/VBox/Main/include/VMMDev.h
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 2006-2007 Oracle Corporation
+ * Copyright (C) 2006-2010 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -23,7 +23,13 @@
class Console;
-class VMMDev
+class VMMDevMouseInterface
+{
+public:
+ virtual PPDMIVMMDEVPORT getVMMDevPort() = 0;
+};
+
+class VMMDev : public VMMDevMouseInterface
{
public:
VMMDev(Console *console);
@@ -48,6 +54,7 @@ public:
PPDMIVMMDEVPORT getVMMDevPort();
+#ifdef VBOX_WITH_HGCM
int hgcmLoadService (const char *pszServiceLibrary, const char *pszServiceName);
int hgcmHostCall (const char *pszServiceName, uint32_t u32Function, uint32_t cParms, PVBOXHGCMSVCPARM paParms);
#ifdef VBOX_WITH_CRHGSMI
@@ -58,6 +65,7 @@ public:
void hgcmShutdown (void);
bool hgcmIsActive (void) { return ASMAtomicReadBool(&m_fHGCMActive); }
+#endif /* VBOX_WITH_HGCM */
private:
static DECLCALLBACK(void *) drvQueryInterface(PPDMIBASE pInterface, const char *pszIID);
diff --git a/src/VBox/Main/include/VRDEServerImpl.h b/src/VBox/Main/include/VRDEServerImpl.h
index 84ceaa52..dbef40e2 100644
--- a/src/VBox/Main/include/VRDEServerImpl.h
+++ b/src/VBox/Main/include/VRDEServerImpl.h
@@ -6,7 +6,7 @@
*/
/*
- * Copyright (C) 2006-2010 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -53,7 +53,7 @@ public:
VBOX_DEFAULT_INTERFACE_ENTRIES(IVRDEServer)
END_COM_MAP()
- DECLARE_EMPTY_CTOR_DTOR (VRDEServer)
+ DECLARE_EMPTY_CTOR_DTOR(VRDEServer)
HRESULT FinalConstruct();
void FinalRelease();
@@ -61,29 +61,29 @@ public:
// public initializer/uninitializer for internal purposes only
HRESULT init(Machine *aParent);
HRESULT init(Machine *aParent, VRDEServer *aThat);
- HRESULT initCopy (Machine *aParent, VRDEServer *aThat);
+ HRESULT initCopy(Machine *aParent, VRDEServer *aThat);
void uninit();
// IVRDEServer properties
- STDMETHOD(COMGETTER(Enabled)) (BOOL *aEnabled);
- STDMETHOD(COMSETTER(Enabled)) (BOOL aEnable);
- STDMETHOD(COMGETTER(AuthType)) (AuthType_T *aType);
- STDMETHOD(COMSETTER(AuthType)) (AuthType_T aType);
- STDMETHOD(COMGETTER(AuthTimeout)) (ULONG *aTimeout);
- STDMETHOD(COMSETTER(AuthTimeout)) (ULONG aTimeout);
- STDMETHOD(COMGETTER(AllowMultiConnection)) (BOOL *aAllowMultiConnection);
- STDMETHOD(COMSETTER(AllowMultiConnection)) (BOOL aAllowMultiConnection);
- STDMETHOD(COMGETTER(ReuseSingleConnection)) (BOOL *aReuseSingleConnection);
- STDMETHOD(COMSETTER(ReuseSingleConnection)) (BOOL aReuseSingleConnection);
+ STDMETHOD(COMGETTER(Enabled))(BOOL *aEnabled);
+ STDMETHOD(COMSETTER(Enabled))(BOOL aEnable);
+ STDMETHOD(COMGETTER(AuthType))(AuthType_T *aType);
+ STDMETHOD(COMSETTER(AuthType))(AuthType_T aType);
+ STDMETHOD(COMGETTER(AuthTimeout))(ULONG *aTimeout);
+ STDMETHOD(COMSETTER(AuthTimeout))(ULONG aTimeout);
+ STDMETHOD(COMGETTER(AllowMultiConnection))(BOOL *aAllowMultiConnection);
+ STDMETHOD(COMSETTER(AllowMultiConnection))(BOOL aAllowMultiConnection);
+ STDMETHOD(COMGETTER(ReuseSingleConnection))(BOOL *aReuseSingleConnection);
+ STDMETHOD(COMSETTER(ReuseSingleConnection))(BOOL aReuseSingleConnection);
STDMETHOD(COMGETTER(VRDEExtPack))(BSTR *aExtPack);
STDMETHOD(COMSETTER(VRDEExtPack))(IN_BSTR aExtPack);
- STDMETHOD(COMGETTER(AuthLibrary)) (BSTR *aValue);
- STDMETHOD(COMSETTER(AuthLibrary)) (IN_BSTR aValue);
- STDMETHOD(COMGETTER(VRDEProperties)) (ComSafeArrayOut (BSTR, aProperties));
+ STDMETHOD(COMGETTER(AuthLibrary))(BSTR *aValue);
+ STDMETHOD(COMSETTER(AuthLibrary))(IN_BSTR aValue);
+ STDMETHOD(COMGETTER(VRDEProperties))(ComSafeArrayOut(BSTR, aProperties));
// IVRDEServer methods
- STDMETHOD(SetVRDEProperty) (IN_BSTR aKey, IN_BSTR aValue);
- STDMETHOD(GetVRDEProperty) (IN_BSTR aKey, BSTR *aValue);
+ STDMETHOD(SetVRDEProperty)(IN_BSTR aKey, IN_BSTR aValue);
+ STDMETHOD(GetVRDEProperty)(IN_BSTR aKey, BSTR *aValue);
// public methods only for internal purposes
@@ -92,7 +92,7 @@ public:
void rollback();
void commit();
- void copyFrom (VRDEServer *aThat);
+ void copyFrom(VRDEServer *aThat);
private:
diff --git a/src/VBox/Main/include/VirtualBoxBase.h b/src/VBox/Main/include/VirtualBoxBase.h
index bde071c0..6e7ea715 100644
--- a/src/VBox/Main/include/VirtualBoxBase.h
+++ b/src/VBox/Main/include/VirtualBoxBase.h
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -212,6 +212,25 @@ public:
#endif
/**
+ * Special version of the AssertMsgFailed macro to be used within VirtualBoxBase
+ * subclasses.
+ *
+ * See ComAssert for more info.
+ *
+ * @param a printf argument list (in parenthesis).
+ */
+#if defined(DEBUG)
+#define ComAssertMsgFailed(a) AssertMsgFailed(a)
+#else
+#define ComAssertMsgFailed(a) \
+ do { \
+ setError(E_FAIL, \
+ "Assertion failed: at '%s' (%d) in %s.\n%s.\nPlease contact the product vendor!", \
+ __FILE__, __LINE__, __PRETTY_FUNCTION__, Utf8StrFmt a .c_str()); \
+ } while (0)
+#endif
+
+/**
* Special version of the AssertRC macro to be used within VirtualBoxBase
* subclasses.
*
@@ -270,9 +289,32 @@ public:
/** Special version of ComAssertComRC that returns rc if rc does not succeed */
#define ComAssertComRCRetRC(rc) \
do { ComAssertComRC(rc); if (!SUCCEEDED(rc)) return (rc); } while (0)
-/** Special version of ComAssert that returns ret */
-#define ComAssertFailedRet(ret) \
+/** Special version of ComAssertFailed that returns ret */
+#define ComAssertFailedRet(ret) \
do { ComAssertFailed(); return (ret); } while (0)
+/** Special version of ComAssertMsgFailed that returns ret */
+#define ComAssertMsgFailedRet(msg, ret) \
+ do { ComAssertMsgFailed(msg); return (ret); } while (0)
+
+
+/** Special version of ComAssert that returns void if expr fails */
+#define ComAssertRetVoid(expr) \
+ do { ComAssert(expr); if (!(expr)) return; } while (0)
+/** Special version of ComAssertMsg that returns void if expr fails */
+#define ComAssertMsgRetVoid(expr, a) \
+ do { ComAssertMsg(expr, a); if (!(expr)) return; } while (0)
+/** Special version of ComAssertRC that returns void if vrc does not succeed */
+#define ComAssertRCRetVoid(vrc) \
+ do { ComAssertRC(vrc); if (!RT_SUCCESS(vrc)) return; } while (0)
+/** Special version of ComAssertComRC that returns void if rc does not succeed */
+#define ComAssertComRCRetVoid(rc) \
+ do { ComAssertComRC(rc); if (!SUCCEEDED(rc)) return; } while (0)
+/** Special version of ComAssertFailed that returns void */
+#define ComAssertFailedRetVoid() \
+ do { ComAssertFailed(); return; } while (0)
+/** Special version of ComAssertMsgFailed that returns void */
+#define ComAssertMsgFailedRetVoid(msg) \
+ do { ComAssertMsgFailed(msg); return; } while (0)
/** Special version of ComAssert that evaluates eval and breaks if expr fails */
@@ -383,7 +425,7 @@ public:
do { \
Guid tmpGuid(a_Arg); \
(a_GuidVar) = tmpGuid; \
- if (RT_UNLIKELY((a_GuidVar).isEmpty())) \
+ if (RT_UNLIKELY((a_GuidVar).isValid() == false)) \
return setError(E_INVALIDARG, \
tr("GUID argument %s is not valid (\"%ls\")"), #a_Arg, Bstr(a_Arg).raw()); \
} while (0)
diff --git a/src/VBox/Main/include/VirtualBoxClientImpl.h b/src/VBox/Main/include/VirtualBoxClientImpl.h
index 8a4d973d..db17640a 100644
--- a/src/VBox/Main/include/VirtualBoxClientImpl.h
+++ b/src/VBox/Main/include/VirtualBoxClientImpl.h
@@ -5,7 +5,7 @@
*/
/*
- * Copyright (C) 2010 Oracle Corporation
+ * Copyright (C) 2010-2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -59,6 +59,7 @@ public:
STDMETHOD(COMGETTER(VirtualBox))(IVirtualBox **aVirtualBox);
STDMETHOD(COMGETTER(Session))(ISession **aSession);
STDMETHOD(COMGETTER(EventSource))(IEventSource **aEventSource);
+ STDMETHOD(CheckMachineError)(IMachine *aMachine);
private:
/** Instance counter for simulating something similar to a singleton.
diff --git a/src/VBox/Main/include/VirtualBoxErrorInfoImpl.h b/src/VBox/Main/include/VirtualBoxErrorInfoImpl.h
index bb47dc54..8f02cf9d 100644
--- a/src/VBox/Main/include/VirtualBoxErrorInfoImpl.h
+++ b/src/VBox/Main/include/VirtualBoxErrorInfoImpl.h
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 2006-2010 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -83,7 +83,8 @@ public:
#endif
VirtualBoxErrorInfo()
- : m_resultCode(S_OK)
+ : m_resultCode(S_OK),
+ m_resultDetail(0)
{}
// public initializer/uninitializer for internal purposes only
@@ -93,11 +94,19 @@ public:
const Utf8Str &strText,
IVirtualBoxErrorInfo *aNext = NULL);
+ HRESULT initEx(HRESULT aResultCode,
+ LONG aResultDetail,
+ const GUID &aIID,
+ const char *pcszComponent,
+ const Utf8Str &strText,
+ IVirtualBoxErrorInfo *aNext = NULL);
+
HRESULT init(const com::ErrorInfo &ei,
IVirtualBoxErrorInfo *aNext = NULL);
// IVirtualBoxErrorInfo properties
STDMETHOD(COMGETTER(ResultCode))(LONG *aResultCode);
+ STDMETHOD(COMGETTER(ResultDetail))(LONG *aResultDetail);
STDMETHOD(COMGETTER(InterfaceID))(BSTR *aIID);
STDMETHOD(COMGETTER(Component))(BSTR *aComponent);
STDMETHOD(COMGETTER(Text))(BSTR *aText);
@@ -113,6 +122,7 @@ private:
void * /* c */) { return rc; }
HRESULT m_resultCode;
+ LONG m_resultDetail;
Utf8Str m_strText;
Guid m_IID;
Utf8Str m_strComponent;
diff --git a/src/VBox/Main/include/VirtualBoxImpl.h b/src/VBox/Main/include/VirtualBoxImpl.h
index 3bf748a9..0ba8a3f1 100644
--- a/src/VBox/Main/include/VirtualBoxImpl.h
+++ b/src/VBox/Main/include/VirtualBoxImpl.h
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -19,6 +19,7 @@
#define ____H_VIRTUALBOXIMPL
#include "VirtualBoxBase.h"
+#include "objectslist.h"
#ifdef RT_OS_WINDOWS
# include "win/resource.h"
@@ -32,17 +33,17 @@ namespace com
class SessionMachine;
class GuestOSType;
-class SharedFolder;
class Progress;
class Host;
class SystemProperties;
class DHCPServer;
class PerformanceCollector;
-class VirtualBoxCallbackRegistration; /* see VirtualBoxImpl.cpp */
#ifdef VBOX_WITH_EXTPACK
class ExtPackManager;
#endif
class AutostartDb;
+class NATNetwork;
+
typedef std::list<ComObjPtr<SessionMachine> > SessionMachinesList;
@@ -50,8 +51,6 @@ typedef std::list<ComObjPtr<SessionMachine> > SessionMachinesList;
class SVCHlpClient;
#endif
-struct VMClientWatcherData;
-
namespace settings
{
class MainConfigFile;
@@ -68,6 +67,7 @@ class ATL_NO_VTABLE VirtualBox :
public:
typedef std::list<ComPtr<IInternalSessionControl> > InternalControlList;
+ typedef ObjectsList<Machine> MachinesOList;
class CallbackEvent;
friend class CallbackEvent;
@@ -120,6 +120,7 @@ public:
STDMETHOD(COMGETTER(SharedFolders))(ComSafeArrayOut(ISharedFolder *, aSharedFolders));
STDMETHOD(COMGETTER(PerformanceCollector))(IPerformanceCollector **aPerformanceCollector);
STDMETHOD(COMGETTER(DHCPServers))(ComSafeArrayOut(IDHCPServer *, aDHCPServers));
+ STDMETHOD(COMGETTER(NATNetworks))(ComSafeArrayOut(INATNetwork *, aNATNetworks));
STDMETHOD(COMGETTER(EventSource))(IEventSource ** aEventSource);
STDMETHOD(COMGETTER(ExtensionPackManager))(IExtPackManager **aExtPackManager);
STDMETHOD(COMGETTER(InternalNetworks))(ComSafeArrayOut(BSTR, aInternalNetworks));
@@ -160,6 +161,11 @@ public:
STDMETHOD(CreateDHCPServer)(IN_BSTR aName, IDHCPServer ** aServer);
STDMETHOD(FindDHCPServerByNetworkName)(IN_BSTR aName, IDHCPServer ** aServer);
STDMETHOD(RemoveDHCPServer)(IDHCPServer * aServer);
+
+ STDMETHOD(CreateNATNetwork)(IN_BSTR aName, INATNetwork ** aNATNetworks);
+ STDMETHOD(FindNATNetworkByName)(IN_BSTR aName, INATNetwork ** aNATNetworks);
+ STDMETHOD(RemoveNATNetwork)(INATNetwork * aNATNetwork);
+
STDMETHOD(CheckFirmwarePresent)(FirmwareType_T aFirmwareType, IN_BSTR aVersion,
BSTR * aUrl, BSTR * aFile, BOOL * aResult);
@@ -207,15 +213,28 @@ public:
void onSnapshotChange(const Guid &aMachineId, const Guid &aSnapshotId);
void onGuestPropertyChange(const Guid &aMachineId, IN_BSTR aName, IN_BSTR aValue,
IN_BSTR aFlags);
- void onMachineUninit(Machine *aMachine);
void onNatRedirectChange(const Guid &aMachineId, ULONG ulSlot, bool fRemove, IN_BSTR aName,
NATProtocol_T aProto, IN_BSTR aHostIp, uint16_t aHostPort,
IN_BSTR aGuestIp, uint16_t aGuestPort);
+ void onNATNetworkChange(IN_BSTR aNetworkName);
+ void onNATNetworkStartStop(IN_BSTR aNetworkName, BOOL aStart);
+ void onNATNetworkSetting(IN_BSTR aNetworkName, BOOL aEnabled, IN_BSTR aNetwork,
+ IN_BSTR aGateway, BOOL aAdvertiseDefaultIpv6RouteEnabled,
+ BOOL fNeedDhcpServer);
+ void onNATNetworkPortForward(IN_BSTR aNetworkName, BOOL create, BOOL fIpv6,
+ IN_BSTR aRuleName, NATProtocol_T proto,
+ IN_BSTR aHostIp, LONG aHostPort,
+ IN_BSTR aGuestIp, LONG aGuestPort);
+ void onHostNameResolutionConfigurationChange();
+
+ int natNetworkRefInc(IN_BSTR aNetworkName);
+ int natNetworkRefDec(IN_BSTR aNetworkName);
ComObjPtr<GuestOSType> getUnknownOSType();
void getOpenedMachines(SessionMachinesList &aMachines,
InternalControlList *aControls = NULL);
+ MachinesOList &getMachinesList();
HRESULT findMachine(const Guid &aId,
bool fPermitInaccessible,
@@ -295,13 +314,17 @@ public:
AutostartDb* getAutostartDb() const;
+ RWLockHandle& getMachinesListLockHandle();
RWLockHandle& getMediaTreeLockHandle();
int encryptSetting(const Utf8Str &aPlaintext, Utf8Str *aCiphertext);
int decryptSetting(Utf8Str *aPlaintext, const Utf8Str &aCiphertext);
void storeSettingsKey(const Utf8Str &aKey);
+ bool isMediaUuidInUse(const Guid &aId, DeviceType_T deviceType);
+
private:
+ class ClientWatcher;
static HRESULT setErrorStatic(HRESULT aResultCode,
const Utf8Str &aText)
@@ -309,17 +332,20 @@ private:
return setErrorInternal(aResultCode, getStaticClassIID(), getStaticComponentName(), aText, false, true);
}
- HRESULT checkMediaForConflicts(const Guid &aId,
- const Utf8Str &aLocation,
- Utf8Str &aConflictType,
- ComObjPtr<Medium> *pDupMedium);
-
HRESULT registerMachine(Machine *aMachine);
HRESULT registerDHCPServer(DHCPServer *aDHCPServer,
bool aSaveRegistry = true);
HRESULT unregisterDHCPServer(DHCPServer *aDHCPServer,
bool aSaveRegistry = true);
+ HRESULT registerNATNetwork(NATNetwork *aNATNetwork,
+ bool aSaveRegistry = true);
+ HRESULT unregisterNATNetwork(NATNetwork *aNATNetwork,
+ bool aSaveRegistry = true);
+ HRESULT checkMediaForConflicts(const Guid &aId,
+ const Utf8Str &aLocation,
+ Utf8Str &aConflictType,
+ ComObjPtr<Medium> *pDupMedium);
int decryptSettings();
int decryptMediumSettings(Medium *pMedium);
@@ -337,8 +363,9 @@ private:
static ULONG sRevision;
static Bstr sPackageType;
static Bstr sAPIVersion;
+ static std::map<Bstr, int> sNatNetworkNameToRefCount;
+ static RWLockHandle* spMtxNatNetworkNameToRefCountLock;
- static DECLCALLBACK(int) ClientWatcher(RTTHREAD thread, void *pvUser);
static DECLCALLBACK(int) AsyncEventHandler(RTTHREAD thread, void *pvUser);
#ifdef RT_OS_WINDOWS
diff --git a/src/VBox/Main/include/Wrapper.h b/src/VBox/Main/include/Wrapper.h
new file mode 100644
index 00000000..2381ea2b
--- /dev/null
+++ b/src/VBox/Main/include/Wrapper.h
@@ -0,0 +1,491 @@
+/* $Id: Wrapper.h $ */
+/** @file
+ * VirtualBox COM: API wrapper helpers
+ */
+
+/*
+ * Copyright (C) 2012-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef ____H_WRAPPER
+#define ____H_WRAPPER
+
+#include <vector>
+#include <VBox/com/ptr.h>
+#include <VBox/com/array.h>
+
+#include "AutoCaller.h"
+
+
+/**
+ * Checks that the given pointer to an output argument is valid and throws
+ * E_POINTER + extended error info otherwise.
+ * @param arg Pointer argument.
+ */
+#define CheckComArgOutPointerValidThrow(arg) \
+ do { \
+ if (RT_UNLIKELY(!VALID_PTR(arg))) \
+ throw setError(E_POINTER, \
+ tr("Output argument %s points to invalid memory location (%p)"), \
+ #arg, (void *)(arg)); \
+ } while (0)
+
+
+class BSTROutConverter
+{
+public:
+ BSTROutConverter() : mDst(NULL)
+ {
+ }
+
+ BSTROutConverter(BSTR *aDst) : mDst(aDst)
+ {
+ }
+
+ ~BSTROutConverter()
+ {
+ if (mDst)
+ Bstr(mStr).detachTo(mDst);
+ }
+
+ com::Utf8Str &str()
+ {
+ return mStr;
+ }
+
+private:
+ com::Utf8Str mStr;
+ BSTR *mDst;
+};
+
+class BSTRInConverter
+{
+public:
+ BSTRInConverter() : mSrc()
+ {
+ }
+
+ BSTRInConverter(CBSTR aSrc) : mSrc(aSrc)
+ {
+ }
+
+ ~BSTRInConverter()
+ {
+ }
+
+ const com::Utf8Str &str()
+ {
+ return mSrc;
+ }
+
+private:
+ const com::Utf8Str mSrc;
+};
+
+class ArrayBSTROutConverter
+{
+public:
+ ArrayBSTROutConverter() :
+#ifdef VBOX_WITH_XPCOM
+ mDstSize(NULL),
+ mDst(NULL)
+#else // !VBOX_WITH_XPCOM
+ mDst(NULL)
+#endif // !VBOX_WITH_XPCOM
+ {
+ }
+
+ ArrayBSTROutConverter(ComSafeArrayOut(BSTR, aDst)) :
+#ifdef VBOX_WITH_XPCOM
+ mDstSize(aDstSize),
+ mDst(aDst)
+#else // !VBOX_WITH_XPCOM
+ mDst(aDst)
+#endif // !VBOX_WITH_XPCOM
+ {
+ }
+
+ ~ArrayBSTROutConverter()
+ {
+ if (mDst)
+ {
+ com::SafeArray<BSTR> outArray(mArray.size());
+ for (size_t i = 0; i < mArray.size(); i++)
+ Bstr(mArray[i]).detachTo(&outArray[i]);
+ outArray.detachTo(ComSafeArrayOutArg(mDst));
+ }
+ }
+
+ std::vector<com::Utf8Str> &array()
+ {
+ return mArray;
+ }
+
+private:
+ std::vector<com::Utf8Str> mArray;
+#ifdef VBOX_WITH_XPCOM
+ PRUint32 *mDstSize;
+ BSTR **mDst;
+#else // !VBOX_WITH_XPCOM
+ SAFEARRAY **mDst;
+#endif // !VBOX_WITH_XPCOM
+};
+
+class ArrayBSTRInConverter
+{
+public:
+ ArrayBSTRInConverter()
+ {
+ }
+
+ ArrayBSTRInConverter(ComSafeArrayIn(IN_BSTR, aSrc))
+ {
+ if (!ComSafeArrayInIsNull(aSrc))
+ {
+ com::SafeArray<IN_BSTR> inArray(ComSafeArrayInArg(aSrc));
+ mArray.resize(inArray.size());
+ for (size_t i = 0; i < inArray.size(); i++)
+ mArray[i] = inArray[i];
+ }
+ }
+
+ ~ArrayBSTRInConverter()
+ {
+ }
+
+ const std::vector<com::Utf8Str> &array()
+ {
+ return mArray;
+ }
+
+private:
+ std::vector<com::Utf8Str> mArray;
+};
+
+class UuidOutConverter
+{
+public:
+ UuidOutConverter() : mDst(NULL)
+ {
+ }
+
+ UuidOutConverter(BSTR *aDst) : mDst(aDst)
+ {
+ }
+
+ ~UuidOutConverter()
+ {
+ if (mDst)
+ mUuid.toUtf16().detachTo(mDst);
+ }
+
+ com::Guid &uuid()
+ {
+ return mUuid;
+ }
+
+private:
+ com::Guid mUuid;
+ BSTR *mDst;
+};
+
+class UuidInConverter
+{
+public:
+ UuidInConverter() : mSrc()
+ {
+ }
+
+ UuidInConverter(CBSTR aSrc) : mSrc(aSrc)
+ {
+ }
+
+ ~UuidInConverter()
+ {
+ }
+
+ const com::Guid &uuid()
+ {
+ return mSrc;
+ }
+
+private:
+ const com::Guid mSrc;
+};
+
+class ArrayUuidOutConverter
+{
+public:
+ ArrayUuidOutConverter() :
+#ifdef VBOX_WITH_XPCOM
+ mDstSize(NULL),
+ mDst(NULL)
+#else // !VBOX_WITH_XPCOM
+ mDst(NULL)
+#endif // !VBOX_WITH_XPCOM
+ {
+ }
+
+ ArrayUuidOutConverter(ComSafeArrayOut(BSTR, aDst)) :
+#ifdef VBOX_WITH_XPCOM
+ mDstSize(aDstSize),
+ mDst(aDst)
+#else // !VBOX_WITH_XPCOM
+ mDst(aDst)
+#endif // !VBOX_WITH_XPCOM
+ {
+ }
+
+ ~ArrayUuidOutConverter()
+ {
+ if (mDst)
+ {
+ com::SafeArray<BSTR> outArray(mArray.size());
+ for (size_t i = 0; i < mArray.size(); i++)
+ mArray[i].toUtf16().detachTo(&outArray[i]);
+ outArray.detachTo(ComSafeArrayOutArg(mDst));
+ }
+ }
+
+ std::vector<com::Guid> &array()
+ {
+ return mArray;
+ }
+
+private:
+ std::vector<com::Guid> mArray;
+#ifdef VBOX_WITH_XPCOM
+ PRUint32 *mDstSize;
+ BSTR **mDst;
+#else // !VBOX_WITH_XPCOM
+ SAFEARRAY **mDst;
+#endif // !VBOX_WITH_XPCOM
+};
+
+template <class A>
+class ComTypeOutConverter
+{
+public:
+ ComTypeOutConverter() : mDst(NULL)
+ {
+ }
+
+ ComTypeOutConverter(A **aDst) : mDst(aDst)
+ {
+ }
+
+ ~ComTypeOutConverter()
+ {
+ if (mDst)
+ mPtr.queryInterfaceTo(mDst);
+ }
+
+ ComPtr<A> &ptr()
+ {
+ return mPtr;
+ }
+
+private:
+ ComPtr<A> mPtr;
+ A **mDst;
+};
+
+template <class A>
+class ComTypeInConverter
+{
+public:
+ ComTypeInConverter() : mSrc(NULL)
+ {
+ }
+
+ ComTypeInConverter(A *aSrc) : mSrc(aSrc)
+ {
+ }
+
+ ~ComTypeInConverter()
+ {
+ }
+
+ const ComPtr<A> &ptr()
+ {
+ return mSrc;
+ }
+
+private:
+ const ComPtr<A> mSrc;
+};
+
+template <class A>
+class ArrayComTypeOutConverter
+{
+public:
+ ArrayComTypeOutConverter() :
+#ifdef VBOX_WITH_XPCOM
+ mDstSize(NULL),
+ mDst(NULL)
+#else // !VBOX_WITH_XPCOM
+ mDst(NULL)
+#endif // !VBOX_WITH_XPCOM
+ {
+ }
+
+ ArrayComTypeOutConverter(ComSafeArrayOut(A *, aDst)) :
+#ifdef VBOX_WITH_XPCOM
+ mDstSize(aDstSize),
+ mDst(aDst)
+#else // !VBOX_WITH_XPCOM
+ mDst(aDst)
+#endif // !VBOX_WITH_XPCOM
+ {
+ }
+
+ ~ArrayComTypeOutConverter()
+ {
+ if (mDst)
+ {
+ com::SafeIfaceArray<A> outArray(mArray.size());
+ for (size_t i = 0; i < mArray.size(); i++)
+ outArray[i] = mArray[i];
+ outArray.detachTo(ComSafeArrayOutArg(mDst));
+ }
+ }
+
+ std::vector<ComPtr<A> > &array()
+ {
+ return mArray;
+ }
+
+private:
+ std::vector<ComPtr<A> > mArray;
+#ifdef VBOX_WITH_XPCOM
+ PRUint32 *mDstSize;
+ A ***mDst;
+#else // !VBOX_WITH_XPCOM
+ SAFEARRAY **mDst;
+#endif // !VBOX_WITH_XPCOM
+};
+
+template <class A>
+class ArrayComTypeInConverter
+{
+public:
+ ArrayComTypeInConverter()
+ {
+ }
+
+ ArrayComTypeInConverter(ComSafeArrayIn(A *, aSrc))
+ {
+ if (!ComSafeArrayInIsNull(aSrc))
+ {
+ com::SafeIfaceArray<A> inArray(ComSafeArrayInArg(aSrc));
+ mArray.resize(inArray.size());
+ for (size_t i = 0; i < inArray.size(); i++)
+ mArray[i] = inArray[i];
+ }
+ }
+
+ ~ArrayComTypeInConverter()
+ {
+ }
+
+ const std::vector<ComPtr<A> > &array()
+ {
+ return mArray;
+ }
+
+private:
+ std::vector<ComPtr<A> > mArray;
+};
+
+template <typename A>
+class ArrayOutConverter
+{
+public:
+ ArrayOutConverter() :
+#ifdef VBOX_WITH_XPCOM
+ mDstSize(NULL),
+ mDst(NULL)
+#else // !VBOX_WITH_XPCOM
+ mDst(NULL)
+#endif // !VBOX_WITH_XPCOM
+ {
+ }
+
+ ArrayOutConverter(ComSafeArrayOut(A, aDst)) :
+#ifdef VBOX_WITH_XPCOM
+ mDstSize(aDstSize),
+ mDst(aDst)
+#else // !VBOX_WITH_XPCOM
+ mDst(aDst)
+#endif // !VBOX_WITH_XPCOM
+ {
+ }
+
+ ~ArrayOutConverter()
+ {
+ if (mDst)
+ {
+ com::SafeArray<A> outArray(mArray.size());
+ for (size_t i = 0; i < mArray.size(); i++)
+ outArray[i] = mArray[i];
+ outArray.detachTo(ComSafeArrayOutArg(mDst));
+ }
+ }
+
+ std::vector<A> &array()
+ {
+ return mArray;
+ }
+
+private:
+ std::vector<A> mArray;
+#ifdef VBOX_WITH_XPCOM
+ PRUint32 *mDstSize;
+ A **mDst;
+#else // !VBOX_WITH_XPCOM
+ SAFEARRAY **mDst;
+#endif // !VBOX_WITH_XPCOM
+};
+
+template <typename A>
+class ArrayInConverter
+{
+public:
+ ArrayInConverter()
+ {
+ }
+
+ ArrayInConverter(ComSafeArrayIn(A, aSrc))
+ {
+ if (!ComSafeArrayInIsNull(aSrc))
+ {
+ com::SafeArray<A> inArray(ComSafeArrayInArg(aSrc));
+ mArray.resize(inArray.size());
+ for (size_t i = 0; i < inArray.size(); i++)
+ mArray[i] = inArray[i];
+ }
+ }
+
+ ~ArrayInConverter()
+ {
+ }
+
+ const std::vector<A> &array()
+ {
+ return mArray;
+ }
+
+private:
+ std::vector<A> mArray;
+};
+
+#endif // !____H_WRAPPER
+/* vi: set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/src/VBox/Main/include/netif.h b/src/VBox/Main/include/netif.h
index b1ab8901..bd618922 100644
--- a/src/VBox/Main/include/netif.h
+++ b/src/VBox/Main/include/netif.h
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 2008-2009 Oracle Corporation
+ * Copyright (C) 2008-2012 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -84,14 +84,16 @@ typedef NETIFINFO const *PCNETIFINFO;
#endif
int NetIfList(std::list <ComObjPtr<HostNetworkInterface> > &list);
-int NetIfEnableStaticIpConfig(VirtualBox *pVbox, HostNetworkInterface * pIf, ULONG aOldIp, ULONG aNewIp, ULONG aMask);
-int NetIfEnableStaticIpConfigV6(VirtualBox *pVbox, HostNetworkInterface * pIf, IN_BSTR aOldIPV6Address, IN_BSTR aIPV6Address, ULONG aIPV6MaskPrefixLength);
-int NetIfEnableDynamicIpConfig(VirtualBox *pVbox, HostNetworkInterface * pIf);
-int NetIfCreateHostOnlyNetworkInterface (VirtualBox *pVbox, IHostNetworkInterface **aHostNetworkInterface, IProgress **aProgress, const char *pcszName = NULL);
-int NetIfRemoveHostOnlyNetworkInterface (VirtualBox *pVbox, IN_GUID aId, IProgress **aProgress);
+int NetIfEnableStaticIpConfig(VirtualBox *pVBox, HostNetworkInterface * pIf, ULONG aOldIp, ULONG aNewIp, ULONG aMask);
+int NetIfEnableStaticIpConfigV6(VirtualBox *pVBox, HostNetworkInterface * pIf, IN_BSTR aOldIPV6Address, IN_BSTR aIPV6Address, ULONG aIPV6MaskPrefixLength);
+int NetIfEnableDynamicIpConfig(VirtualBox *pVBox, HostNetworkInterface * pIf);
+int NetIfCreateHostOnlyNetworkInterface (VirtualBox *pVBox, IHostNetworkInterface **aHostNetworkInterface, IProgress **aProgress, const char *pcszName = NULL);
+int NetIfRemoveHostOnlyNetworkInterface (VirtualBox *pVBox, IN_GUID aId, IProgress **aProgress);
int NetIfGetConfig(HostNetworkInterface * pIf, NETIFINFO *);
int NetIfGetConfigByName(PNETIFINFO pInfo);
-int NetIfDhcpRediscover(VirtualBox *pVbox, HostNetworkInterface * pIf);
+int NetIfGetState(const char *pcszIfName, NETIFSTATUS *penmState);
+int NetIfGetLinkSpeed(const char *pcszIfName, uint32_t *puMbits);
+int NetIfDhcpRediscover(VirtualBox *pVBox, HostNetworkInterface * pIf);
int NetIfAdpCtlOut(const char * pcszName, const char * pcszCmd, char *pszBuffer, size_t cBufSize);
DECLINLINE(Bstr) composeIPv6Address(PRTNETADDRIPV6 aAddrPtr)
@@ -121,12 +123,12 @@ DECLINLINE(ULONG) composeIPv6PrefixLenghFromAddress(PRTNETADDRIPV6 aAddrPtr)
DECLINLINE(int) prefixLength2IPv6Address(ULONG cPrefix, PRTNETADDRIPV6 aAddrPtr)
{
- if(cPrefix > 128)
+ if (cPrefix > 128)
return VERR_INVALID_PARAMETER;
- if(!aAddrPtr)
+ if (!aAddrPtr)
return VERR_INVALID_PARAMETER;
- memset(aAddrPtr, 0, sizeof(RTNETADDRIPV6));
+ RT_ZERO(*aAddrPtr);
ASMBitSetRange(aAddrPtr, 0, cPrefix);
@@ -150,7 +152,8 @@ DECLINLINE(Bstr) getDefaultIPv4Address(Bstr bstrIfName)
/* Get the index from the name */
Utf8Str strTmp = bstrIfName;
const char *pszIfName = strTmp.c_str();
- int iInstance = 0, iPos = strcspn(pszIfName, "0123456789");
+ int iInstance = 0;
+ size_t iPos = strcspn(pszIfName, "0123456789");
if (pszIfName[iPos])
iInstance = RTStrToUInt32(pszIfName + iPos);
diff --git a/src/VBox/Main/include/objectslist.h b/src/VBox/Main/include/objectslist.h
index a506a161..7b9ca04d 100644
--- a/src/VBox/Main/include/objectslist.h
+++ b/src/VBox/Main/include/objectslist.h
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2009 Oracle Corporation
+ * Copyright (C) 2009-2010 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Main/include/ovfreader.h b/src/VBox/Main/include/ovfreader.h
index e1e21d5c..80769308 100644
--- a/src/VBox/Main/include/ovfreader.h
+++ b/src/VBox/Main/include/ovfreader.h
@@ -6,7 +6,7 @@
*/
/*
- * Copyright (C) 2008-2010 Oracle Corporation
+ * Copyright (C) 2008-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -28,10 +28,39 @@ namespace ovf
////////////////////////////////////////////////////////////////////////////////
//
+// Errors
+//
+////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Thrown by OVFReader for any kind of error that is not an XML error but
+ * still makes the OVF impossible to parse. Based on xml::LogicError so
+ * that one catch() for all xml::LogicError can handle all possible errors.
+ */
+class OVFLogicError : public xml::LogicError
+{
+public:
+ OVFLogicError(const char *aFormat, ...);
+};
+
+
+////////////////////////////////////////////////////////////////////////////////
+//
// Enumerations
//
////////////////////////////////////////////////////////////////////////////////
+/**
+ * CIM OS values.
+ *
+ * The OVF 1.10 spec refers to some CIM_OperatingSystem.mof doc. Could this be it:
+ * http://cvs.opengroup.org/cgi-bin/cvsweb.cgi/pegasus/Schemas/CIM231/DMTF/System/CIM_OperatingSystem.mof
+ *
+ * @todo r=bird: Why are the values are repeating 'CIMOS'. CIMOSType_T is also
+ * repeating it self, 'Type' and '_T'. Why not call it kCIOMOpSys,
+ * easier to read as well.
+ * Then also apply: s/CIMOSType_CIMOS_/kCIMOpSys_/g
+ */
enum CIMOSType_T
{
CIMOSType_CIMOS_Unknown = 0,
@@ -149,6 +178,62 @@ enum CIMOSType_T
// no new types added with CIM 2.26.0
};
+enum OVFVersion_T
+{
+ OVFVersion_unknown,
+ OVFVersion_0_9,
+ OVFVersion_1_0,
+ OVFVersion_2_0
+};
+
+const char* const OVF09_URI_string = "http://www.vmware.com/schema/ovf/1/envelope";
+const char* const OVF10_URI_string = "http://schemas.dmtf.org/ovf/envelope/1";
+const char* const OVF20_URI_string = "http://schemas.dmtf.org/ovf/envelope/2";
+
+const char* const DTMF_SPECS_URI = "http://schemas.dmtf.org/wbem/cim-html/2/";
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// Envelope data
+//
+////////////////////////////////////////////////////////////////////////////////
+struct EnvelopeData
+{
+ OVFVersion_T version;//OVF standard version, it is used internally only by VirtualBox
+ RTCString lang;//language
+
+ OVFVersion_T getOVFVersion() const
+ {
+ return version;
+ }
+
+
+ RTCString getStringOVFVersion() const
+ {
+ if (version == OVFVersion_0_9)
+ return "0.9";
+ else if (version == OVFVersion_1_0)
+ return "1.0";
+ else if (version == OVFVersion_2_0)
+ return "2.0";
+ else
+ return "";
+ }
+
+ void setOVFVersion(OVFVersion_T v)
+ {
+ version = v;
+ }
+};
+
+
+struct FileReference
+{
+ RTCString strHref; // value from /References/File/@href (filename)
+ RTCString strDiskId; // value from /References/File/@id ()
+};
+
+typedef std::map<uint32_t, FileReference> FileReferenceMap;
////////////////////////////////////////////////////////////////////////////////
//
@@ -167,7 +252,7 @@ struct DiskImage
// space, but cannot be larger than iCapacity; -1 if not set)
RTCString strFormat; // value from DiskSection/Disk/@format
// typically http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized
- RTCString uuidVbox; // optional; if the file was exported by VirtualBox >= 3.2,
+ RTCString uuidVBox; // optional; if the file was exported by VirtualBox >= 3.2,
// then this has the UUID with which the disk was registered
// fields from /References/File; the spec says the file reference from disk can be empty,
@@ -204,8 +289,24 @@ enum ResourceType_T
ResourceType_SoundCard = 35
};
-struct VirtualHardwareItem
+
+enum StorageAccessType_T
+{ StorageAccessType_Unknown = 0,
+ StorageAccessType_Readable = 1,
+ StorageAccessType_Writeable = 2,
+ StorageAccessType_ReadWrite = 3
+};
+
+enum ComplianceType_T
+{ ComplianceType_No = 0,
+ ComplianceType_Soft = 1,
+ ComplianceType_Medium = 2,
+ ComplianceType_Strong = 3
+};
+
+class VirtualHardwareItem
{
+public:
RTCString strDescription;
RTCString strCaption;
RTCString strElementName;
@@ -253,7 +354,133 @@ struct VirtualHardwareItem
ullWeight(0),
ulBusNumber(0),
ulLineNumber(0)
- {};
+ {
+ itemName = "Item";
+ };
+
+ void fillItem(const xml::ElementNode *item);
+
+ void setDefaultFlag()
+ {
+ fDefault = true;
+ }
+
+ bool isThereDefaultValues() const
+ {
+ return fDefault;
+ }
+
+ void checkConsistencyAndCompliance() RT_THROW(OVFLogicError)
+ {
+ _checkConsistencyAndCompliance();
+ }
+
+protected:
+ virtual void _checkConsistencyAndCompliance() RT_THROW(OVFLogicError);
+ virtual const RTCString& getItemName()
+ {
+ return _getItemName();
+ }
+
+private:
+ RTCString itemName;
+ bool fDefault;//true means that some fields were absent in the XML and some default values were assigned to.
+
+ virtual const RTCString& _getItemName()
+ {
+ return itemName;
+ }
+};
+
+class StorageItem: public VirtualHardwareItem
+{
+ //see DMTF Schema Documentation http://schemas.dmtf.org/wbem/cim-html/2/
+ StorageAccessType_T accessType;
+ RTCString strHostExtentName;
+ int16_t hostExtentNameFormat;
+ int16_t hostExtentNameNamespace;
+ int64_t hostExtentStartingAddress;
+ int64_t hostResourceBlockSize;
+ int64_t limit;
+ RTCString strOtherHostExtentNameFormat;
+ RTCString strOtherHostExtentNameNamespace;
+ int64_t reservation;
+ int64_t virtualQuantity;
+ RTCString strVirtualQuantityUnits;
+ int64_t virtualResourceBlockSize;
+
+public:
+ StorageItem(): VirtualHardwareItem(),
+ accessType(StorageAccessType_Unknown),
+ hostExtentNameFormat(-1),
+ hostExtentNameNamespace(-1),
+ hostExtentStartingAddress(-1),
+ hostResourceBlockSize(-1),
+ limit(-1),
+ reservation(-1),
+ virtualQuantity(-1),
+ virtualResourceBlockSize(-1)
+ {
+ itemName = "StorageItem";
+ };
+
+ void fillItem(const xml::ElementNode *item);
+
+protected:
+ virtual void _checkConsistencyAndCompliance() RT_THROW(OVFLogicError);
+private:
+ RTCString itemName;
+
+ virtual const RTCString& _getItemName()
+ {
+ return itemName;
+ }
+};
+
+
+class EthernetPortItem: public VirtualHardwareItem
+{
+ //see DMTF Schema Documentation http://schemas.dmtf.org/wbem/cim-html/2/
+ uint16_t DefaultPortVID;
+ uint16_t DefaultPriority;
+ uint16_t DesiredVLANEndpointMode;
+ uint32_t GroupID;
+ uint32_t ManagerID;
+ RTCString strNetworkPortProfileID;
+ uint16_t NetworkPortProfileIDType;
+ RTCString strOtherEndpointMode;
+ RTCString strOtherNetworkPortProfileIDTypeInfo;
+ RTCString strPortCorrelationID;
+ uint16_t PortVID;
+ bool Promiscuous;
+ uint64_t ReceiveBandwidthLimit;
+ uint16_t ReceiveBandwidthReservation;
+ bool SourceMACFilteringEnabled;
+ uint32_t VSITypeID;
+ uint8_t VSITypeIDVersion;
+ uint16_t AllowedPriorities[256];
+ RTCString strAllowedToReceiveMACAddresses;
+ uint16_t AllowedToReceiveVLANs[256];
+ RTCString strAllowedToTransmitMACAddresses;
+ uint16_t AllowedToTransmitVLANs[256];
+
+public:
+ EthernetPortItem(): VirtualHardwareItem()
+ {
+ itemName = "EthernetPortItem";
+ };
+
+ void fillItem(const xml::ElementNode *item);
+
+protected:
+ virtual void _checkConsistencyAndCompliance() RT_THROW(OVFLogicError);
+private:
+ RTCString itemName;
+
+ virtual const RTCString& _getItemName()
+ {
+ return itemName;
+ }
};
typedef std::map<RTCString, DiskImage> DiskImagesMap;
@@ -290,14 +517,15 @@ typedef std::map<uint32_t, HardDiskController> ControllersMap;
struct VirtualDisk
{
- uint32_t idController; // SCSI (or IDE) controller this disk is connected to;
- // this must match HardDiskController.idController and
- // points into VirtualSystem.mapControllers
- uint32_t ulAddressOnParent; // parsed strAddressOnParent of hardware item; will be 0 or 1 for IDE
- // and possibly higher for disks attached to SCSI controllers (untested)
- RTCString strDiskId; // if the hard disk has an ovf:/disk/<id> reference,
- // this receives the <id> component; points to one of the
- // references in Appliance::Data.mapDisks
+ uint32_t idController;// SCSI (or IDE) controller this disk is connected to;
+ // this must match HardDiskController.idController and
+ // points into VirtualSystem.mapControllers
+ uint32_t ulAddressOnParent;// parsed strAddressOnParent of hardware item; will be 0 or 1 for IDE
+ // and possibly higher for disks attached to SCSI controllers (untested)
+ RTCString strDiskId;// if the hard disk has an ovf:/disk/<id> reference,
+ // this receives the <id> component; points to one of the
+ // references in Appliance::Data.mapDisks
+ bool fEmpty;//true - empty disk, e.g. the component <rasd:HostResource>...</rasd:HostResource> is absent.
};
typedef std::map<RTCString, VirtualDisk> VirtualDisksMap;
@@ -326,7 +554,7 @@ struct VirtualSystem
CIMOSType_T cimos;
RTCString strCimosDesc; // readable description of the cimos type in the case of cimos = 0/1/102
- RTCString strTypeVbox; // optional type from @vbox:ostype attribute (VirtualBox 4.0 or higher)
+ RTCString strTypeVBox; // optional type from @vbox:ostype attribute (VirtualBox 4.0 or higher)
RTCString strVirtualSystemType; // generic hardware description; OVF says this can be something like "vmx-4" or "xen";
// VMware Workstation 6.5 is "vmx-07"
@@ -360,8 +588,7 @@ struct VirtualSystem
RTCString strProductUrl; // product info if any; receives contents of VirtualSystem/ProductSection/ProductUrl
RTCString strVendorUrl; // product info if any; receives contents of VirtualSystem/ProductSection/VendorUrl
- const xml::ElementNode // pointer to <vbox:Machine> element under <VirtualSystem> element or NULL if not present
- *pelmVboxMachine;
+ const xml::ElementNode *pelmVBoxMachine; // pointer to <vbox:Machine> element under <VirtualSystem> element or NULL if not present
VirtualSystem()
: cimos(CIMOSType_CIMOS_Unknown),
@@ -370,7 +597,7 @@ struct VirtualSystem
fHasFloppyDrive(false),
fHasCdromDrive(false),
fHasUsbController(false),
- pelmVboxMachine(NULL)
+ pelmVBoxMachine(NULL)
{
}
};
@@ -403,7 +630,6 @@ struct VirtualSystem
delete pReader;
</code>
*/
-
class OVFReader
{
public:
@@ -411,7 +637,8 @@ public:
OVFReader(const RTCString &path);
// Data fields
- RTCString m_strPath; // file name given to constructor
+ EnvelopeData m_envelopeData; //data of root element "Envelope"
+ RTCString m_strPath; // file name given to constructor
DiskImagesMap m_mapDisks; // map of DiskImage structs, sorted by DiskImage.strDiskId
std::list<VirtualSystem> m_llVirtualSystems; // list of virtual systems, created by and valid after read()
@@ -425,24 +652,7 @@ private:
void HandleVirtualSystemContent(const xml::ElementNode *pContentElem);
};
-////////////////////////////////////////////////////////////////////////////////
-//
-// Errors
-//
-////////////////////////////////////////////////////////////////////////////////
-
-/**
- * Thrown by OVFReader for any kind of error that is not an XML error but
- * still makes the OVF impossible to parse. Based on xml::LogicError so
- * that one catch() for all xml::LogicError can handle all possible errors.
- */
-
-class OVFLogicError : public xml::LogicError
-{
-public:
- OVFLogicError(const char *aFormat, ...);
-};
-
} // end namespace ovf
-#endif // ____H_OVFREADER
+#endif // !____H_OVFREADER
+
diff --git a/src/VBox/Main/include/vbox-libhal.h b/src/VBox/Main/include/vbox-libhal.h
index 5f67a4d2..5697b20f 100644
--- a/src/VBox/Main/include/vbox-libhal.h
+++ b/src/VBox/Main/include/vbox-libhal.h
@@ -5,7 +5,7 @@
*/
/*
- * Copyright (C) 2006-2007 Oracle Corporation
+ * Copyright (C) 2006-2010 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Main/include/win/resource.h b/src/VBox/Main/include/win/resource.h
index 173a49b8..160e4734 100644
--- a/src/VBox/Main/include/win/resource.h
+++ b/src/VBox/Main/include/win/resource.h
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2006-2007 Oracle Corporation
+ * Copyright (C) 2006-2010 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;