VirtualBox

Changeset 49742 in vbox


Ignore:
Timestamp:
Dec 2, 2013 5:59:21 PM (11 years ago)
Author:
vboxsync
Message:

6813 stage 2 - Use the server side API wrapper code..

Location:
trunk/src/VBox/Main
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/ApplianceImpl.h

    r49620 r49742  
    2222
    2323/* VBox includes */
    24 #include "VirtualBoxBase.h"
     24#include "VirtualSystemDescriptionWrap.h"
     25#include "ApplianceWrap.h"
    2526#include "MediumFormatImpl.h"
    2627
     
    2829 * private classes. */
    2930#include <iprt/tar.h>
    30 #include <iprt/circbuf.h>
    31 #include <VBox/vd.h>
    32 #include <iprt/sha.h>
    33 
    3431#include "ovfreader.h"
    3532#include <set>
     
    5047    struct HardDiskController;
    5148    struct VirtualSystem;
    52     class OVFReader;
     49    class  OVFReader;
    5350    struct DiskImage;
    5451    struct EnvelopeData;
     
    6764
    6865class ATL_NO_VTABLE Appliance :
    69     public VirtualBoxBase,
    70     VBOX_SCRIPTABLE_IMPL(IAppliance)
     66    public ApplianceWrap
    7167{
    7268public:
    73     VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(Appliance, IAppliance)
    74 
    75     DECLARE_NOT_AGGREGATABLE(Appliance)
    76 
    77     DECLARE_PROTECT_FINAL_CONSTRUCT()
    78 
    79     BEGIN_COM_MAP(Appliance)
    80         VBOX_DEFAULT_INTERFACE_ENTRIES(IAppliance)
    81     END_COM_MAP()
    82 
    83     DECLARE_EMPTY_CTOR_DTOR (Appliance)
    84 
    85 
    86 
    87     // public initializer/uninitializer for internal purposes only
    88     HRESULT FinalConstruct() { return BaseFinalConstruct(); }
    89     void FinalRelease() { uninit(); BaseFinalRelease(); }
     69
     70    DECLARE_EMPTY_CTOR_DTOR(Appliance)
     71
     72    HRESULT FinalConstruct();
     73    void FinalRelease();
     74
    9075
    9176    HRESULT init(VirtualBox *aVirtualBox);
    9277    void uninit();
    9378
    94     /* IAppliance properties */
    95     STDMETHOD(COMGETTER(Path))(BSTR *aPath);
    96     STDMETHOD(COMGETTER(Disks))(ComSafeArrayOut(BSTR, aDisks));
    97     STDMETHOD(COMGETTER(VirtualSystemDescriptions))(ComSafeArrayOut(IVirtualSystemDescription*, aVirtualSystemDescriptions));
    98     STDMETHOD(COMGETTER(Machines))(ComSafeArrayOut(BSTR, aMachines));
    99 
    100     /* IAppliance methods */
    101     /* Import methods */
    102     STDMETHOD(Read)(IN_BSTR path, IProgress **aProgress);
    103     STDMETHOD(Interpret)(void);
    104     STDMETHOD(ImportMachines)(ComSafeArrayIn(ImportOptions_T, options), IProgress **aProgress);
    105     /* Export methods */
    106     STDMETHOD(CreateVFSExplorer)(IN_BSTR aURI, IVFSExplorer **aExplorer);
    107     STDMETHOD(Write)(IN_BSTR format, ComSafeArrayIn(ExportOptions_T, options), IN_BSTR path, IProgress **aProgress);
    108 
    109     STDMETHOD(GetWarnings)(ComSafeArrayOut(BSTR, aWarnings));
    110 
    11179    /* public methods only for internal purposes */
    11280
    113     static HRESULT setErrorStatic(HRESULT aResultCode,
    114                                   const Utf8Str &aText)
     81    static HRESULT i_setErrorStatic(HRESULT aResultCode,
     82                                    const Utf8Str &aText)
    11583    {
    11684        return setErrorInternal(aResultCode, getStaticClassIID(), getStaticComponentName(), aText, false, true);
     
    12088private:
    12189    /** weak VirtualBox parent */
     90    // wrapped IAppliance properties
     91    HRESULT getPath(com::Utf8Str &aPath);
     92    HRESULT getDisks(std::vector<com::Utf8Str> &aDisks);
     93    HRESULT getVirtualSystemDescriptions(std::vector<ComPtr<IVirtualSystemDescription> > &aVirtualSystemDescriptions);
     94    HRESULT getMachines(std::vector<com::Utf8Str> &aMachines);
     95
     96    // wrapped IAppliance methods
     97    HRESULT read(const com::Utf8Str &aFile,
     98                 ComPtr<IProgress> &aProgress);
     99    HRESULT interpret();
     100    HRESULT importMachines(const std::vector<ImportOptions_T> &aOptions,
     101                           ComPtr<IProgress> &aProgress);
     102    HRESULT createVFSExplorer(const com::Utf8Str &aURI,
     103                              ComPtr<IVFSExplorer> &aExplorer);
     104    HRESULT write(const com::Utf8Str &aFormat,
     105                  const std::vector<ExportOptions_T> &aOptions,
     106                  const com::Utf8Str &aPath,
     107                  ComPtr<IProgress> &aProgress);
     108    HRESULT getWarnings(std::vector<com::Utf8Str> &aWarnings);
     109
     110
    122111    VirtualBox* const   mVirtualBox;
    123112
     
    133122     ******************************************************************************/
    134123
    135     bool isApplianceIdle();
    136     HRESULT searchUniqueVMName(Utf8Str& aName) const;
    137     HRESULT searchUniqueDiskImageFilePath(Utf8Str& aName) const;
    138     HRESULT setUpProgress(ComObjPtr<Progress> &pProgress,
    139                           const Bstr &bstrDescription,
    140                           SetUpProgressMode mode);
    141     void waitForAsyncProgress(ComObjPtr<Progress> &pProgressThis, ComPtr<IProgress> &pProgressAsync);
    142     void addWarning(const char* aWarning, ...);
    143     void disksWeight();
    144     void parseBucket(Utf8Str &aPath, Utf8Str &aBucket);
    145 
    146     static DECLCALLBACK(int) taskThreadImportOrExport(RTTHREAD aThread, void *pvUser);
    147 
    148     HRESULT initSetOfSupportedStandardsURI();
    149 
    150     Utf8Str typeOfVirtualDiskFormatFromURI(Utf8Str type) const;
    151 
    152     std::set<Utf8Str> URIFromTypeOfVirtualDiskFormat(Utf8Str type);
    153 
    154     HRESULT initApplianceIONameMap();
    155 
    156     Utf8Str applianceIOName(APPLIANCEIONAME type) const;
    157 
    158     HRESULT findMediumFormatFromDiskImage(const ovf::DiskImage &di, ComObjPtr<MediumFormat>& mf);
     124    bool i_isApplianceIdle();
     125    HRESULT i_searchUniqueVMName(Utf8Str& aName) const;
     126    HRESULT i_searchUniqueDiskImageFilePath(Utf8Str& aName) const;
     127    HRESULT i_setUpProgress(ComObjPtr<Progress> &pProgress,
     128                            const Bstr &bstrDescription,
     129                            SetUpProgressMode mode);
     130    void i_waitForAsyncProgress(ComObjPtr<Progress> &pProgressThis, ComPtr<IProgress> &pProgressAsync);
     131    void i_addWarning(const char* aWarning, ...);
     132    void i_disksWeight();
     133    void i_parseBucket(Utf8Str &aPath, Utf8Str &aBucket);
     134
     135    static DECLCALLBACK(int) i_taskThreadImportOrExport(RTTHREAD aThread, void *pvUser);
     136
     137    HRESULT i_initSetOfSupportedStandardsURI();
     138
     139    Utf8Str i_typeOfVirtualDiskFormatFromURI(Utf8Str type) const;
     140
     141    std::set<Utf8Str> i_URIFromTypeOfVirtualDiskFormat(Utf8Str type);
     142
     143    HRESULT i_initApplianceIONameMap();
     144
     145    Utf8Str i_applianceIOName(APPLIANCEIONAME type) const;
     146
     147    HRESULT i_findMediumFormatFromDiskImage(const ovf::DiskImage &di, ComObjPtr<MediumFormat>& mf);
    159148
    160149    /*******************************************************************************
     
    162151     ******************************************************************************/
    163152
    164     HRESULT readImpl(const LocationInfo &aLocInfo, ComObjPtr<Progress> &aProgress);
    165 
    166     HRESULT readFS(TaskOVF *pTask);
    167     HRESULT readFSOVF(TaskOVF *pTask);
    168     HRESULT readFSOVA(TaskOVF *pTask);
    169     HRESULT readFSImpl(TaskOVF *pTask, const RTCString &strFilename, PVDINTERFACEIO pCallbacks, PSHASTORAGE pStorage);
    170     HRESULT readS3(TaskOVF *pTask);
     153    HRESULT i_readImpl(const LocationInfo &aLocInfo, ComObjPtr<Progress> &aProgress);
     154
     155    HRESULT i_readFS(TaskOVF *pTask);
     156    HRESULT i_readFSOVF(TaskOVF *pTask);
     157    HRESULT i_readFSOVA(TaskOVF *pTask);
     158    HRESULT i_readFSImpl(TaskOVF *pTask, const RTCString &strFilename, PVDINTERFACEIO pCallbacks, PSHASTORAGE pStorage);
     159    HRESULT i_readS3(TaskOVF *pTask);
    171160
    172161    /*******************************************************************************
     
    174163     ******************************************************************************/
    175164
    176     HRESULT importImpl(const LocationInfo &aLocInfo, ComObjPtr<Progress> &aProgress);
    177 
    178     HRESULT importFS(TaskOVF *pTask);
    179     HRESULT importFSOVF(TaskOVF *pTask, AutoWriteLockBase& writeLock);
    180     HRESULT importFSOVA(TaskOVF *pTask, AutoWriteLockBase& writeLock);
    181     HRESULT importS3(TaskOVF *pTask);
    182 
    183     HRESULT readFileToBuf(const Utf8Str &strFile,
    184                              void **ppvBuf,
    185                              size_t *pcbSize,
    186                              bool fCreateDigest,
    187                              PVDINTERFACEIO pCallbacks,
    188                              PSHASTORAGE pStorage);
    189     HRESULT readTarFileToBuf(RTTAR tar,
    190                              const Utf8Str &strFile,
    191                              void **ppvBuf,
    192                              size_t *pcbSize,
    193                              bool fCreateDigest,
    194                              PVDINTERFACEIO pCallbacks,
    195                              PSHASTORAGE pStorage);
    196     HRESULT verifyManifestFile(const Utf8Str &strFile, ImportStack &stack, void *pvBuf, size_t cbSize);
    197 
    198     void convertDiskAttachmentValues(const ovf::HardDiskController &hdc,
    199                                      uint32_t ulAddressOnParent,
    200                                      Bstr &controllerType,
    201                                      int32_t &lControllerPort,
    202                                      int32_t &lDevice);
    203 
    204     void importOneDiskImage(const ovf::DiskImage &di,
    205                             Utf8Str *strTargetPath,
    206                             ComObjPtr<Medium> &pTargetHD,
    207                             ImportStack &stack,
     165    HRESULT i_importImpl(const LocationInfo &aLocInfo, ComObjPtr<Progress> &aProgress);
     166
     167    HRESULT i_importFS(TaskOVF *pTask);
     168    HRESULT i_importFSOVF(TaskOVF *pTask, AutoWriteLockBase& writeLock);
     169    HRESULT i_importFSOVA(TaskOVF *pTask, AutoWriteLockBase& writeLock);
     170    HRESULT i_importS3(TaskOVF *pTask);
     171
     172    HRESULT i_readFileToBuf(const Utf8Str &strFile,
     173                            void **ppvBuf,
     174                            size_t *pcbSize,
     175                            bool fCreateDigest,
    208176                            PVDINTERFACEIO pCallbacks,
    209177                            PSHASTORAGE pStorage);
    210 
    211     void importMachineGeneric(const ovf::VirtualSystem &vsysThis,
    212                               ComObjPtr<VirtualSystemDescription> &vsdescThis,
    213                               ComPtr<IMachine> &pNewMachine,
     178    HRESULT i_readTarFileToBuf(RTTAR tar,
     179                              const Utf8Str &strFile,
     180                              void **ppvBuf,
     181                              size_t *pcbSize,
     182                              bool fCreateDigest,
     183                              PVDINTERFACEIO pCallbacks,
     184                              PSHASTORAGE pStorage);
     185    HRESULT i_verifyManifestFile(const Utf8Str &strFile, ImportStack &stack, void *pvBuf, size_t cbSize);
     186
     187    void i_convertDiskAttachmentValues(const ovf::HardDiskController &hdc,
     188                                       uint32_t ulAddressOnParent,
     189                                       Bstr &controllerType,
     190                                       int32_t &lControllerPort,
     191                                       int32_t &lDevice);
     192
     193    void i_importOneDiskImage(const ovf::DiskImage &di,
     194                              Utf8Str *strTargetPath,
     195                              ComObjPtr<Medium> &pTargetHD,
    214196                              ImportStack &stack,
    215197                              PVDINTERFACEIO pCallbacks,
    216198                              PSHASTORAGE pStorage);
    217     void importVBoxMachine(ComObjPtr<VirtualSystemDescription> &vsdescThis,
    218                            ComPtr<IMachine> &pNewMachine,
    219                            ImportStack &stack,
    220                            PVDINTERFACEIO pCallbacks,
    221                            PSHASTORAGE pStorage);
    222     void importMachines(ImportStack &stack,
    223                         PVDINTERFACEIO pCallbacks,
    224                         PSHASTORAGE pStorage);
     199
     200    void i_importMachineGeneric(const ovf::VirtualSystem &vsysThis,
     201                                ComObjPtr<VirtualSystemDescription> &vsdescThis,
     202                                ComPtr<IMachine> &pNewMachine,
     203                                ImportStack &stack,
     204                                PVDINTERFACEIO pCallbacks,
     205                                PSHASTORAGE pStorage);
     206    void i_importVBoxMachine(ComObjPtr<VirtualSystemDescription> &vsdescThis,
     207                             ComPtr<IMachine> &pNewMachine,
     208                             ImportStack &stack,
     209                             PVDINTERFACEIO pCallbacks,
     210                             PSHASTORAGE pStorage);
     211    void i_importMachines(ImportStack &stack,
     212                          PVDINTERFACEIO pCallbacks,
     213                          PSHASTORAGE pStorage);
    225214
    226215    /*******************************************************************************
     
    228217     ******************************************************************************/
    229218
    230     HRESULT writeImpl(ovf::OVFVersion_T aFormat, const LocationInfo &aLocInfo, ComObjPtr<Progress> &aProgress);
    231 
    232     HRESULT writeFS(TaskOVF *pTask);
    233     HRESULT writeFSOVF(TaskOVF *pTask, AutoWriteLockBase& writeLock);
    234     HRESULT writeFSOVA(TaskOVF *pTask, AutoWriteLockBase& writeLock);
    235     HRESULT writeFSImpl(TaskOVF *pTask, AutoWriteLockBase& writeLock, PVDINTERFACEIO pCallbacks, PSHASTORAGE pStorage);
    236     HRESULT writeS3(TaskOVF *pTask);
     219    HRESULT i_writeImpl(ovf::OVFVersion_T aFormat, const LocationInfo &aLocInfo, ComObjPtr<Progress> &aProgress);
     220
     221    HRESULT i_writeFS(TaskOVF *pTask);
     222    HRESULT i_writeFSOVF(TaskOVF *pTask, AutoWriteLockBase& writeLock);
     223    HRESULT i_writeFSOVA(TaskOVF *pTask, AutoWriteLockBase& writeLock);
     224    HRESULT i_writeFSImpl(TaskOVF *pTask, AutoWriteLockBase& writeLock, PVDINTERFACEIO pCallbacks, PSHASTORAGE pStorage);
     225    HRESULT i_writeS3(TaskOVF *pTask);
    237226
    238227    struct XMLStack;
    239228
    240     void buildXML(AutoWriteLockBase& writeLock,
    241                   xml::Document &doc,
    242                   XMLStack &stack,
    243                   const Utf8Str &strPath,
    244                   ovf::OVFVersion_T enFormat);
    245     void buildXMLForOneVirtualSystem(AutoWriteLockBase& writeLock,
    246                                      xml::ElementNode &elmToAddVirtualSystemsTo,
    247                                      std::list<xml::ElementNode*> *pllElementsWithUuidAttributes,
    248                                      ComObjPtr<VirtualSystemDescription> &vsdescThis,
    249                                      ovf::OVFVersion_T enFormat,
    250                                      XMLStack &stack);
    251 
    252     HRESULT preCheckImageAvailability(PSHASTORAGE pSHAStorage,
    253                                       RTCString &availableImage);
     229    void i_buildXML(AutoWriteLockBase& writeLock,
     230                    xml::Document &doc,
     231                    XMLStack &stack,
     232                    const Utf8Str &strPath,
     233                    ovf::OVFVersion_T enFormat);
     234    void i_buildXMLForOneVirtualSystem(AutoWriteLockBase& writeLock,
     235                                       xml::ElementNode &elmToAddVirtualSystemsTo,
     236                                       std::list<xml::ElementNode*> *pllElementsWithUuidAttributes,
     237                                       ComObjPtr<VirtualSystemDescription> &vsdescThis,
     238                                       ovf::OVFVersion_T enFormat,
     239                                       XMLStack &stack);
     240
     241    HRESULT i_preCheckImageAvailability(PSHASTORAGE pSHAStorage,
     242                                        RTCString &availableImage);
    254243
    255244    friend class Machine;
    256245};
    257246
    258 void parseURI(Utf8Str strUri, LocationInfo &locInfo);
     247void i_parseURI(Utf8Str strUri, LocationInfo &locInfo);
    259248
    260249struct VirtualSystemDescriptionEntry
     
    273262
    274263class ATL_NO_VTABLE VirtualSystemDescription :
    275     public VirtualBoxBase,
    276     VBOX_SCRIPTABLE_IMPL(IVirtualSystemDescription)
     264    public VirtualSystemDescriptionWrap
    277265{
    278266    friend class Appliance;
    279267
    280268public:
    281     VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(VirtualSystemDescription, IVirtualSystemDescription)
    282 
    283     DECLARE_NOT_AGGREGATABLE(VirtualSystemDescription)
    284 
    285     DECLARE_PROTECT_FINAL_CONSTRUCT()
    286 
    287     BEGIN_COM_MAP(VirtualSystemDescription)
    288         VBOX_DEFAULT_INTERFACE_ENTRIES(IVirtualSystemDescription)
    289     END_COM_MAP()
    290 
    291     DECLARE_EMPTY_CTOR_DTOR (VirtualSystemDescription)
    292 
    293     // public initializer/uninitializer for internal purposes only
    294     HRESULT FinalConstruct() { return BaseFinalConstruct(); }
    295     void FinalRelease() { uninit(); BaseFinalRelease(); }
     269
     270    DECLARE_EMPTY_CTOR_DTOR(VirtualSystemDescription)
     271
     272    HRESULT FinalConstruct();
     273    void FinalRelease();
    296274
    297275    HRESULT init();
    298276    void uninit();
    299277
    300     /* IVirtualSystemDescription properties */
    301     STDMETHOD(COMGETTER(Count))(ULONG *aCount);
    302 
    303     /* IVirtualSystemDescription methods */
    304     STDMETHOD(GetDescription)(ComSafeArrayOut(VirtualSystemDescriptionType_T, aTypes),
    305                               ComSafeArrayOut(BSTR, aRefs),
    306                               ComSafeArrayOut(BSTR, aOvfValues),
    307                               ComSafeArrayOut(BSTR, aVboxValues),
    308                               ComSafeArrayOut(BSTR, aExtraConfigValues));
    309 
    310     STDMETHOD(GetDescriptionByType)(VirtualSystemDescriptionType_T aType,
    311                                     ComSafeArrayOut(VirtualSystemDescriptionType_T, aTypes),
    312                                     ComSafeArrayOut(BSTR, aRefs),
    313                                     ComSafeArrayOut(BSTR, aOvfValues),
    314                                     ComSafeArrayOut(BSTR, aVboxValues),
    315                                     ComSafeArrayOut(BSTR, aExtraConfigValues));
    316 
    317     STDMETHOD(GetValuesByType)(VirtualSystemDescriptionType_T aType,
    318                                VirtualSystemDescriptionValueType_T aWhich,
    319                                ComSafeArrayOut(BSTR, aValues));
    320 
    321     STDMETHOD(SetFinalValues)(ComSafeArrayIn(BOOL, aEnabled),
    322                               ComSafeArrayIn(IN_BSTR, aVboxValues),
    323                               ComSafeArrayIn(IN_BSTR, aExtraConfigValues));
    324 
    325     STDMETHOD(AddDescription)(VirtualSystemDescriptionType_T aType,
    326                               IN_BSTR aVboxValue,
    327                               IN_BSTR aExtraConfigValue);
    328 
    329278    /* public methods only for internal purposes */
    330 
    331     void addEntry(VirtualSystemDescriptionType_T aType,
    332                   const Utf8Str &strRef,
    333                   const Utf8Str &aOvfValue,
    334                   const Utf8Str &aVboxValue,
    335                   uint32_t ulSizeMB = 0,
    336                   const Utf8Str &strExtraConfig = "");
    337 
    338     std::list<VirtualSystemDescriptionEntry*> findByType(VirtualSystemDescriptionType_T aType);
    339     const VirtualSystemDescriptionEntry* findControllerFromID(uint32_t id);
    340 
    341     void importVboxMachineXML(const xml::ElementNode &elmMachine);
    342     const settings::MachineConfigFile* getMachineConfig() const;
    343 
    344     void removeByType(VirtualSystemDescriptionType_T aType);
     279    void i_addEntry(VirtualSystemDescriptionType_T aType,
     280                    const Utf8Str &strRef,
     281                    const Utf8Str &aOvfValue,
     282                    const Utf8Str &aVboxValue,
     283                    uint32_t ulSizeMB = 0,
     284                    const Utf8Str &strExtraConfig = "");
     285
     286    std::list<VirtualSystemDescriptionEntry*> i_findByType(VirtualSystemDescriptionType_T aType);
     287    const VirtualSystemDescriptionEntry* i_findControllerFromID(uint32_t id);
     288
     289    void i_importVboxMachineXML(const xml::ElementNode &elmMachine);
     290    const settings::MachineConfigFile* i_getMachineConfig() const;
    345291
    346292    /* private instance data */
    347293private:
     294
     295    // wrapped IVirtualSystemDescription properties
     296    HRESULT getCount(ULONG *aCount);
     297
     298    // wrapped IVirtualSystemDescription methods
     299    HRESULT getDescription(std::vector<VirtualSystemDescriptionType_T> &aTypes,
     300                           std::vector<com::Utf8Str> &aRefs,
     301                           std::vector<com::Utf8Str> &aOVFValues,
     302                           std::vector<com::Utf8Str> &aVBoxValues,
     303                           std::vector<com::Utf8Str> &aExtraConfigValues);
     304    HRESULT getDescriptionByType(VirtualSystemDescriptionType_T aType,
     305                                 std::vector<VirtualSystemDescriptionType_T> &aTypes,
     306                                 std::vector<com::Utf8Str> &aRefs,
     307                                 std::vector<com::Utf8Str> &aOVFValues,
     308                                 std::vector<com::Utf8Str> &aVBoxValues,
     309                                 std::vector<com::Utf8Str> &aExtraConfigValues);
     310    HRESULT getValuesByType(VirtualSystemDescriptionType_T aType,
     311                            VirtualSystemDescriptionValueType_T aWhich,
     312                            std::vector<com::Utf8Str> &aValues);
     313    HRESULT setFinalValues(const std::vector<BOOL> &aEnabled,
     314                           const std::vector<com::Utf8Str> &aVBoxValues,
     315                           const std::vector<com::Utf8Str> &aExtraConfigValues);
     316    HRESULT addDescription(VirtualSystemDescriptionType_T aType,
     317                           const com::Utf8Str &aVBoxValue,
     318                           const com::Utf8Str &aExtraConfigValue);
     319    void i_removeByType(VirtualSystemDescriptionType_T aType);
     320
    348321    struct Data;
    349322    Data *m;
  • trunk/src/VBox/Main/include/ApplianceImplPrivate.h

    r49103 r49742  
    44 */
    55
    6 /*
    7  * Copyright (C) 2006-2013 Oracle Corporation
     6/* Copyright (C) 2006-2013 Oracle Corporation
    87 *
    98 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    212211struct VirtualSystemDescription::Data
    213212{
    214     std::list<VirtualSystemDescriptionEntry>
    215                             llDescriptions;     // item descriptions
     213    std::vector<VirtualSystemDescriptionEntry>
     214                            maDescriptions;     // item descriptions
    216215
    217216    ComPtr<Machine>         pMachine;           // VirtualBox machine this description was exported from (export only)
  • trunk/src/VBox/Main/include/HostImpl.h

    r48765 r49742  
    1919#define ____H_HOSTIMPL
    2020
    21 #include "VirtualBoxBase.h"
     21#include "HostWrap.h"
    2222
    2323class HostUSBDeviceFilter;
     
    3535
    3636class ATL_NO_VTABLE Host :
    37     public VirtualBoxBase,
    38     VBOX_SCRIPTABLE_IMPL(IHost)
     37    public HostWrap
    3938{
    4039public:
    41     VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(Host, IHost)
    4240
    43     DECLARE_NOT_AGGREGATABLE(Host)
    44 
    45     DECLARE_PROTECT_FINAL_CONSTRUCT()
    46 
    47     BEGIN_COM_MAP(Host)
    48         VBOX_DEFAULT_INTERFACE_ENTRIES(IHost)
    49     END_COM_MAP()
     41    DECLARE_EMPTY_CTOR_DTOR(Host)
    5042
    5143    HRESULT FinalConstruct();
     
    5547    HRESULT init(VirtualBox *aParent);
    5648    void uninit();
    57 
    58     // IHost properties
    59     STDMETHOD(COMGETTER(DVDDrives))(ComSafeArrayOut(IMedium *, drives));
    60     STDMETHOD(COMGETTER(FloppyDrives))(ComSafeArrayOut(IMedium *, drives));
    61     STDMETHOD(COMGETTER(USBDevices))(ComSafeArrayOut(IHostUSBDevice *, aUSBDevices));
    62     STDMETHOD(COMGETTER(USBDeviceFilters))(ComSafeArrayOut(IHostUSBDeviceFilter *, aUSBDeviceFilters));
    63     STDMETHOD(COMGETTER(NetworkInterfaces))(ComSafeArrayOut(IHostNetworkInterface *, aNetworkInterfaces));
    64     STDMETHOD(COMGETTER(NameServers))(ComSafeArrayOut(BSTR, aNameServers));
    65     STDMETHOD(COMGETTER(DomainName))(BSTR *aDomainName);
    66     STDMETHOD(COMGETTER(SearchStrings))(ComSafeArrayOut(BSTR, aSearchStrings));
    67     STDMETHOD(COMGETTER(ProcessorCount))(ULONG *count);
    68     STDMETHOD(COMGETTER(ProcessorOnlineCount))(ULONG *count);
    69     STDMETHOD(COMGETTER(ProcessorCoreCount))(ULONG *count);
    70     STDMETHOD(COMGETTER(ProcessorOnlineCoreCount))(ULONG *count);
    71     STDMETHOD(GetProcessorSpeed)(ULONG cpuId, ULONG *speed);
    72     STDMETHOD(GetProcessorDescription)(ULONG cpuId, BSTR *description);
    73     STDMETHOD(GetProcessorFeature)(ProcessorFeature_T feature, BOOL *supported);
    74     STDMETHOD(GetProcessorCPUIDLeaf)(ULONG aCpuId, ULONG aLeaf, ULONG aSubLeaf, ULONG *aValEAX, ULONG *aValEBX, ULONG *aValECX, ULONG *aValEDX);
    75     STDMETHOD(COMGETTER(MemorySize))(ULONG *size);
    76     STDMETHOD(COMGETTER(MemoryAvailable))(ULONG *available);
    77     STDMETHOD(COMGETTER(OperatingSystem))(BSTR *os);
    78     STDMETHOD(COMGETTER(OSVersion))(BSTR *version);
    79     STDMETHOD(COMGETTER(UTCTime))(LONG64 *aUTCTime);
    80     STDMETHOD(COMGETTER(Acceleration3DAvailable))(BOOL *aSupported);
    81     STDMETHOD(COMGETTER(VideoInputDevices))(ComSafeArrayOut(IHostVideoInputDevice*, aVideoInputDevices));
    82 
    83     // IHost methods
    84     STDMETHOD(CreateHostOnlyNetworkInterface)(IHostNetworkInterface **aHostNetworkInterface,
    85                                               IProgress **aProgress);
    86     STDMETHOD(RemoveHostOnlyNetworkInterface)(IN_BSTR aId, IProgress **aProgress);
    87     STDMETHOD(CreateUSBDeviceFilter)(IN_BSTR aName, IHostUSBDeviceFilter **aFilter);
    88     STDMETHOD(InsertUSBDeviceFilter)(ULONG aPosition, IHostUSBDeviceFilter *aFilter);
    89     STDMETHOD(RemoveUSBDeviceFilter)(ULONG aPosition);
    90 
    91     STDMETHOD(FindHostDVDDrive)(IN_BSTR aName, IMedium **aDrive);
    92     STDMETHOD(FindHostFloppyDrive)(IN_BSTR aName, IMedium **aDrive);
    93     STDMETHOD(FindHostNetworkInterfaceByName)(IN_BSTR aName, IHostNetworkInterface **networkInterface);
    94     STDMETHOD(FindHostNetworkInterfaceById)(IN_BSTR id, IHostNetworkInterface **networkInterface);
    95     STDMETHOD(FindHostNetworkInterfacesOfType)(HostNetworkInterfaceType_T type, ComSafeArrayOut(IHostNetworkInterface *, aNetworkInterfaces));
    96     STDMETHOD(FindUSBDeviceByAddress)(IN_BSTR aAddress, IHostUSBDevice **aDevice);
    97     STDMETHOD(FindUSBDeviceById)(IN_BSTR aId, IHostUSBDevice **aDevice);
    98     STDMETHOD(GenerateMACAddress)(BSTR *aAddress);
    9949
    10050    // public methods only for internal purposes
     
    10959    }
    11060
    111     HRESULT loadSettings(const settings::Host &data);
    112     HRESULT saveSettings(settings::Host &data);
     61    HRESULT i_loadSettings(const settings::Host &data);
     62    HRESULT i_saveSettings(settings::Host &data);
    11363
    114     HRESULT getDrives(DeviceType_T mediumType, bool fRefresh, MediaList *&pll);
    115     HRESULT findHostDriveById(DeviceType_T mediumType, const Guid &uuid, bool fRefresh, ComObjPtr<Medium> &pMedium);
    116     HRESULT findHostDriveByName(DeviceType_T mediumType, const Utf8Str &strLocationFull, bool fRefresh, ComObjPtr<Medium> &pMedium);
     64    HRESULT i_getDrives(DeviceType_T mediumType, bool fRefresh, MediaList *&pll);
     65    HRESULT i_findHostDriveById(DeviceType_T mediumType, const Guid &uuid, bool fRefresh, ComObjPtr<Medium> &pMedium);
     66    HRESULT i_findHostDriveByName(DeviceType_T mediumType, const Utf8Str &strLocationFull, bool fRefresh, ComObjPtr<Medium> &pMedium);
    11767
    11868#ifdef VBOX_WITH_USB
     
    12070
    12171    /** Must be called from under this object's lock. */
    122     USBProxyService* usbProxyService();
     72    USBProxyService* i_usbProxyService();
    12373
    124     HRESULT addChild(HostUSBDeviceFilter *pChild);
    125     HRESULT removeChild(HostUSBDeviceFilter *pChild);
    126     VirtualBox* parent();
     74    HRESULT i_addChild(HostUSBDeviceFilter *pChild);
     75    HRESULT i_removeChild(HostUSBDeviceFilter *pChild);
     76    VirtualBox* i_parent();
    12777
    128     HRESULT onUSBDeviceFilterChange(HostUSBDeviceFilter *aFilter, BOOL aActiveChanged = FALSE);
    129     void getUSBFilters(USBDeviceFilterList *aGlobalFiltes);
    130     HRESULT checkUSBProxyService();
     78    HRESULT i_onUSBDeviceFilterChange(HostUSBDeviceFilter *aFilter, BOOL aActiveChanged = FALSE);
     79    void i_getUSBFilters(USBDeviceFilterList *aGlobalFiltes);
     80    HRESULT i_checkUSBProxyService();
    13181#endif /* !VBOX_WITH_USB */
    13282
    133     static void generateMACAddress(Utf8Str &mac);
     83    static void i_generateMACAddress(Utf8Str &mac);
    13484
    13585private:
    13686
    137     HRESULT buildDVDDrivesList(MediaList &list);
    138     HRESULT buildFloppyDrivesList(MediaList &list);
    139     HRESULT findHostDriveByNameOrId(DeviceType_T mediumType, const Utf8Str &strNameOrId, ComObjPtr<Medium> &pMedium);
     87    // wrapped IHost properties
     88    HRESULT getDVDDrives(std::vector<ComPtr<IMedium> > &aDVDDrives);
     89    HRESULT getFloppyDrives(std::vector<ComPtr<IMedium> > &aFloppyDrives);
     90    HRESULT getUSBDevices(std::vector<ComPtr<IHostUSBDevice> > &aUSBDevices);
     91    HRESULT getUSBDeviceFilters(std::vector<ComPtr<IHostUSBDeviceFilter> > &aUSBDeviceFilters);
     92    HRESULT getNetworkInterfaces(std::vector<ComPtr<IHostNetworkInterface> > &aNetworkInterfaces);
     93    HRESULT getNameServers(std::vector<com::Utf8Str> &aNameServers);
     94    HRESULT getDomainName(com::Utf8Str &aDomainName);
     95    HRESULT getSearchStrings(std::vector<com::Utf8Str> &aSearchStrings);
     96    HRESULT getProcessorCount(ULONG *aProcessorCount);
     97    HRESULT getProcessorOnlineCount(ULONG *aProcessorOnlineCount);
     98    HRESULT getProcessorCoreCount(ULONG *aProcessorCoreCount);
     99    HRESULT getProcessorOnlineCoreCount(ULONG *aProcessorOnlineCoreCount);
     100    HRESULT getMemorySize(ULONG *aMemorySize);
     101    HRESULT getMemoryAvailable(ULONG *aMemoryAvailable);
     102    HRESULT getOperatingSystem(com::Utf8Str &aOperatingSystem);
     103    HRESULT getOSVersion(com::Utf8Str &aOSVersion);
     104    HRESULT getUTCTime(LONG64 *aUTCTime);
     105    HRESULT getAcceleration3DAvailable(BOOL *aAcceleration3DAvailable);
     106    HRESULT getVideoInputDevices(std::vector<ComPtr<IHostVideoInputDevice> > &aVideoInputDevices);
     107
     108    // wrapped IHost methods
     109    HRESULT getProcessorSpeed(ULONG aCpuId,
     110                              ULONG *aSpeed);
     111    HRESULT getProcessorFeature(ProcessorFeature_T aFeature,
     112                                BOOL *aSupported);
     113    HRESULT getProcessorDescription(ULONG aCpuId,
     114                                    com::Utf8Str &aDescription);
     115    HRESULT getProcessorCPUIDLeaf(ULONG aCpuId,
     116                                  ULONG aLeaf,
     117                                  ULONG aSubLeaf,
     118                                  ULONG *aValEax,
     119                                  ULONG *aValEbx,
     120                                  ULONG *aValEcx,
     121                                  ULONG *aValEdx);
     122    HRESULT createHostOnlyNetworkInterface(ComPtr<IHostNetworkInterface> &aHostInterface,
     123                                           ComPtr<IProgress> &aProgress);
     124    HRESULT removeHostOnlyNetworkInterface(const com::Guid &aId,
     125                                           ComPtr<IProgress> &aProgress);
     126    HRESULT createUSBDeviceFilter(const com::Utf8Str &aName,
     127                                  ComPtr<IHostUSBDeviceFilter> &aFilter);
     128    HRESULT insertUSBDeviceFilter(ULONG aPosition,
     129                                  const ComPtr<IHostUSBDeviceFilter> &aFilter);
     130    HRESULT removeUSBDeviceFilter(ULONG aPosition);
     131    HRESULT findHostDVDDrive(const com::Utf8Str &aName,
     132                             ComPtr<IMedium> &aDrive);
     133    HRESULT findHostFloppyDrive(const com::Utf8Str &aName,
     134                                ComPtr<IMedium> &aDrive);
     135    HRESULT findHostNetworkInterfaceByName(const com::Utf8Str &aName,
     136                                           ComPtr<IHostNetworkInterface> &aNetworkInterface);
     137    HRESULT findHostNetworkInterfaceById(const com::Guid &aId,
     138                                         ComPtr<IHostNetworkInterface> &aNetworkInterface);
     139    HRESULT findHostNetworkInterfacesOfType(HostNetworkInterfaceType_T aType,
     140                                            std::vector<ComPtr<IHostNetworkInterface> > &aNetworkInterfaces);
     141    HRESULT findUSBDeviceById(const com::Guid &aId,
     142                              ComPtr<IHostUSBDevice> &aDevice);
     143    HRESULT findUSBDeviceByAddress(const com::Utf8Str &aName,
     144                                   ComPtr<IHostUSBDevice> &aDevice);
     145    HRESULT generateMACAddress(com::Utf8Str &aAddress);
     146
     147    // Internal Methods.
     148
     149    HRESULT i_buildDVDDrivesList(MediaList &list);
     150    HRESULT i_buildFloppyDrivesList(MediaList &list);
     151    HRESULT i_findHostDriveByNameOrId(DeviceType_T mediumType, const Utf8Str &strNameOrId, ComObjPtr<Medium> &pMedium);
    140152
    141153#if defined(RT_OS_SOLARIS) && defined(VBOX_USE_LIBHAL)
    142     bool getDVDInfoFromHal(std::list< ComObjPtr<Medium> > &list);
    143     bool getFloppyInfoFromHal(std::list< ComObjPtr<Medium> > &list);
     154    bool i_getDVDInfoFromHal(std::list< ComObjPtr<Medium> > &list);
     155    bool i_getFloppyInfoFromHal(std::list< ComObjPtr<Medium> > &list);
    144156#endif
    145157
    146158#if defined(RT_OS_SOLARIS)
    147     void getDVDInfoFromDevTree(std::list< ComObjPtr<Medium> > &list);
    148     void parseMountTable(char *mountTable, std::list< ComObjPtr<Medium> > &list);
    149     bool validateDevice(const char *deviceNode, bool isCDROM);
     159    void i_getDVDInfoFromDevTree(std::list< ComObjPtr<Medium> > &list);
     160    void i_parseMountTable(char *mountTable, std::list< ComObjPtr<Medium> > &list);
     161    bool i_validateDevice(const char *deviceNode, bool isCDROM);
    150162#endif
    151163
    152     HRESULT updateNetIfList();
     164    HRESULT i_updateNetIfList();
    153165
    154166#ifndef RT_OS_WINDOWS
    155     HRESULT parseResolvConf();
     167    HRESULT i_parseResolvConf();
    156168#else
    157     HRESULT fetchNameResolvingInformation();
     169    HRESULT i_fetchNameResolvingInformation();
    158170#endif
    159171
    160172#ifdef VBOX_WITH_RESOURCE_USAGE_API
    161     void registerMetrics(PerformanceCollector *aCollector);
    162     void registerDiskMetrics(PerformanceCollector *aCollector);
    163     void unregisterMetrics(PerformanceCollector *aCollector);
     173    void i_registerMetrics(PerformanceCollector *aCollector);
     174    void i_registerDiskMetrics(PerformanceCollector *aCollector);
     175    void i_unregisterMetrics(PerformanceCollector *aCollector);
    164176#endif /* VBOX_WITH_RESOURCE_USAGE_API */
    165177
  • trunk/src/VBox/Main/include/NATNetworkImpl.h

    r49494 r49742  
    55
    66/*
    7  * Copyright (C) 2006-2011 Oracle Corporation
     7 * Copyright (C) 2006-2013 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    1818#ifndef ____H_H_NATNETWORKIMPL
    1919#define ____H_H_NATNETWORKIMPL
    20 
    21 #include "VirtualBoxBase.h"
     20#include "VBoxEvents.h"
     21#include "NATNetworkWrap.h"
    2222
    2323#ifdef VBOX_WITH_HOSTNETIF_API
     
    5353
    5454class ATL_NO_VTABLE NATNetwork :
    55     public VirtualBoxBase,
    56     VBOX_SCRIPTABLE_IMPL(INATNetwork)
     55    public NATNetworkWrap
    5756{
    5857public:
    5958
    60     VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(NATNetwork, INATNetwork)
    61 
    62     DECLARE_NOT_AGGREGATABLE (NATNetwork)
    63 
    64     DECLARE_PROTECT_FINAL_CONSTRUCT()
    65 
    66     BEGIN_COM_MAP (NATNetwork)
    67         VBOX_DEFAULT_INTERFACE_ENTRIES(INATNetwork)
    68     END_COM_MAP()
    69 
    70     DECLARE_EMPTY_CTOR_DTOR (NATNetwork)
     59    DECLARE_EMPTY_CTOR_DTOR(NATNetwork)
    7160
    7261    HRESULT FinalConstruct();
     
    7463
    7564    HRESULT init(VirtualBox *aVirtualBox,
    76                  IN_BSTR aName);
     65                 com::Utf8Str aName);
    7766
    7867
    7968    HRESULT init(VirtualBox *aVirtualBox,
    8069                 const settings::NATNetwork &data);
    81     HRESULT saveSettings(settings::NATNetwork &data);
    8270    void uninit();
    83     // INATNetwork::EventSource
    84     STDMETHOD(COMGETTER(EventSource))(IEventSource **IEventSource);
    85     // INATNetwork properties
    86     STDMETHOD(COMGETTER(Enabled))(BOOL *aEnabled);
    87     STDMETHOD(COMSETTER(Enabled))(BOOL aEnabled);
    88 
    89     STDMETHOD(COMGETTER(NetworkName))(BSTR *aName);
    90     STDMETHOD(COMSETTER(NetworkName))(IN_BSTR aName);
    91 
    92     STDMETHOD(COMGETTER(Gateway))(BSTR *aIPGateway);
    93 
    94     STDMETHOD(COMGETTER(Network))(BSTR *aIPNetwork);
    95     STDMETHOD(COMSETTER(Network))(IN_BSTR aIPNetwork);
    96 
    97     STDMETHOD(COMGETTER(IPv6Enabled))(BOOL *aEnabled);
    98     STDMETHOD(COMSETTER(IPv6Enabled))(BOOL aEnabled);
    99 
    100     STDMETHOD(COMGETTER(IPv6Prefix))(BSTR *aName);
    101     STDMETHOD(COMSETTER(IPv6Prefix))(IN_BSTR aName);
    102 
    103     STDMETHOD(COMGETTER(AdvertiseDefaultIPv6RouteEnabled))(BOOL *aEnabled);
    104     STDMETHOD(COMSETTER(AdvertiseDefaultIPv6RouteEnabled))(BOOL aEnabled);
    105 
    106     STDMETHOD(COMGETTER(NeedDhcpServer))(BOOL *aEnabled);
    107     STDMETHOD(COMSETTER(NeedDhcpServer))(BOOL aEnabled);
    108 
    109     STDMETHOD(COMGETTER(LocalMappings))(ComSafeArrayOut(BSTR, aLocalMappings));
    110     STDMETHOD(AddLocalMapping)(IN_BSTR aHostId, LONG aOffset);
    111 
    112     STDMETHOD(COMGETTER(LoopbackIp6))(LONG *aLoopbackIp6);
    113     STDMETHOD(COMSETTER(LoopbackIp6))(LONG aLoopbackIp6);
    114 
    115     STDMETHOD(COMGETTER(PortForwardRules4))(ComSafeArrayOut(BSTR, aPortForwardRules4));
    116     STDMETHOD(COMGETTER(PortForwardRules6))(ComSafeArrayOut(BSTR, aPortForwardRules6));
    117 
    118     STDMETHOD(AddPortForwardRule)(BOOL aIsIpv6,
    119                                   IN_BSTR aPortForwardRuleName,
    120                                   NATProtocol_T aProto,
    121                                   IN_BSTR aHostIp,
    122                                   USHORT aHostPort,
    123                                   IN_BSTR aGuestIp,
    124                                   USHORT aGuestPort);
    125     STDMETHOD(RemovePortForwardRule)(BOOL aIsIpv6, IN_BSTR aPortForwardRuleName);
    126 
    127     STDMETHOD(Start)(IN_BSTR aTrunkType);
    128     STDMETHOD(Stop)();
     71    HRESULT i_saveSettings(settings::NATNetwork &data);
    12972
    13073private:
    131     int recalculateIpv4AddressAssignments();
    132     int findFirstAvailableOffset(ADDRESSLOOKUPTYPE, uint32_t *);
     74
     75    // Wrapped INATNetwork properties
     76    HRESULT getNetworkName(com::Utf8Str &aNetworkName);
     77    HRESULT setNetworkName(const com::Utf8Str &aNetworkName);
     78    HRESULT getEnabled(BOOL *aEnabled);
     79    HRESULT setEnabled(BOOL aEnabled);
     80    HRESULT getNetwork(com::Utf8Str &aNetwork);
     81    HRESULT setNetwork(const com::Utf8Str &aNetwork);
     82    HRESULT getGateway(com::Utf8Str &aGateway);
     83    HRESULT getIPv6Enabled(BOOL *aIPv6Enabled);
     84    HRESULT setIPv6Enabled(BOOL aIPv6Enabled);
     85    HRESULT getIPv6Prefix(com::Utf8Str &aIPv6Prefix);
     86    HRESULT setIPv6Prefix(const com::Utf8Str &aIPv6Prefix);
     87    HRESULT getAdvertiseDefaultIPv6RouteEnabled(BOOL *aAdvertiseDefaultIPv6RouteEnabled);
     88    HRESULT setAdvertiseDefaultIPv6RouteEnabled(BOOL aAdvertiseDefaultIPv6RouteEnabled);
     89    HRESULT getNeedDhcpServer(BOOL *aNeedDhcpServer);
     90    HRESULT setNeedDhcpServer(BOOL aNeedDhcpServer);
     91    HRESULT getEventSource(ComPtr<IEventSource> &aEventSource);
     92    HRESULT getPortForwardRules4(std::vector<com::Utf8Str> &aPortForwardRules4);
     93    HRESULT getLocalMappings(std::vector<com::Utf8Str> &aLocalMappings);
     94    HRESULT getLoopbackIp6(LONG *aLoopbackIp6);
     95    HRESULT setLoopbackIp6(LONG aLoopbackIp6);
     96    HRESULT getPortForwardRules6(std::vector<com::Utf8Str> &aPortForwardRules6);
     97
     98    // wrapped INATNetwork methods
     99    HRESULT addLocalMapping(const com::Utf8Str &aHostid,
     100                                  LONG aOffset);
     101    HRESULT addPortForwardRule(BOOL aIsIpv6,
     102                               const com::Utf8Str &aRuleName,
     103                               NATProtocol_T aProto,
     104                               const com::Utf8Str &aHostIP,
     105                               USHORT aHostPort,
     106                               const com::Utf8Str &aGuestIP,
     107                               USHORT aGuestPort);
     108    HRESULT removePortForwardRule(BOOL aISipv6,
     109                                  const com::Utf8Str &aRuleName);
     110    HRESULT start(const com::Utf8Str &aTrunkType);
     111    HRESULT stop();
     112
     113    // Internal methods
     114    int i_recalculateIpv4AddressAssignments();
     115    int i_findFirstAvailableOffset(ADDRESSLOOKUPTYPE, uint32_t *);
    133116
    134117    typedef std::map<Utf8Str, settings::NATRule> NATRuleMap;
    135118    typedef NATRuleMap::const_iterator constNATRuleMapIterator;
    136119
    137     void GetPortForwardRulesFromMap(ComSafeArrayOut(BSTR, aPortForwardRules), NATRuleMap& aRules);
     120    void i_getPortForwardRulesFromMap(std::vector<Utf8Str> &aPortForwardRules, NATRuleMap& aRules);
     121
    138122    /** weak VirtualBox parent */
    139123    VirtualBox * const      mVirtualBox;
    140124
    141     const Bstr mName;
     125    const  com::Utf8Str mName;
     126
    142127    struct Data;
    143128    struct Data *m;
  • trunk/src/VBox/Main/src-server/ApplianceImpl.cpp

    r49620 r49742  
    3636
    3737using namespace std;
     38
     39////////////////////////////////////////////////////////////////////////////////
     40//
     41// Appliance constructor / destructor
     42//
     43// ////////////////////////////////////////////////////////////////////////////////
     44
     45DEFINE_EMPTY_CTOR_DTOR(VirtualSystemDescription)
     46
     47HRESULT VirtualSystemDescription::FinalConstruct()
     48{
     49    return BaseFinalConstruct();
     50}
     51
     52void VirtualSystemDescription::FinalRelease()
     53{
     54    uninit();
     55
     56    BaseFinalRelease();
     57}
     58
     59Appliance::Appliance()
     60    : mVirtualBox(NULL)
     61{
     62}
     63
     64Appliance::~Appliance()
     65{
     66}
     67
     68
     69HRESULT Appliance::FinalConstruct()
     70{
     71    return BaseFinalConstruct();
     72}
     73
     74void Appliance::FinalRelease()
     75{
     76    uninit();
     77
     78    BaseFinalRelease();
     79}
     80
    3881
    3982////////////////////////////////////////////////////////////////////////////////
     
    344387}
    345388
    346 ////////////////////////////////////////////////////////////////////////////////
    347 //
    348 // Appliance constructor / destructor
    349 //
    350 ////////////////////////////////////////////////////////////////////////////////
    351 
    352 Appliance::Appliance()
    353     : mVirtualBox(NULL)
    354 {
    355 }
    356 
    357 Appliance::~Appliance()
    358 {
    359 }
    360 
    361389/**
    362390 * Appliance COM initializer.
     
    377405    m = new Data;
    378406
    379     initApplianceIONameMap();
    380 
    381     rc = initSetOfSupportedStandardsURI();
     407    i_initApplianceIONameMap();
     408
     409    rc = i_initSetOfSupportedStandardsURI();
    382410
    383411    /* Confirm a successful initialization */
     
    413441 * @return
    414442 */
    415 STDMETHODIMP Appliance::COMGETTER(Path)(BSTR *aPath)
    416 {
    417     if (!aPath)
    418         return E_POINTER;
    419 
    420     AutoCaller autoCaller(this);
    421     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    422 
     443HRESULT Appliance::getPath(com::Utf8Str &aPath)
     444{
    423445    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    424446
    425     if (!isApplianceIdle())
     447    if (!i_isApplianceIdle())
    426448        return E_ACCESSDENIED;
    427449
    428     Bstr bstrPath(m->locInfo.strPath);
    429     bstrPath.cloneTo(aPath);
     450    aPath = m->locInfo.strPath;
    430451
    431452    return S_OK;
     
    437458 * @return
    438459 */
    439 STDMETHODIMP Appliance::COMGETTER(Disks)(ComSafeArrayOut(BSTR, aDisks))
    440 {
    441     CheckComArgOutSafeArrayPointerValid(aDisks);
    442 
    443     AutoCaller autoCaller(this);
    444     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    445 
     460HRESULT Appliance::getDisks(std::vector<com::Utf8Str> &aDisks)
     461{
    446462    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    447463
    448     if (!isApplianceIdle())
     464    aDisks.resize(0);
     465    if (!i_isApplianceIdle())
    449466        return E_ACCESSDENIED;
    450467
    451468    if (m->pReader) // OVFReader instantiated?
    452469    {
    453         size_t c = m->pReader->m_mapDisks.size();
    454         com::SafeArray<BSTR> sfaDisks(c);
     470        aDisks.resize(m->pReader->m_mapDisks.size());
    455471
    456472        ovf::DiskImagesMap::const_iterator it;
     
    481497                         d.strCompression.c_str());
    482498            Utf8Str utf(psz);
    483             Bstr bstr(utf);
    484             // push to safearray
    485             bstr.cloneTo(&sfaDisks[i]);
     499            aDisks[i] = utf;
    486500            RTStrFree(psz);
    487501        }
    488 
    489         sfaDisks.detachTo(ComSafeArrayOutArg(aDisks));
    490502    }
    491503
     
    498510 * @return
    499511 */
    500 STDMETHODIMP Appliance::COMGETTER(VirtualSystemDescriptions)(ComSafeArrayOut(IVirtualSystemDescription*, aVirtualSystemDescriptions))
    501 {
    502     CheckComArgOutSafeArrayPointerValid(aVirtualSystemDescriptions);
    503 
    504     AutoCaller autoCaller(this);
    505     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    506 
     512HRESULT Appliance::getVirtualSystemDescriptions(std::vector<ComPtr<IVirtualSystemDescription> > &aVirtualSystemDescriptions)
     513{
    507514    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    508515
    509     if (!isApplianceIdle())
     516    if (!i_isApplianceIdle())
    510517        return E_ACCESSDENIED;
    511518
    512     SafeIfaceArray<IVirtualSystemDescription> sfaVSD(m->virtualSystemDescriptions);
    513     sfaVSD.detachTo(ComSafeArrayOutArg(aVirtualSystemDescriptions));
    514 
     519    aVirtualSystemDescriptions.resize(m->virtualSystemDescriptions.size());
     520    std::list< ComObjPtr<VirtualSystemDescription> > vsds(m->virtualSystemDescriptions);
     521    size_t i = 0;
     522    for (std::list< ComObjPtr<VirtualSystemDescription> >::iterator it = vsds.begin(); it != vsds.end(); ++it, ++i)
     523    {
     524         (*it).queryInterfaceTo(aVirtualSystemDescriptions[i].asOutParam());
     525    }
    515526    return S_OK;
    516527}
     
    521532 * @return
    522533 */
    523 STDMETHODIMP Appliance::COMGETTER(Machines)(ComSafeArrayOut(BSTR, aMachines))
    524 {
    525     CheckComArgOutSafeArrayPointerValid(aMachines);
    526 
    527     AutoCaller autoCaller(this);
    528     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    529 
     534HRESULT Appliance::getMachines(std::vector<com::Utf8Str> &aMachines)
     535{
    530536    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    531537
    532     if (!isApplianceIdle())
     538    if (!i_isApplianceIdle())
    533539        return E_ACCESSDENIED;
    534540
    535     com::SafeArray<BSTR> sfaMachines(m->llGuidsMachinesCreated.size());
    536     size_t u = 0;
     541    aMachines.resize(m->llGuidsMachinesCreated.size());
     542    size_t i = 0;
    537543    for (std::list<Guid>::const_iterator it = m->llGuidsMachinesCreated.begin();
    538544         it != m->llGuidsMachinesCreated.end();
    539          ++it)
     545         ++it, ++i)
    540546    {
    541547        const Guid &uuid = *it;
    542         Bstr bstr(uuid.toUtf16());
    543         bstr.detachTo(&sfaMachines[u]);
    544         ++u;
    545     }
    546 
    547     sfaMachines.detachTo(ComSafeArrayOutArg(aMachines));
    548 
     548        aMachines[i] = uuid.toUtf16();
     549    }
    549550    return S_OK;
    550551}
    551552
    552 STDMETHODIMP Appliance::CreateVFSExplorer(IN_BSTR aURI, IVFSExplorer **aExplorer)
    553 {
    554     CheckComArgOutPointerValid(aExplorer);
    555 
    556     AutoCaller autoCaller(this);
    557     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    558 
     553HRESULT Appliance::createVFSExplorer(const com::Utf8Str &aURI, ComPtr<IVFSExplorer> &aExplorer)
     554{
    559555    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    560556
     
    566562        /* Check which kind of export the user has requested */
    567563        LocationInfo li;
    568         parseURI(uri, li);
     564        i_parseURI(aURI, li);
    569565        /* Create the explorer object */
    570566        explorer.createObject();
     
    578574    if (SUCCEEDED(rc))
    579575        /* Return explorer to the caller */
    580         explorer.queryInterfaceTo(aExplorer);
     576        explorer.queryInterfaceTo(aExplorer.asOutParam());
    581577
    582578    return rc;
     
    587583 * @return
    588584 */
    589 STDMETHODIMP Appliance::GetWarnings(ComSafeArrayOut(BSTR, aWarnings))
    590 {
    591     if (ComSafeArrayOutIsNull(aWarnings))
    592         return E_POINTER;
    593 
    594     AutoCaller autoCaller(this);
    595     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    596 
     585HRESULT Appliance::getWarnings(std::vector<com::Utf8Str> &aWarnings)
     586{
    597587    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    598588
    599     com::SafeArray<BSTR> sfaWarnings(m->llWarnings.size());
     589    aWarnings.resize(m->llWarnings.size());
    600590
    601591    list<Utf8Str>::const_iterator it;
     
    605595         ++it, ++i)
    606596    {
    607         Bstr bstr = *it;
    608         bstr.cloneTo(&sfaWarnings[i]);
    609     }
    610 
    611     sfaWarnings.detachTo(ComSafeArrayOutArg(aWarnings));
     597        aWarnings[i] = *it;
     598    }
    612599
    613600    return S_OK;
     
    619606//
    620607////////////////////////////////////////////////////////////////////////////////
    621 
    622 HRESULT Appliance::initSetOfSupportedStandardsURI()
     608//
     609HRESULT Appliance::i_initSetOfSupportedStandardsURI()
    623610{
    624611    HRESULT rc = S_OK;
     
    676663}
    677664
    678 Utf8Str Appliance::typeOfVirtualDiskFormatFromURI(Utf8Str uri) const
     665Utf8Str Appliance::i_typeOfVirtualDiskFormatFromURI(Utf8Str uri) const
    679666{
    680667    Utf8Str type;
     
    688675}
    689676
    690 std::set<Utf8Str> Appliance::URIFromTypeOfVirtualDiskFormat(Utf8Str type)
     677std::set<Utf8Str> Appliance::i_URIFromTypeOfVirtualDiskFormat(Utf8Str type)
    691678{
    692679    std::set<Utf8Str> uri;
     
    702689}
    703690
    704 HRESULT Appliance::initApplianceIONameMap()
     691HRESULT Appliance::i_initApplianceIONameMap()
    705692{
    706693    HRESULT rc = S_OK;
     
    715702}
    716703
    717 Utf8Str Appliance::applianceIOName(APPLIANCEIONAME type) const
     704Utf8Str Appliance::i_applianceIOName(APPLIANCEIONAME type) const
    718705{
    719706    Utf8Str name;
     
    729716
    730717/**
    731  * Returns a medium format object corresponding to the given 
    732  * disk image or null if no such format. 
     718 * Returns a medium format object corresponding to the given
     719 * disk image or null if no such format.
    733720 *
    734721 * @param di   Disk Image
     
    737724 * @return ComObjPtr<MediumFormat>
    738725 */
    739 HRESULT Appliance::findMediumFormatFromDiskImage(const ovf::DiskImage &di, ComObjPtr<MediumFormat>& mf)
     726
     727HRESULT Appliance::i_findMediumFormatFromDiskImage(const ovf::DiskImage &di, ComObjPtr<MediumFormat>& mf)
    740728{
    741729    HRESULT rc = S_OK;
     
    746734    /* We need a proper source format description */
    747735    /* Which format to use? */
    748     Utf8Str strSrcFormat = typeOfVirtualDiskFormatFromURI(di.strFormat);
     736    Utf8Str strSrcFormat = i_typeOfVirtualDiskFormatFromURI(di.strFormat);
    749737
    750738    /*
     
    789777 * @return
    790778 */
    791 bool Appliance::isApplianceIdle()
     779bool Appliance::i_isApplianceIdle()
    792780{
    793781    if (m->state == Data::ApplianceImporting)
     
    801789}
    802790
    803 HRESULT Appliance::searchUniqueVMName(Utf8Str& aName) const
     791HRESULT Appliance::i_searchUniqueVMName(Utf8Str& aName) const
    804792{
    805793    IMachine *machine = NULL;
     
    819807}
    820808
    821 HRESULT Appliance::searchUniqueDiskImageFilePath(Utf8Str& aName) const
     809HRESULT Appliance::i_searchUniqueDiskImageFilePath(Utf8Str& aName) const
    822810{
    823811    IMedium *harddisk = NULL;
     
    857845 * @return
    858846 */
    859 HRESULT Appliance::setUpProgress(ComObjPtr<Progress> &pProgress,
    860                                  const Bstr &bstrDescription,
    861                                  SetUpProgressMode mode)
     847HRESULT Appliance::i_setUpProgress(ComObjPtr<Progress> &pProgress,
     848                                   const Bstr &bstrDescription,
     849                                   SetUpProgressMode mode)
    862850{
    863851    HRESULT rc;
     
    867855
    868856    // compute the disks weight (this sets ulTotalDisksMB and cDisks in the instance data)
    869     disksWeight();
     857    i_disksWeight();
    870858
    871859    m->ulWeightForManifestOperation = 0;
     
    965953 * @param pProgressAsync Progress object of asynchronous task running in background.
    966954 */
    967 void Appliance::waitForAsyncProgress(ComObjPtr<Progress> &pProgressThis,
    968                                      ComPtr<IProgress> &pProgressAsync)
     955void Appliance::i_waitForAsyncProgress(ComObjPtr<Progress> &pProgressThis,
     956                                       ComPtr<IProgress> &pProgressAsync)
    969957{
    970958    HRESULT rc;
     
    10331021}
    10341022
    1035 void Appliance::addWarning(const char* aWarning, ...)
     1023void Appliance::i_addWarning(const char* aWarning, ...)
    10361024{
    10371025    va_list args;
     
    10461034 * Requires that virtual system descriptions are present.
    10471035 */
    1048 void Appliance::disksWeight()
     1036void Appliance::i_disksWeight()
    10491037{
    10501038    m->ulTotalDisksMB = 0;
     
    10581046        ComObjPtr<VirtualSystemDescription> vsdescThis = (*it);
    10591047        /* One for every hard disk of the Virtual System */
    1060         std::list<VirtualSystemDescriptionEntry*> avsdeHDs = vsdescThis->findByType(VirtualSystemDescriptionType_HardDiskImage);
     1048        std::list<VirtualSystemDescriptionEntry*> avsdeHDs = vsdescThis->i_findByType(VirtualSystemDescriptionType_HardDiskImage);
    10611049        std::list<VirtualSystemDescriptionEntry*>::const_iterator itH;
    10621050        for (itH = avsdeHDs.begin();
     
    10691057        }
    10701058
    1071         avsdeHDs = vsdescThis->findByType(VirtualSystemDescriptionType_CDROM);
     1059        avsdeHDs = vsdescThis->i_findByType(VirtualSystemDescriptionType_CDROM);
    10721060        for (itH = avsdeHDs.begin();
    10731061             itH != avsdeHDs.end();
     
    10821070}
    10831071
    1084 void Appliance::parseBucket(Utf8Str &aPath, Utf8Str &aBucket)
     1072void Appliance::i_parseBucket(Utf8Str &aPath, Utf8Str &aBucket)
    10851073{
    10861074    /* Buckets are S3 specific. So parse the bucket out of the file path */
     
    11061094int Appliance::TaskOVF::startThread()
    11071095{
    1108     int vrc = RTThreadCreate(NULL, Appliance::taskThreadImportOrExport, this,
     1096    int vrc = RTThreadCreate(NULL, Appliance::i_taskThreadImportOrExport, this,
    11091097                             0, RTTHREADTYPE_MAIN_HEAVY_WORKER, 0,
    11101098                             "Appliance::Task");
    11111099
    11121100    if (RT_FAILURE(vrc))
    1113         return Appliance::setErrorStatic(E_FAIL,
     1101        return Appliance::i_setErrorStatic(E_FAIL,
    11141102                                         Utf8StrFmt("Could not create OVF task thread (%Rrc)\n", vrc));
    11151103
     
    11271115 */
    11281116/* static */
    1129 DECLCALLBACK(int) Appliance::taskThreadImportOrExport(RTTHREAD /* aThread */, void *pvUser)
     1117DECLCALLBACK(int) Appliance::i_taskThreadImportOrExport(RTTHREAD /* aThread */, void *pvUser)
    11301118{
    11311119    std::auto_ptr<TaskOVF> task(static_cast<TaskOVF*>(pvUser));
     
    11431131        case TaskOVF::Read:
    11441132            if (task->locInfo.storageType == VFSType_File)
    1145                 taskrc = pAppliance->readFS(task.get());
     1133                taskrc = pAppliance->i_readFS(task.get());
    11461134            else if (task->locInfo.storageType == VFSType_S3)
    11471135#ifdef VBOX_WITH_S3
    1148                 taskrc = pAppliance->readS3(task.get());
     1136                taskrc = pAppliance->i_readS3(task.get());
    11491137#else
    11501138                taskrc = VERR_NOT_IMPLEMENTED;
     
    11541142        case TaskOVF::Import:
    11551143            if (task->locInfo.storageType == VFSType_File)
    1156                 taskrc = pAppliance->importFS(task.get());
     1144                taskrc = pAppliance->i_importFS(task.get());
    11571145            else if (task->locInfo.storageType == VFSType_S3)
    11581146#ifdef VBOX_WITH_S3
    1159                 taskrc = pAppliance->importS3(task.get());
     1147                taskrc = pAppliance->i_importS3(task.get());
    11601148#else
    11611149                taskrc = VERR_NOT_IMPLEMENTED;
     
    11651153        case TaskOVF::Write:
    11661154            if (task->locInfo.storageType == VFSType_File)
    1167                 taskrc = pAppliance->writeFS(task.get());
     1155                taskrc = pAppliance->i_writeFS(task.get());
    11681156            else if (task->locInfo.storageType == VFSType_S3)
    11691157#ifdef VBOX_WITH_S3
    1170                 taskrc = pAppliance->writeS3(task.get());
     1158                taskrc = pAppliance->i_writeS3(task.get());
    11711159#else
    11721160                taskrc = VERR_NOT_IMPLEMENTED;
     
    12021190}
    12031191
    1204 void parseURI(Utf8Str strUri, LocationInfo &locInfo)
     1192void i_parseURI(Utf8Str strUri, LocationInfo &locInfo)
    12051193{
    12061194    /* Check the URI for the protocol */
     
    12551243////////////////////////////////////////////////////////////////////////////////
    12561244
    1257 DEFINE_EMPTY_CTOR_DTOR(VirtualSystemDescription)
    12581245
    12591246/**
     
    12991286 * @return
    13001287 */
    1301 STDMETHODIMP VirtualSystemDescription::COMGETTER(Count)(ULONG *aCount)
     1288HRESULT VirtualSystemDescription::getCount(ULONG *aCount)
    13021289{
    13031290    if (!aCount)
    13041291        return E_POINTER;
    13051292
    1306     AutoCaller autoCaller(this);
    1307     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    1308 
    13091293    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    13101294
    1311     *aCount = (ULONG)m->llDescriptions.size();
    1312 
     1295    *aCount = (ULONG)m->maDescriptions.size();
    13131296    return S_OK;
    13141297}
     
    13181301 * @return
    13191302 */
    1320 STDMETHODIMP VirtualSystemDescription::GetDescription(ComSafeArrayOut(VirtualSystemDescriptionType_T, aTypes),
    1321                                                       ComSafeArrayOut(BSTR, aRefs),
    1322                                                       ComSafeArrayOut(BSTR, aOrigValues),
    1323                                                       ComSafeArrayOut(BSTR, aVboxValues),
    1324                                                       ComSafeArrayOut(BSTR, aExtraConfigValues))
    1325 {
    1326     if (ComSafeArrayOutIsNull(aTypes) ||
    1327         ComSafeArrayOutIsNull(aRefs) ||
    1328         ComSafeArrayOutIsNull(aOrigValues) ||
    1329         ComSafeArrayOutIsNull(aVboxValues) ||
    1330         ComSafeArrayOutIsNull(aExtraConfigValues))
    1331         return E_POINTER;
    1332 
    1333     AutoCaller autoCaller(this);
    1334     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    1335 
     1303HRESULT VirtualSystemDescription::getDescription(std::vector<VirtualSystemDescriptionType_T> &aTypes,
     1304                                                 std::vector<com::Utf8Str> &aRefs,
     1305                                                 std::vector<com::Utf8Str> &aOVFValues,
     1306                                                 std::vector<com::Utf8Str> &aVBoxValues,
     1307                                                 std::vector<com::Utf8Str> &aExtraConfigValues)
     1308
     1309{
    13361310    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    1337 
    1338     ULONG c = (ULONG)m->llDescriptions.size();
    1339     com::SafeArray<VirtualSystemDescriptionType_T> sfaTypes(c);
    1340     com::SafeArray<BSTR> sfaRefs(c);
    1341     com::SafeArray<BSTR> sfaOrigValues(c);
    1342     com::SafeArray<BSTR> sfaVboxValues(c);
    1343     com::SafeArray<BSTR> sfaExtraConfigValues(c);
    1344 
    1345     list<VirtualSystemDescriptionEntry>::const_iterator it;
     1311    size_t c = m->maDescriptions.size();
     1312    aTypes.resize(c);
     1313    aRefs.resize(c);
     1314    aOVFValues.resize(c);
     1315    aVBoxValues.resize(c);
     1316    aExtraConfigValues.resize(c);
     1317
     1318    for (size_t i = 0; i < c; i++)
     1319    {
     1320        const VirtualSystemDescriptionEntry &vsde = m->maDescriptions[i];
     1321        aTypes[i] = vsde.type;
     1322        aRefs[i] = vsde.strRef;
     1323        aOVFValues[i] = vsde.strOvf;
     1324        aVBoxValues[i] = vsde.strVboxCurrent;
     1325        aExtraConfigValues[i] = vsde.strExtraConfigCurrent;
     1326    }
     1327    return S_OK;
     1328}
     1329
     1330/**
     1331 * Public method implementation.
     1332 * @return
     1333 */
     1334HRESULT VirtualSystemDescription::getDescriptionByType(VirtualSystemDescriptionType_T aType,
     1335                                                       std::vector<VirtualSystemDescriptionType_T> &aTypes,
     1336                                                       std::vector<com::Utf8Str> &aRefs,
     1337                                                       std::vector<com::Utf8Str> &aOVFValues,
     1338                                                       std::vector<com::Utf8Str> &aVBoxValues,
     1339                                                       std::vector<com::Utf8Str> &aExtraConfigValues)
     1340{
     1341    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     1342    std::list<VirtualSystemDescriptionEntry*> vsd = i_findByType(aType);
     1343
     1344    size_t c = vsd.size();
     1345    aTypes.resize(c);
     1346    aRefs.resize(c);
     1347    aOVFValues.resize(c);
     1348    aVBoxValues.resize(c);
     1349    aExtraConfigValues.resize(c);
     1350
    13461351    size_t i = 0;
    1347     for (it = m->llDescriptions.begin();
    1348          it != m->llDescriptions.end();
    1349          ++it, ++i)
    1350     {
    1351         const VirtualSystemDescriptionEntry &vsde = (*it);
    1352 
    1353         sfaTypes[i] = vsde.type;
    1354 
    1355         Bstr bstr = vsde.strRef;
    1356         bstr.cloneTo(&sfaRefs[i]);
    1357 
    1358         bstr = vsde.strOvf;
    1359         bstr.cloneTo(&sfaOrigValues[i]);
    1360 
    1361         bstr = vsde.strVboxCurrent;
    1362         bstr.cloneTo(&sfaVboxValues[i]);
    1363 
    1364         bstr = vsde.strExtraConfigCurrent;
    1365         bstr.cloneTo(&sfaExtraConfigValues[i]);
    1366     }
    1367 
    1368     sfaTypes.detachTo(ComSafeArrayOutArg(aTypes));
    1369     sfaRefs.detachTo(ComSafeArrayOutArg(aRefs));
    1370     sfaOrigValues.detachTo(ComSafeArrayOutArg(aOrigValues));
    1371     sfaVboxValues.detachTo(ComSafeArrayOutArg(aVboxValues));
    1372     sfaExtraConfigValues.detachTo(ComSafeArrayOutArg(aExtraConfigValues));
     1352    for (list<VirtualSystemDescriptionEntry*>::const_iterator it = vsd.begin(); it != vsd.end(); ++it, ++i)
     1353    {
     1354        const VirtualSystemDescriptionEntry *vsde = (*it);
     1355        aTypes[i] = vsde->type;
     1356        aRefs[i] = vsde->strRef;
     1357        aOVFValues[i] = vsde->strOvf;
     1358        aVBoxValues[i] = vsde->strVboxCurrent;
     1359        aExtraConfigValues[i] = vsde->strExtraConfigCurrent;
     1360    }
    13731361
    13741362    return S_OK;
     
    13791367 * @return
    13801368 */
    1381 STDMETHODIMP VirtualSystemDescription::GetDescriptionByType(VirtualSystemDescriptionType_T aType,
    1382                                                             ComSafeArrayOut(VirtualSystemDescriptionType_T, aTypes),
    1383                                                             ComSafeArrayOut(BSTR, aRefs),
    1384                                                             ComSafeArrayOut(BSTR, aOrigValues),
    1385                                                             ComSafeArrayOut(BSTR, aVboxValues),
    1386                                                             ComSafeArrayOut(BSTR, aExtraConfigValues))
    1387 {
    1388     if (ComSafeArrayOutIsNull(aTypes) ||
    1389         ComSafeArrayOutIsNull(aRefs) ||
    1390         ComSafeArrayOutIsNull(aOrigValues) ||
    1391         ComSafeArrayOutIsNull(aVboxValues) ||
    1392         ComSafeArrayOutIsNull(aExtraConfigValues))
    1393         return E_POINTER;
    1394 
    1395     AutoCaller autoCaller(this);
    1396     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    1397 
     1369HRESULT VirtualSystemDescription::getValuesByType(VirtualSystemDescriptionType_T aType,
     1370                                                  VirtualSystemDescriptionValueType_T aWhich,
     1371                                                  std::vector<com::Utf8Str> &aValues)
     1372{
    13981373    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    13991374
    1400     std::list<VirtualSystemDescriptionEntry*> vsd = findByType (aType);
    1401     ULONG c = (ULONG)vsd.size();
    1402     com::SafeArray<VirtualSystemDescriptionType_T> sfaTypes(c);
    1403     com::SafeArray<BSTR> sfaRefs(c);
    1404     com::SafeArray<BSTR> sfaOrigValues(c);
    1405     com::SafeArray<BSTR> sfaVboxValues(c);
    1406     com::SafeArray<BSTR> sfaExtraConfigValues(c);
     1375    std::list<VirtualSystemDescriptionEntry*> vsd = i_findByType (aType);
     1376    aValues.resize((ULONG)vsd.size());
    14071377
    14081378    list<VirtualSystemDescriptionEntry*>::const_iterator it;
     
    14141384        const VirtualSystemDescriptionEntry *vsde = (*it);
    14151385
    1416         sfaTypes[i] = vsde->type;
    1417 
    1418         Bstr bstr = vsde->strRef;
    1419         bstr.cloneTo(&sfaRefs[i]);
    1420 
    1421         bstr = vsde->strOvf;
    1422         bstr.cloneTo(&sfaOrigValues[i]);
    1423 
    1424         bstr = vsde->strVboxCurrent;
    1425         bstr.cloneTo(&sfaVboxValues[i]);
    1426 
    1427         bstr = vsde->strExtraConfigCurrent;
    1428         bstr.cloneTo(&sfaExtraConfigValues[i]);
    1429     }
    1430 
    1431     sfaTypes.detachTo(ComSafeArrayOutArg(aTypes));
    1432     sfaRefs.detachTo(ComSafeArrayOutArg(aRefs));
    1433     sfaOrigValues.detachTo(ComSafeArrayOutArg(aOrigValues));
    1434     sfaVboxValues.detachTo(ComSafeArrayOutArg(aVboxValues));
    1435     sfaExtraConfigValues.detachTo(ComSafeArrayOutArg(aExtraConfigValues));
    1436 
    1437     return S_OK;
    1438 }
    1439 
    1440 /**
    1441  * Public method implementation.
    1442  * @return
    1443  */
    1444 STDMETHODIMP VirtualSystemDescription::GetValuesByType(VirtualSystemDescriptionType_T aType,
    1445                                                        VirtualSystemDescriptionValueType_T aWhich,
    1446                                                        ComSafeArrayOut(BSTR, aValues))
    1447 {
    1448     if (ComSafeArrayOutIsNull(aValues))
    1449         return E_POINTER;
    1450 
    1451     AutoCaller autoCaller(this);
    1452     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    1453 
    1454     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    1455 
    1456     std::list<VirtualSystemDescriptionEntry*> vsd = findByType (aType);
    1457     com::SafeArray<BSTR> sfaValues((ULONG)vsd.size());
    1458 
    1459     list<VirtualSystemDescriptionEntry*>::const_iterator it;
    1460     size_t i = 0;
    1461     for (it = vsd.begin();
    1462          it != vsd.end();
    1463          ++it, ++i)
    1464     {
    1465         const VirtualSystemDescriptionEntry *vsde = (*it);
    1466 
    14671386        Bstr bstr;
    14681387        switch (aWhich)
    14691388        {
    1470             case VirtualSystemDescriptionValueType_Reference: bstr = vsde->strRef; break;
    1471             case VirtualSystemDescriptionValueType_Original: bstr = vsde->strOvf; break;
    1472             case VirtualSystemDescriptionValueType_Auto: bstr = vsde->strVboxCurrent; break;
    1473             case VirtualSystemDescriptionValueType_ExtraConfig: bstr = vsde->strExtraConfigCurrent; break;
     1389            case VirtualSystemDescriptionValueType_Reference: aValues[i] = vsde->strRef; break;
     1390            case VirtualSystemDescriptionValueType_Original: aValues[i] = vsde->strOvf; break;
     1391            case VirtualSystemDescriptionValueType_Auto: aValues[i] = vsde->strVboxCurrent; break;
     1392            case VirtualSystemDescriptionValueType_ExtraConfig: aValues[i] = vsde->strExtraConfigCurrent; break;
    14741393        }
    1475 
    1476         bstr.cloneTo(&sfaValues[i]);
    1477     }
    1478 
    1479     sfaValues.detachTo(ComSafeArrayOutArg(aValues));
     1394    }
    14801395
    14811396    return S_OK;
     
    14861401 * @return
    14871402 */
    1488 STDMETHODIMP VirtualSystemDescription::SetFinalValues(ComSafeArrayIn(BOOL, aEnabled),
    1489                                                       ComSafeArrayIn(IN_BSTR, argVboxValues),
    1490                                                       ComSafeArrayIn(IN_BSTR, argExtraConfigValues))
     1403HRESULT VirtualSystemDescription::setFinalValues(const std::vector<BOOL> &aEnabled,
     1404                                                 const std::vector<com::Utf8Str> &aVBoxValues,
     1405                                                 const std::vector<com::Utf8Str> &aExtraConfigValues)
    14911406{
    14921407#ifndef RT_OS_WINDOWS
    1493     NOREF(aEnabledSize);
     1408    // NOREF(aEnabledSize);
    14941409#endif /* RT_OS_WINDOWS */
    1495 
    1496     CheckComArgSafeArrayNotNull(aEnabled);
    1497     CheckComArgSafeArrayNotNull(argVboxValues);
    1498     CheckComArgSafeArrayNotNull(argExtraConfigValues);
    1499 
    1500     AutoCaller autoCaller(this);
    1501     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    1502 
    15031410    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    15041411
    1505     com::SafeArray<BOOL> sfaEnabled(ComSafeArrayInArg(aEnabled));
    1506     com::SafeArray<IN_BSTR> sfaVboxValues(ComSafeArrayInArg(argVboxValues));
    1507     com::SafeArray<IN_BSTR> sfaExtraConfigValues(ComSafeArrayInArg(argExtraConfigValues));
    1508 
    1509     if (    (sfaEnabled.size() != m->llDescriptions.size())
    1510          || (sfaVboxValues.size() != m->llDescriptions.size())
    1511          || (sfaExtraConfigValues.size() != m->llDescriptions.size())
     1412    if (    (aEnabled.size() != m->maDescriptions.size())
     1413         || (aVBoxValues.size() != m->maDescriptions.size())
     1414         || (aExtraConfigValues.size() != m->maDescriptions.size())
    15121415       )
    15131416        return E_INVALIDARG;
    15141417
    1515     list<VirtualSystemDescriptionEntry>::iterator it;
    15161418    size_t i = 0;
    1517     for (it = m->llDescriptions.begin();
    1518          it != m->llDescriptions.end();
     1419    for (vector<VirtualSystemDescriptionEntry>::iterator it = m->maDescriptions.begin();
     1420         it != m->maDescriptions.end();
    15191421         ++it, ++i)
    15201422    {
    15211423        VirtualSystemDescriptionEntry& vsde = *it;
    15221424
    1523         if (sfaEnabled[i])
     1425        if (aEnabled[i])
    15241426        {
    1525             vsde.strVboxCurrent = sfaVboxValues[i];
    1526             vsde.strExtraConfigCurrent = sfaExtraConfigValues[i];
     1427            vsde.strVboxCurrent = aVBoxValues[i];
     1428            vsde.strExtraConfigCurrent = aExtraConfigValues[i];
    15271429        }
    15281430        else
     
    15371439 * @return
    15381440 */
    1539 STDMETHODIMP VirtualSystemDescription::AddDescription(VirtualSystemDescriptionType_T aType,
    1540                                                       IN_BSTR aVboxValue,
    1541                                                       IN_BSTR aExtraConfigValue)
    1542 {
    1543     AutoCaller autoCaller(this);
    1544     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    1545 
     1441HRESULT VirtualSystemDescription::addDescription(VirtualSystemDescriptionType_T aType,
     1442                                                 const com::Utf8Str &aVBoxValue,
     1443                                                 const com::Utf8Str &aExtraConfigValue)
     1444
     1445{
    15461446    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    1547 
    1548     addEntry(aType, "", aVboxValue, aVboxValue, 0, aExtraConfigValue);
    1549 
     1447    i_addEntry(aType, "", aVBoxValue, aVBoxValue, 0, aExtraConfigValue);
    15501448    return S_OK;
    15511449}
     
    15601458 * @param strExtraConfig Extra configuration; meaning dependent on type.
    15611459 */
    1562 void VirtualSystemDescription::addEntry(VirtualSystemDescriptionType_T aType,
    1563                                         const Utf8Str &strRef,
    1564                                         const Utf8Str &aOvfValue,
    1565                                         const Utf8Str &aVboxValue,
    1566                                         uint32_t ulSizeMB,
    1567                                         const Utf8Str &strExtraConfig /*= ""*/)
     1460void VirtualSystemDescription::i_addEntry(VirtualSystemDescriptionType_T aType,
     1461                                          const Utf8Str &strRef,
     1462                                          const Utf8Str &aOvfValue,
     1463                                          const Utf8Str &aVboxValue,
     1464                                          uint32_t ulSizeMB,
     1465                                          const Utf8Str &strExtraConfig /*= ""*/)
    15681466{
    15691467    VirtualSystemDescriptionEntry vsde;
    1570     vsde.ulIndex = (uint32_t)m->llDescriptions.size();      // each entry gets an index so the client side can reference them
     1468    vsde.ulIndex = (uint32_t)m->maDescriptions.size();      // each entry gets an index so the client side can reference them
    15711469    vsde.type = aType;
    15721470    vsde.strRef = strRef;
     
    15801478    vsde.ulSizeMB = ulSizeMB;
    15811479
    1582     m->llDescriptions.push_back(vsde);
     1480    m->maDescriptions.push_back(vsde);
    15831481}
    15841482
     
    15891487 * @return
    15901488 */
    1591 std::list<VirtualSystemDescriptionEntry*> VirtualSystemDescription::findByType(VirtualSystemDescriptionType_T aType)
     1489std::list<VirtualSystemDescriptionEntry*> VirtualSystemDescription::i_findByType(VirtualSystemDescriptionType_T aType)
    15921490{
    15931491    std::list<VirtualSystemDescriptionEntry*> vsd;
    1594 
    1595     list<VirtualSystemDescriptionEntry>::iterator it;
    1596     for (it = m->llDescriptions.begin();
    1597          it != m->llDescriptions.end();
     1492    for (vector<VirtualSystemDescriptionEntry>::iterator it = m->maDescriptions.begin();
     1493         it != m->maDescriptions.end();
    15981494         ++it)
    15991495    {
     
    16051501}
    16061502
    1607 /**
    1608  * Private method; delete all records from the list
     1503/* Private method; delete all records from the list
    16091504 * m->llDescriptions that match the given type.
    16101505 * @param aType
    16111506 * @return
    16121507 */
    1613 void VirtualSystemDescription::removeByType(VirtualSystemDescriptionType_T aType)
    1614 {
    1615     std::list<VirtualSystemDescriptionEntry*> vsd;
    1616 
    1617     list<VirtualSystemDescriptionEntry>::iterator it = m->llDescriptions.begin();
    1618     while (it != m->llDescriptions.end())
     1508void VirtualSystemDescription::i_removeByType(VirtualSystemDescriptionType_T aType)
     1509{
     1510    for (std::vector<VirtualSystemDescriptionEntry>::iterator it = m->maDescriptions.begin();  it != m->maDescriptions.end(); ++it)
    16191511    {
    16201512        if (it->type == aType)
    1621             it = m->llDescriptions.erase(it);
    1622         else
    1623             ++it;
     1513            it = m->maDescriptions.erase(it);
    16241514    }
    16251515}
     
    16321522 * @return
    16331523 */
    1634 const VirtualSystemDescriptionEntry* VirtualSystemDescription::findControllerFromID(uint32_t id)
     1524const VirtualSystemDescriptionEntry* VirtualSystemDescription::i_findControllerFromID(uint32_t id)
    16351525{
    16361526    Utf8Str strRef = Utf8StrFmt("%RI32", id);
    1637     list<VirtualSystemDescriptionEntry>::const_iterator it;
    1638     for (it = m->llDescriptions.begin();
    1639          it != m->llDescriptions.end();
     1527    vector<VirtualSystemDescriptionEntry>::const_iterator it;
     1528    for (it = m->maDescriptions.begin();
     1529         it != m->maDescriptions.end();
    16401530         ++it)
    16411531    {
     
    16691559 *                  DOM tree.
    16701560 */
    1671 void VirtualSystemDescription::importVboxMachineXML(const xml::ElementNode &elmMachine)
     1561void VirtualSystemDescription::i_importVboxMachineXML(const xml::ElementNode &elmMachine)
    16721562{
    16731563    settings::MachineConfigFile *pConfig = NULL;
     
    16941584 * @return
    16951585 */
    1696 const settings::MachineConfigFile* VirtualSystemDescription::getMachineConfig() const
     1586const settings::MachineConfigFile* VirtualSystemDescription::i_getMachineConfig() const
    16971587{
    16981588    return m->pConfig;
  • trunk/src/VBox/Main/src-server/ApplianceImplExport.cpp

    r49586 r49742  
    7777
    7878        LocationInfo locInfo;
    79         parseURI(location, locInfo);
     79        i_parseURI(location, locInfo);
    8080        // create a new virtual system to store in the appliance
    8181        rc = pNewDesc.createObject();
     
    143143        /* Guest OS type */
    144144        ovf::CIMOSType_T cim = convertVBoxOSType2CIMOSType(strOsTypeVBox.c_str(), fLongMode);
    145         pNewDesc->addEntry(VirtualSystemDescriptionType_OS,
    146                            "",
    147                            Utf8StrFmt("%RI32", cim),
    148                            strOsTypeVBox);
     145        pNewDesc->i_addEntry(VirtualSystemDescriptionType_OS,
     146                             "",
     147                             Utf8StrFmt("%RI32", cim),
     148                             strOsTypeVBox);
    149149
    150150        /* VM name */
    151         pNewDesc->addEntry(VirtualSystemDescriptionType_Name,
    152                            "",
    153                            strVMName,
    154                            strVMName);
     151        pNewDesc->i_addEntry(VirtualSystemDescriptionType_Name,
     152                             "",
     153                             strVMName,
     154                             strVMName);
    155155
    156156        // description
    157         pNewDesc->addEntry(VirtualSystemDescriptionType_Description,
    158                            "",
    159                            strDescription,
    160                            strDescription);
     157        pNewDesc->i_addEntry(VirtualSystemDescriptionType_Description,
     158                             "",
     159                             strDescription,
     160                             strDescription);
    161161
    162162        /* CPU count*/
    163163        Utf8Str strCpuCount = Utf8StrFmt("%RI32", cCPUs);
    164         pNewDesc->addEntry(VirtualSystemDescriptionType_CPU,
    165                            "",
    166                            strCpuCount,
    167                            strCpuCount);
     164        pNewDesc->i_addEntry(VirtualSystemDescriptionType_CPU,
     165                             "",
     166                             strCpuCount,
     167                             strCpuCount);
    168168
    169169        /* Memory */
    170170        Utf8Str strMemory = Utf8StrFmt("%RI64", (uint64_t)ulMemSizeMB * _1M);
    171         pNewDesc->addEntry(VirtualSystemDescriptionType_Memory,
    172                            "",
    173                            strMemory,
    174                            strMemory);
     171        pNewDesc->i_addEntry(VirtualSystemDescriptionType_Memory,
     172                             "",
     173                             strMemory,
     174                             strMemory);
    175175
    176176        // the one VirtualBox IDE controller has two channels with two ports each, which is
     
    225225            if (strVbox.length())
    226226            {
    227                 lIDEControllerPrimaryIndex = (int32_t)pNewDesc->m->llDescriptions.size();
    228                 pNewDesc->addEntry(VirtualSystemDescriptionType_HardDiskControllerIDE,
    229                                    Utf8StrFmt("%d", lIDEControllerPrimaryIndex),        // strRef
    230                                    strVbox,     // aOvfValue
    231                                    strVbox);    // aVboxValue
     227                lIDEControllerPrimaryIndex = (int32_t)pNewDesc->m->maDescriptions.size();
     228                pNewDesc->i_addEntry(VirtualSystemDescriptionType_HardDiskControllerIDE,
     229                                     Utf8StrFmt("%d", lIDEControllerPrimaryIndex),        // strRef
     230                                     strVbox,     // aOvfValue
     231                                     strVbox);    // aVboxValue
    232232                lIDEControllerSecondaryIndex = lIDEControllerPrimaryIndex + 1;
    233                 pNewDesc->addEntry(VirtualSystemDescriptionType_HardDiskControllerIDE,
    234                                    Utf8StrFmt("%d", lIDEControllerSecondaryIndex),
    235                                    strVbox,
    236                                    strVbox);
     233                pNewDesc->i_addEntry(VirtualSystemDescriptionType_HardDiskControllerIDE,
     234                                     Utf8StrFmt("%d", lIDEControllerSecondaryIndex),
     235                                     strVbox,
     236                                     strVbox);
    237237            }
    238238        }
     
    242242        {
    243243            Utf8Str strVbox = "AHCI";
    244             lSATAControllerIndex = (int32_t)pNewDesc->m->llDescriptions.size();
    245             pNewDesc->addEntry(VirtualSystemDescriptionType_HardDiskControllerSATA,
    246                                Utf8StrFmt("%d", lSATAControllerIndex),
    247                                strVbox,
    248                                strVbox);
     244            lSATAControllerIndex = (int32_t)pNewDesc->m->maDescriptions.size();
     245            pNewDesc->i_addEntry(VirtualSystemDescriptionType_HardDiskControllerSATA,
     246                                 Utf8StrFmt("%d", lSATAControllerIndex),
     247                                 strVbox,
     248                                 strVbox);
    249249        }
    250250
     
    262262                    case StorageControllerType_BusLogic: strVbox = "BusLogic"; break;
    263263                }
    264                 lSCSIControllerIndex = (int32_t)pNewDesc->m->llDescriptions.size();
    265                 pNewDesc->addEntry(VirtualSystemDescriptionType_HardDiskControllerSCSI,
    266                                    Utf8StrFmt("%d", lSCSIControllerIndex),
    267                                    strVbox,
    268                                    strVbox);
     264                lSCSIControllerIndex = (int32_t)pNewDesc->m->maDescriptions.size();
     265                pNewDesc->i_addEntry(VirtualSystemDescriptionType_HardDiskControllerSCSI,
     266                                     Utf8StrFmt("%d", lSCSIControllerIndex),
     267                                     strVbox,
     268                                     strVbox);
    269269            }
    270270            else
     
    277277            // it should be a SCSI controller
    278278            Utf8Str strVbox = "LsiLogicSas";
    279             lSCSIControllerIndex = (int32_t)pNewDesc->m->llDescriptions.size();
    280             pNewDesc->addEntry(VirtualSystemDescriptionType_HardDiskControllerSAS,
    281                                Utf8StrFmt("%d", lSCSIControllerIndex),
    282                                strVbox,
    283                                strVbox);
     279            lSCSIControllerIndex = (int32_t)pNewDesc->m->maDescriptions.size();
     280            pNewDesc->i_addEntry(VirtualSystemDescriptionType_HardDiskControllerSAS,
     281                                 Utf8StrFmt("%d", lSCSIControllerIndex),
     282                                 strVbox,
     283                                 strVbox);
    284284        }
    285285
     
    478478                case DeviceType_HardDisk:
    479479                    Log(("Adding VirtualSystemDescriptionType_HardDiskImage, disk size: %RI64\n", llSize));
    480                     pNewDesc->addEntry(VirtualSystemDescriptionType_HardDiskImage,
    481                                        strTargetImageName,   // disk ID: let's use the name
    482                                        strTargetImageName,   // OVF value:
    483                                        strLocation, // vbox value: media path
    484                                        (uint32_t)(llSize / _1M),
    485                                        strExtra);
     480                    pNewDesc->i_addEntry(VirtualSystemDescriptionType_HardDiskImage,
     481                                         strTargetImageName,   // disk ID: let's use the name
     482                                         strTargetImageName,   // OVF value:
     483                                         strLocation, // vbox value: media path
     484                                        (uint32_t)(llSize / _1M),
     485                                         strExtra);
    486486                break;
    487487
    488488                case DeviceType_DVD:
    489489                    Log(("Adding VirtualSystemDescriptionType_CDROM, disk size: %RI64\n", llSize));
    490                     pNewDesc->addEntry(VirtualSystemDescriptionType_CDROM,
    491                                        strTargetImageName,   // disk ID
    492                                        strTargetImageName,   // OVF value
    493                                        strLocation, // vbox value
    494                                        (uint32_t)(llSize / _1M),// ulSize
    495                                        strExtra);
     490                    pNewDesc->i_addEntry(VirtualSystemDescriptionType_CDROM,
     491                                         strTargetImageName,   // disk ID
     492                                         strTargetImageName,   // OVF value
     493                                         strLocation, // vbox value
     494                                         (uint32_t)(llSize / _1M),// ulSize
     495                                         strExtra);
    496496                break;
    497497
    498498                case DeviceType_Floppy:
    499                     pNewDesc->addEntry(VirtualSystemDescriptionType_Floppy,
    500                                        strEmpty,      // disk ID
    501                                        strEmpty,      // OVF value
    502                                        strEmpty,      // vbox value
    503                                        1,       // ulSize
    504                                        strExtra);
     499                    pNewDesc->i_addEntry(VirtualSystemDescriptionType_Floppy,
     500                                         strEmpty,      // disk ID
     501                                         strEmpty,      // OVF value
     502                                         strEmpty,      // vbox value
     503                                         1,       // ulSize
     504                                         strExtra);
    505505                break;
    506506            }
     
    532532
    533533                Utf8Str strAttachmentType = convertNetworkAttachmentTypeToString(attachmentType);
    534                 pNewDesc->addEntry(VirtualSystemDescriptionType_NetworkAdapter,
     534                pNewDesc->i_addEntry(VirtualSystemDescriptionType_NetworkAdapter,
    535535                                   "",      // ref
    536536                                   strAttachmentType,      // orig
     
    544544#ifdef VBOX_WITH_USB
    545545        if (fUSBEnabled)
    546             pNewDesc->addEntry(VirtualSystemDescriptionType_USBController, "", "", "");
     546            pNewDesc->i_addEntry(VirtualSystemDescriptionType_USBController, "", "", "");
    547547#endif /* VBOX_WITH_USB */
    548548
    549549//     <const name="SoundCard"  />
    550550        if (fAudioEnabled)
    551             pNewDesc->addEntry(VirtualSystemDescriptionType_SoundCard,
    552                                "",
    553                                "ensoniq1371",       // this is what OVFTool writes and VMware supports
    554                                Utf8StrFmt("%RI32", audioController));
     551            pNewDesc->i_addEntry(VirtualSystemDescriptionType_SoundCard,
     552                                 "",
     553                                 "ensoniq1371",       // this is what OVFTool writes and VMware supports
     554                                 Utf8StrFmt("%RI32", audioController));
    555555
    556556        /* We return the new description to the caller */
     
    584584 * @return
    585585 */
    586 STDMETHODIMP Appliance::Write(IN_BSTR format, ComSafeArrayIn(ImportOptions_T, options), IN_BSTR path, IProgress **aProgress)
     586HRESULT Appliance::write(const com::Utf8Str &aFormat,
     587                         const std::vector<ExportOptions_T> &aOptions,
     588                         const com::Utf8Str &aPath,
     589                         ComPtr<IProgress> &aProgress)
    587590{
    588     if (!path) return E_POINTER;
    589     CheckComArgOutPointerValid(aProgress);
    590 
    591     AutoCaller autoCaller(this);
    592     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    593 
    594591    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    595592
    596     if (options != NULL)
    597         m->optListExport = com::SafeArray<ExportOptions_T>(ComSafeArrayInArg(options)).toList();
    598 
    599 //    AssertReturn(!(m->optListExport.contains(ExportOptions_CreateManifest) && m->optListExport.contains(ExportOptions_ExportDVDImages)), E_INVALIDARG);
     593    m->optListExport.clear();
     594    if (aOptions.size())
     595    {
     596        for (size_t i = 0; i < aOptions.size(); ++i)
     597        {
     598            m->optListExport.insert(i, aOptions[i]);
     599        }
     600    }
     601
     602//  AssertReturn(!(m->optListExport.contains(ExportOptions_CreateManifest) && m->optListExport.contains(ExportOptions_ExportDVDImages)), E_INVALIDARG);
    600603
    601604    m->fExportISOImages = m->optListExport.contains(ExportOptions_ExportDVDImages);
     
    609612        {
    610613            ComObjPtr<VirtualSystemDescription> vsdescThis = (*it);
    611             vsdescThis->removeByType(VirtualSystemDescriptionType_CDROM);
     614            vsdescThis->i_removeByType(VirtualSystemDescriptionType_CDROM);
    612615        }
    613616    }
    614617
    615618    // do not allow entering this method if the appliance is busy reading or writing
    616     if (!isApplianceIdle())
     619    if (!i_isApplianceIdle())
    617620        return E_ACCESSDENIED;
    618621
    619622    // see if we can handle this file; for now we insist it has an ".ovf" extension
    620     Utf8Str strPath = path;
    621     if (!(   strPath.endsWith(".ovf", Utf8Str::CaseInsensitive)
    622           || strPath.endsWith(".ova", Utf8Str::CaseInsensitive)))
     623    if (!(   aPath.endsWith(".ovf", Utf8Str::CaseInsensitive)
     624          || aPath.endsWith(".ova", Utf8Str::CaseInsensitive)))
    623625        return setError(VBOX_E_FILE_ERROR,
    624626                        tr("Appliance file must have .ovf or .ova extension"));
    625627
    626628    m->fManifest = m->optListExport.contains(ExportOptions_CreateManifest);
    627     Utf8Str strFormat(format);
    628629
    629630    ovf::OVFVersion_T ovfF;
    630     if (strFormat == "ovf-0.9")
     631    if (aFormat == "ovf-0.9")
    631632    {
    632633        ovfF = ovf::OVFVersion_0_9;
    633634    }
    634     else if (strFormat == "ovf-1.0")
     635    else if (aFormat == "ovf-1.0")
    635636    {
    636637        ovfF = ovf::OVFVersion_1_0;
    637638    }
    638     else if (strFormat == "ovf-2.0")
     639    else if (aFormat == "ovf-2.0")
    639640    {
    640641        ovfF = ovf::OVFVersion_2_0;
     
    642643    else
    643644        return setError(VBOX_E_FILE_ERROR,
    644                         tr("Invalid format \"%s\" specified"), strFormat.c_str());
     645                        tr("Invalid format \"%s\" specified"), aFormat.c_str());
    645646
    646647    /* as of OVF 2.0 we have to use SHA256 */
     
    652653    {
    653654        /* Parse all necessary info out of the URI */
    654         parseURI(strPath, m->locInfo);
    655         rc = writeImpl(ovfF, m->locInfo, progress);
     655        i_parseURI(aPath, m->locInfo);
     656        rc = i_writeImpl(ovfF, m->locInfo, progress);
    656657    }
    657658    catch (HRESULT aRC)
     
    662663    if (SUCCEEDED(rc))
    663664        /* Return progress to the caller */
    664         progress.queryInterfaceTo(aProgress);
     665        progress.queryInterfaceTo(aProgress.asOutParam());
    665666
    666667    return rc;
     
    685686 * 1) from the public Appliance::Write().
    686687 *
    687  * 2) in a second worker thread; in that case, Appliance::Write() called Appliance::writeImpl(), which
    688  *    called Appliance::writeFSOVA(), which called Appliance::writeImpl(), which then called this again.
     688 * 2) in a second worker thread; in that case, Appliance::Write() called Appliance::i_writeImpl(), which
     689 *    called Appliance::i_writeFSOVA(), which called Appliance::i_writeImpl(), which then called this again.
    689690 *
    690  * 3) from Appliance::writeS3(), which got called from a previous instance of Appliance::taskThreadWriteOVF().
     691 * 3) from Appliance::i_writeS3(), which got called from a previous instance of Appliance::taskThreadWriteOVF().
    691692 *
    692693 * @param aFormat
     
    695696 * @return
    696697 */
    697 HRESULT Appliance::writeImpl(ovf::OVFVersion_T aFormat, const LocationInfo &aLocInfo, ComObjPtr<Progress> &aProgress)
     698HRESULT Appliance::i_writeImpl(ovf::OVFVersion_T aFormat, const LocationInfo &aLocInfo, ComObjPtr<Progress> &aProgress)
    698699{
    699700    HRESULT rc = S_OK;
    700701    try
    701702    {
    702         rc = setUpProgress(aProgress,
    703                            BstrFmt(tr("Export appliance '%s'"), aLocInfo.strPath.c_str()),
    704                            (aLocInfo.storageType == VFSType_File) ? WriteFile : WriteS3);
     703        rc = i_setUpProgress(aProgress,
     704                             BstrFmt(tr("Export appliance '%s'"), aLocInfo.strPath.c_str()),
     705                             (aLocInfo.storageType == VFSType_File) ? WriteFile : WriteS3);
    705706
    706707        /* Initialize our worker task */
     
    724725
    725726/**
    726  * Called from Appliance::writeFS() for creating a XML document for this
     727 * Called from Appliance::i_writeFS() for creating a XML document for this
    727728 * Appliance.
    728729 *
     
    735736 * @param enFormat                           OVF format (0.9 or 1.0).
    736737 */
    737 void Appliance::buildXML(AutoWriteLockBase& writeLock,
    738                          xml::Document &doc,
    739                          XMLStack &stack,
    740                          const Utf8Str &strPath,
    741                          ovf::OVFVersion_T enFormat)
     738void Appliance::i_buildXML(AutoWriteLockBase& writeLock,
     739                           xml::Document &doc,
     740                           XMLStack &stack,
     741                           const Utf8Str &strPath,
     742                           ovf::OVFVersion_T enFormat)
    742743{
    743744    xml::ElementNode *pelmRoot = doc.createRootElement("Envelope");
     
    851852    {
    852853        ComObjPtr<VirtualSystemDescription> vsdescThis = *it;
    853         buildXMLForOneVirtualSystem(writeLock,
    854                                     *pelmToAddVirtualSystemsTo,
    855                                     &llElementsWithUuidAttributes,
    856                                     vsdescThis,
    857                                     enFormat,
    858                                     stack);         // disks and networks stack
     854        i_buildXMLForOneVirtualSystem(writeLock,
     855                                      *pelmToAddVirtualSystemsTo,
     856                                      &llElementsWithUuidAttributes,
     857                                      vsdescThis,
     858                                      enFormat,
     859                                      stack);         // disks and networks stack
    859860    }
    860861
     
    10101011
    10111012/**
    1012  * Called from Appliance::buildXML() for each virtual system (machine) that
     1013 * Called from Appliance::i_buildXML() for each virtual system (machine) that
    10131014 * needs XML written out.
    10141015 *
     
    10241025 *                                           data shared with caller.
    10251026 */
    1026 void Appliance::buildXMLForOneVirtualSystem(AutoWriteLockBase& writeLock,
    1027                                             xml::ElementNode &elmToAddVirtualSystemsTo,
    1028                                             std::list<xml::ElementNode*> *pllElementsWithUuidAttributes,
    1029                                             ComObjPtr<VirtualSystemDescription> &vsdescThis,
    1030                                             ovf::OVFVersion_T enFormat,
    1031                                             XMLStack &stack)
     1027void Appliance::i_buildXMLForOneVirtualSystem(AutoWriteLockBase& writeLock,
     1028                                              xml::ElementNode &elmToAddVirtualSystemsTo,
     1029                                              std::list<xml::ElementNode*> *pllElementsWithUuidAttributes,
     1030                                              ComObjPtr<VirtualSystemDescription> &vsdescThis,
     1031                                              ovf::OVFVersion_T enFormat,
     1032                                              XMLStack &stack)
    10321033{
    10331034    LogFlowFunc(("ENTER appliance %p\n", this));
     
    10451046    /*xml::ElementNode *pelmVirtualSystemInfo =*/ pelmVirtualSystem->createChild("Info")->addContent("A virtual machine");
    10461047
    1047     std::list<VirtualSystemDescriptionEntry*> llName = vsdescThis->findByType(VirtualSystemDescriptionType_Name);
     1048    std::list<VirtualSystemDescriptionEntry*> llName = vsdescThis->i_findByType(VirtualSystemDescriptionType_Name);
    10481049    if (!llName.size())
    10491050        throw setError(VBOX_E_NOT_SUPPORTED, tr("Missing VM name"));
     
    10521053
    10531054    // product info
    1054     std::list<VirtualSystemDescriptionEntry*> llProduct = vsdescThis->findByType(VirtualSystemDescriptionType_Product);
    1055     std::list<VirtualSystemDescriptionEntry*> llProductUrl = vsdescThis->findByType(VirtualSystemDescriptionType_ProductUrl);
    1056     std::list<VirtualSystemDescriptionEntry*> llVendor = vsdescThis->findByType(VirtualSystemDescriptionType_Vendor);
    1057     std::list<VirtualSystemDescriptionEntry*> llVendorUrl = vsdescThis->findByType(VirtualSystemDescriptionType_VendorUrl);
    1058     std::list<VirtualSystemDescriptionEntry*> llVersion = vsdescThis->findByType(VirtualSystemDescriptionType_Version);
     1055    std::list<VirtualSystemDescriptionEntry*> llProduct = vsdescThis->i_findByType(VirtualSystemDescriptionType_Product);
     1056    std::list<VirtualSystemDescriptionEntry*> llProductUrl = vsdescThis->i_findByType(VirtualSystemDescriptionType_ProductUrl);
     1057    std::list<VirtualSystemDescriptionEntry*> llVendor = vsdescThis->i_findByType(VirtualSystemDescriptionType_Vendor);
     1058    std::list<VirtualSystemDescriptionEntry*> llVendorUrl = vsdescThis->i_findByType(VirtualSystemDescriptionType_VendorUrl);
     1059    std::list<VirtualSystemDescriptionEntry*> llVersion = vsdescThis->i_findByType(VirtualSystemDescriptionType_Version);
    10591060    bool fProduct = llProduct.size() && !llProduct.back()->strVboxCurrent.isEmpty();
    10601061    bool fProductUrl = llProductUrl.size() && !llProductUrl.back()->strVboxCurrent.isEmpty();
     
    11001101
    11011102    // description
    1102     std::list<VirtualSystemDescriptionEntry*> llDescription = vsdescThis->findByType(VirtualSystemDescriptionType_Description);
     1103    std::list<VirtualSystemDescriptionEntry*> llDescription = vsdescThis->i_findByType(VirtualSystemDescriptionType_Description);
    11031104    if (llDescription.size() &&
    11041105        !llDescription.back()->strVboxCurrent.isEmpty())
     
    11231124
    11241125    // license
    1125     std::list<VirtualSystemDescriptionEntry*> llLicense = vsdescThis->findByType(VirtualSystemDescriptionType_License);
     1126    std::list<VirtualSystemDescriptionEntry*> llLicense = vsdescThis->i_findByType(VirtualSystemDescriptionType_License);
    11261127    if (llLicense.size() &&
    11271128        !llLicense.back()->strVboxCurrent.isEmpty())
     
    11451146
    11461147    // operating system
    1147     std::list<VirtualSystemDescriptionEntry*> llOS = vsdescThis->findByType(VirtualSystemDescriptionType_OS);
     1148    std::list<VirtualSystemDescriptionEntry*> llOS = vsdescThis->i_findByType(VirtualSystemDescriptionType_OS);
    11481149    if (!llOS.size())
    11491150        throw setError(VBOX_E_NOT_SUPPORTED, tr("Missing OS type"));
     
    12331234    {
    12341235        int32_t lIndexThis = 0;
    1235         list<VirtualSystemDescriptionEntry>::const_iterator itD;
    1236         for (itD = vsdescThis->m->llDescriptions.begin();
    1237             itD != vsdescThis->m->llDescriptions.end();
     1236        vector<VirtualSystemDescriptionEntry>::const_iterator itD;
     1237        for (itD = vsdescThis->m->maDescriptions.begin();
     1238            itD != vsdescThis->m->maDescriptions.end();
    12381239            ++itD, ++lIndexThis)
    12391240        {
     
    18501851 * and therefore runs on the OVF/OVA write worker thread. This runs in two contexts:
    18511852 *
    1852  * 1) in a first worker thread; in that case, Appliance::Write() called Appliance::writeImpl();
     1853 * 1) in a first worker thread; in that case, Appliance::Write() called Appliance::i_writeImpl();
    18531854 *
    1854  * 2) in a second worker thread; in that case, Appliance::Write() called Appliance::writeImpl(), which
    1855  *    called Appliance::writeS3(), which called Appliance::writeImpl(), which then called this. In other
     1855 * 2) in a second worker thread; in that case, Appliance::Write() called Appliance::i_writeImpl(), which
     1856 *    called Appliance::i_writeS3(), which called Appliance::i_writeImpl(), which then called this. In other
    18561857 *    words, to write to the cloud, the first worker thread first starts a second worker thread to create
    18571858 *    temporary files and then uploads them to the S3 cloud server.
     
    18601861 * @return
    18611862 */
    1862 HRESULT Appliance::writeFS(TaskOVF *pTask)
     1863HRESULT Appliance::i_writeFS(TaskOVF *pTask)
    18631864{
    18641865    LogFlowFuncEnter();
     
    18791880
    18801881    if (pTask->locInfo.strPath.endsWith(".ovf", Utf8Str::CaseInsensitive))
    1881         rc = writeFSOVF(pTask, multiLock);
     1882        rc = i_writeFSOVF(pTask, multiLock);
    18821883    else
    1883         rc = writeFSOVA(pTask, multiLock);
     1884        rc = i_writeFSOVA(pTask, multiLock);
    18841885
    18851886    // reset the state so others can call methods again
     
    18911892}
    18921893
    1893 HRESULT Appliance::writeFSOVF(TaskOVF *pTask, AutoWriteLockBase& writeLock)
     1894HRESULT Appliance::i_writeFSOVF(TaskOVF *pTask, AutoWriteLockBase& writeLock)
    18941895{
    18951896    LogFlowFuncEnter();
     
    19201921
    19211922
    1922         Utf8Str name = applianceIOName(applianceIOFile);
     1923        Utf8Str name = i_applianceIOName(applianceIOFile);
    19231924
    19241925        int vrc = VDInterfaceAdd(&pFileIo->Core, name.c_str(),
     
    19301931            break;
    19311932        }
    1932         rc = writeFSImpl(pTask, writeLock, pShaIo, &storage);
     1933        rc = i_writeFSImpl(pTask, writeLock, pShaIo, &storage);
    19331934    } while (0);
    19341935
     
    19431944}
    19441945
    1945 HRESULT Appliance::writeFSOVA(TaskOVF *pTask, AutoWriteLockBase& writeLock)
     1946HRESULT Appliance::i_writeFSOVA(TaskOVF *pTask, AutoWriteLockBase& writeLock)
    19461947{
    19471948    LogFlowFuncEnter();
     
    19771978        storage.fSha256 = m->fSha256;
    19781979
    1979         Utf8Str name = applianceIOName(applianceIOTar);
     1980        Utf8Str name = i_applianceIOName(applianceIOTar);
    19801981
    19811982        vrc = VDInterfaceAdd(&pTarIo->Core, name.c_str(),
     
    19881989            break;
    19891990        }
    1990         rc = writeFSImpl(pTask, writeLock, pShaIo, &storage);
     1991        rc = i_writeFSImpl(pTask, writeLock, pShaIo, &storage);
    19911992    } while (0);
    19921993
     
    20072008}
    20082009
    2009 HRESULT Appliance::writeFSImpl(TaskOVF *pTask, AutoWriteLockBase& writeLock, PVDINTERFACEIO pIfIo, PSHASTORAGE pStorage)
     2010HRESULT Appliance::i_writeFSImpl(TaskOVF *pTask, AutoWriteLockBase& writeLock, PVDINTERFACEIO pIfIo, PSHASTORAGE pStorage)
    20102011{
    20112012    LogFlowFuncEnter();
     
    20262027            xml::Document doc;
    20272028            // Now fully build a valid ovf document in memory
    2028             buildXML(writeLock, doc, stack, pTask->locInfo.strPath, pTask->enFormat);
     2029            i_buildXML(writeLock, doc, stack, pTask->locInfo.strPath, pTask->enFormat);
    20292030            /* Extract the OVA file name */
    20302031            Utf8Str strOvaFile = pTask->locInfo.strPath;
     
    21442145                    ComPtr<IProgress> pProgress3(pProgress2);
    21452146                    // now wait for the background disk operation to complete; this throws HRESULTs on error
    2146                     waitForAsyncProgress(pTask->pProgress, pProgress3);
     2147                    i_waitForAsyncProgress(pTask->pProgress, pProgress3);
    21472148                }
    21482149                else//pDiskEntry->type == VirtualSystemDescriptionType_CDROM
     
    23142315 * Worker code for writing out OVF to the cloud. This is called from Appliance::taskThreadWriteOVF()
    23152316 * in S3 mode and therefore runs on the OVF write worker thread. This then starts a second worker
    2316  * thread to create temporary files (see Appliance::writeFS()).
     2317 * thread to create temporary files (see Appliance::i_writeFS()).
    23172318 *
    23182319 * @param pTask
    23192320 * @return
    23202321 */
    2321 HRESULT Appliance::writeS3(TaskOVF *pTask)
     2322HRESULT Appliance::i_writeS3(TaskOVF *pTask)
    23222323{
    23232324    LogFlowFuncEnter();
     
    23472348        Utf8Str tmpPath = pTask->locInfo.strPath;
    23482349        Utf8Str bucket;
    2349         parseBucket(tmpPath, bucket);
     2350        i_parseBucket(tmpPath, bucket);
    23502351
    23512352        /* We need a temporary directory which we can put the OVF file & all
     
    23642365        LocationInfo li;
    23652366        li.strPath = strTmpOvf;
    2366         rc = writeImpl(pTask->enFormat, li, progress);
     2367        rc = i_writeImpl(pTask->enFormat, li, progress);
    23672368        if (FAILED(rc)) throw rc;
    23682369
     
    23722373           caller */
    23732374        ComPtr<IProgress> progressInt(progress);
    2374         waitForAsyncProgress(pTask->pProgress, progressInt); /* Any errors will be thrown */
     2375        i_waitForAsyncProgress(pTask->pProgress, progressInt); /* Any errors will be thrown */
    23752376
    23762377        /* Again lock the appliance for the next steps */
     
    23972398        {
    23982399            ComObjPtr<VirtualSystemDescription> vsdescThis = (*it);
    2399             std::list<VirtualSystemDescriptionEntry*> avsdeHDs = vsdescThis->findByType(VirtualSystemDescriptionType_HardDiskImage);
     2400            std::list<VirtualSystemDescriptionEntry*> avsdeHDs = vsdescThis->i_findByType(VirtualSystemDescriptionType_HardDiskImage);
    24002401            std::list<VirtualSystemDescriptionEntry*>::const_iterator itH;
    24012402            for (itH = avsdeHDs.begin();
     
    24172418        }
    24182419        /* Next we have to upload the OVF & all disk images */
    2419         vrc = RTS3Create(&hS3, pTask->locInfo.strUsername.c_str(), pTask->locInfo.strPassword.c_str(), pTask->locInfo.strHostname.c_str(), "virtualbox-agent/" VBOX_VERSION_STRING);
     2420        vrc = RTS3Create(&hS3, pTask->locInfo.strUsername.c_str(), pTask->locInfo.strPassword.c_str(), pTask->locInfo.strHostname.c_str(), "virtualbox-agent/"VBOX_VERSION_STRING);
    24202421        if (RT_FAILURE(vrc))
    24212422            throw setError(VBOX_E_IPRT_ERROR,
  • trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp

    r49716 r49742  
    6262 * Thread implementation is in Appliance::readImpl().
    6363 *
    64  * @param path
     64 * @param aFile
    6565 * @return
    6666 */
    67 STDMETHODIMP Appliance::Read(IN_BSTR path, IProgress **aProgress)
     67HRESULT Appliance::read(const com::Utf8Str &aFile,
     68                        ComPtr<IProgress> &aProgress)
    6869{
    69     if (!path) return E_POINTER;
    70     CheckComArgOutPointerValid(aProgress);
    71 
    72     AutoCaller autoCaller(this);
    73     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    74 
    7570    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    7671
    77     if (!isApplianceIdle())
     72    if (!i_isApplianceIdle())
    7873        return E_ACCESSDENIED;
    7974
     
    8580
    8681    // see if we can handle this file; for now we insist it has an ovf/ova extension
    87     Utf8Str strPath (path);
    88     if (!(   strPath.endsWith(".ovf", Utf8Str::CaseInsensitive)
    89           || strPath.endsWith(".ova", Utf8Str::CaseInsensitive)))
     82    if (!(   aFile.endsWith(".ovf", Utf8Str::CaseInsensitive)
     83          || aFile.endsWith(".ova", Utf8Str::CaseInsensitive)))
    9084        return setError(VBOX_E_FILE_ERROR,
    9185                        tr("Appliance file must have .ovf extension"));
     
    9690    {
    9791        /* Parse all necessary info out of the URI */
    98         parseURI(strPath, m->locInfo);
    99         rc = readImpl(m->locInfo, progress);
     92        i_parseURI(aFile, m->locInfo);
     93        rc = i_readImpl(m->locInfo, progress);
    10094    }
    10195    catch (HRESULT aRC)
     
    106100    if (SUCCEEDED(rc))
    107101        /* Return progress to the caller */
    108         progress.queryInterfaceTo(aProgress);
     102        progress.queryInterfaceTo(aProgress.asOutParam());
    109103
    110104    return S_OK;
     
    116110 * @return
    117111 */
    118 STDMETHODIMP Appliance::Interpret()
     112HRESULT Appliance::interpret()
    119113{
    120114    // @todo:
     
    122116    // locking of that objects itself (s. HardDisk))
    123117    //  - Appropriate handle errors like not supported file formats
    124     AutoCaller autoCaller(this);
    125     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    126 
    127118    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    128119
    129     if (!isApplianceIdle())
     120    if (!i_isApplianceIdle())
    130121        return E_ACCESSDENIED;
    131122
     
    165156            // VirtualBox settings code parse that XML now
    166157            if (vsysThis.pelmVboxMachine)
    167                 pNewDesc->importVboxMachineXML(*vsysThis.pelmVboxMachine);
     158                pNewDesc->i_importVboxMachineXML(*vsysThis.pelmVboxMachine);
    168159
    169160            // Guest OS type
     
    182173            else
    183174                convertCIMOSType2VBoxOSType(strOsTypeVBox, vsysThis.cimos, vsysThis.strCimosDesc);
    184             pNewDesc->addEntry(VirtualSystemDescriptionType_OS,
    185                                "",
    186                                strCIMOSType,
    187                                strOsTypeVBox);
     175            pNewDesc->i_addEntry(VirtualSystemDescriptionType_OS,
     176                                 "",
     177                                 strCIMOSType,
     178                                 strOsTypeVBox);
    188179
    189180            /* VM name */
     
    199190            if (nameVBox.isEmpty())
    200191                nameVBox = strOsTypeVBox;
    201             searchUniqueVMName(nameVBox);
    202             pNewDesc->addEntry(VirtualSystemDescriptionType_Name,
    203                                "",
    204                                vsysThis.strName,
    205                                nameVBox);
     192            i_searchUniqueVMName(nameVBox);
     193            pNewDesc->i_addEntry(VirtualSystemDescriptionType_Name,
     194                                 "",
     195                                 vsysThis.strName,
     196                                 nameVBox);
    206197
    207198            /* Based on the VM name, create a target machine path. */
     
    218209            /* VM Product */
    219210            if (!vsysThis.strProduct.isEmpty())
    220                 pNewDesc->addEntry(VirtualSystemDescriptionType_Product,
    221                                     "",
    222                                     vsysThis.strProduct,
    223                                     vsysThis.strProduct);
     211                pNewDesc->i_addEntry(VirtualSystemDescriptionType_Product,
     212                                      "",
     213                                      vsysThis.strProduct,
     214                                      vsysThis.strProduct);
    224215
    225216            /* VM Vendor */
    226217            if (!vsysThis.strVendor.isEmpty())
    227                 pNewDesc->addEntry(VirtualSystemDescriptionType_Vendor,
    228                                     "",
    229                                     vsysThis.strVendor,
    230                                     vsysThis.strVendor);
     218                pNewDesc->i_addEntry(VirtualSystemDescriptionType_Vendor,
     219                                     "",
     220                                     vsysThis.strVendor,
     221                                     vsysThis.strVendor);
    231222
    232223            /* VM Version */
    233224            if (!vsysThis.strVersion.isEmpty())
    234                 pNewDesc->addEntry(VirtualSystemDescriptionType_Version,
    235                                     "",
    236                                     vsysThis.strVersion,
    237                                     vsysThis.strVersion);
     225                pNewDesc->i_addEntry(VirtualSystemDescriptionType_Version,
     226                                     "",
     227                                     vsysThis.strVersion,
     228                                     vsysThis.strVersion);
    238229
    239230            /* VM ProductUrl */
    240231            if (!vsysThis.strProductUrl.isEmpty())
    241                 pNewDesc->addEntry(VirtualSystemDescriptionType_ProductUrl,
    242                                     "",
    243                                     vsysThis.strProductUrl,
    244                                     vsysThis.strProductUrl);
     232                pNewDesc->i_addEntry(VirtualSystemDescriptionType_ProductUrl,
     233                                     "",
     234                                     vsysThis.strProductUrl,
     235                                     vsysThis.strProductUrl);
    245236
    246237            /* VM VendorUrl */
    247238            if (!vsysThis.strVendorUrl.isEmpty())
    248                 pNewDesc->addEntry(VirtualSystemDescriptionType_VendorUrl,
    249                                     "",
    250                                     vsysThis.strVendorUrl,
    251                                     vsysThis.strVendorUrl);
     239                pNewDesc->i_addEntry(VirtualSystemDescriptionType_VendorUrl,
     240                                     "",
     241                                     vsysThis.strVendorUrl,
     242                                     vsysThis.strVendorUrl);
    252243
    253244            /* VM description */
    254245            if (!vsysThis.strDescription.isEmpty())
    255                 pNewDesc->addEntry(VirtualSystemDescriptionType_Description,
    256                                     "",
    257                                     vsysThis.strDescription,
    258                                     vsysThis.strDescription);
     246                pNewDesc->i_addEntry(VirtualSystemDescriptionType_Description,
     247                                     "",
     248                                     vsysThis.strDescription,
     249                                     vsysThis.strDescription);
    259250
    260251            /* VM license */
    261252            if (!vsysThis.strLicenseText.isEmpty())
    262                 pNewDesc->addEntry(VirtualSystemDescriptionType_License,
    263                                     "",
    264                                     vsysThis.strLicenseText,
    265                                     vsysThis.strLicenseText);
     253                pNewDesc->i_addEntry(VirtualSystemDescriptionType_License,
     254                                     "",
     255                                     vsysThis.strLicenseText,
     256                                     vsysThis.strLicenseText);
    266257
    267258            /* Now that we know the OS type, get our internal defaults based on that. */
     
    281272            if (cpuCountVBox > SchemaDefs::MaxCPUCount)
    282273            {
    283                 addWarning(tr("The virtual system \"%s\" claims support for %u CPU's, but VirtualBox has support for "
    284                               "max %u CPU's only."),
    285                            vsysThis.strName.c_str(), cpuCountVBox, SchemaDefs::MaxCPUCount);
     274                i_addWarning(tr("The virtual system \"%s\" claims support for %u CPU's, but VirtualBox has support for "
     275                                "max %u CPU's only."),
     276                                vsysThis.strName.c_str(), cpuCountVBox, SchemaDefs::MaxCPUCount);
    286277                cpuCountVBox = SchemaDefs::MaxCPUCount;
    287278            }
    288279            if (vsysThis.cCPUs == 0)
    289280                cpuCountVBox = 1;
    290             pNewDesc->addEntry(VirtualSystemDescriptionType_CPU,
    291                                "",
    292                                Utf8StrFmt("%RU32", (uint32_t)vsysThis.cCPUs),
    293                                Utf8StrFmt("%RU32", (uint32_t)cpuCountVBox));
     281            pNewDesc->i_addEntry(VirtualSystemDescriptionType_CPU,
     282                                "",
     283                                Utf8StrFmt("%RU32", (uint32_t)vsysThis.cCPUs),
     284                                Utf8StrFmt("%RU32", (uint32_t)cpuCountVBox));
    294285
    295286            /* RAM */
     
    308299               )
    309300            {
    310                 addWarning(tr("The virtual system \"%s\" claims support for %llu MB RAM size, but VirtualBox has "
    311                               "support for min %u & max %u MB RAM size only."),
    312                               vsysThis.strName.c_str(), ullMemSizeVBox, MM_RAM_MIN_IN_MB, MM_RAM_MAX_IN_MB);
     301                i_addWarning(tr("The virtual system \"%s\" claims support for %llu MB RAM size, but VirtualBox has "
     302                                "support for min %u & max %u MB RAM size only."),
     303                                vsysThis.strName.c_str(), ullMemSizeVBox, MM_RAM_MIN_IN_MB, MM_RAM_MAX_IN_MB);
    313304                ullMemSizeVBox = RT_MIN(RT_MAX(ullMemSizeVBox, MM_RAM_MIN_IN_MB), MM_RAM_MAX_IN_MB);
    314305            }
     
    322313                ullMemSizeVBox = (uint64_t)memSizeVBox2;
    323314            }
    324             pNewDesc->addEntry(VirtualSystemDescriptionType_Memory,
    325                                "",
    326                                Utf8StrFmt("%RU64", (uint64_t)vsysThis.ullMemorySize),
    327                                Utf8StrFmt("%RU64", (uint64_t)ullMemSizeVBox));
     315            pNewDesc->i_addEntry(VirtualSystemDescriptionType_Memory,
     316                                 "",
     317                                 Utf8StrFmt("%RU64", (uint64_t)vsysThis.ullMemorySize),
     318                                 Utf8StrFmt("%RU64", (uint64_t)ullMemSizeVBox));
    328319
    329320            /* Audio */
     
    345336            }
    346337            if (strSoundCard.isNotEmpty())
    347                 pNewDesc->addEntry(VirtualSystemDescriptionType_SoundCard,
    348                                    "",
    349                                    strSoundCardOrig,
    350                                    strSoundCard);
     338                pNewDesc->i_addEntry(VirtualSystemDescriptionType_SoundCard,
     339                                     "",
     340                                     strSoundCardOrig,
     341                                     strSoundCard);
    351342
    352343#ifdef VBOX_WITH_USB
     
    356347                    && pNewDesc->m->pConfig->hardwareMachine.usbSettings.llUSBControllers.size() > 0)
    357348                || vsysThis.fHasUsbController)
    358                 pNewDesc->addEntry(VirtualSystemDescriptionType_USBController, "", "", "");
     349                pNewDesc->i_addEntry(VirtualSystemDescriptionType_USBController, "", "", "");
    359350#endif /* VBOX_WITH_USB */
    360351
     
    368359                /* Check for the constrains */
    369360                if (llNetworkAdapters.size() > maxNetworkAdapters)
    370                     addWarning(tr("The virtual system \"%s\" claims support for %zu network adapters, but VirtualBox "
    371                                   "has support for max %u network adapter only."),
    372                                   vsysThis.strName.c_str(), llNetworkAdapters.size(), maxNetworkAdapters);
     361                    i_addWarning(tr("The virtual system \"%s\" claims support for %zu network adapters, but VirtualBox "
     362                                    "has support for max %u network adapter only."),
     363                                    vsysThis.strName.c_str(), llNetworkAdapters.size(), maxNetworkAdapters);
    373364                /* Iterate through all network adapters. */
    374365                settings::NetworkAdaptersList::const_iterator it1;
     
    381372                    {
    382373                        Utf8Str strMode = convertNetworkAttachmentTypeToString(it1->mode);
    383                         pNewDesc->addEntry(VirtualSystemDescriptionType_NetworkAdapter,
    384                                            "", // ref
    385                                            strMode, // orig
    386                                            Utf8StrFmt("%RU32", (uint32_t)it1->type), // conf
    387                                            0,
    388                                            Utf8StrFmt("slot=%RU32;type=%s", it1->ulSlot, strMode.c_str())); // extra conf
     374                        pNewDesc->i_addEntry(VirtualSystemDescriptionType_NetworkAdapter,
     375                                             "", // ref
     376                                             strMode, // orig
     377                                             Utf8StrFmt("%RU32", (uint32_t)it1->type), // conf
     378                                             0,
     379                                             Utf8StrFmt("slot=%RU32;type=%s", it1->ulSlot, strMode.c_str())); // extra conf
    389380                    }
    390381                }
     
    397388                /* Check for the constrains */
    398389                if (cEthernetAdapters > maxNetworkAdapters)
    399                     addWarning(tr("The virtual system \"%s\" claims support for %zu network adapters, but VirtualBox "
    400                                   "has support for max %u network adapter only."),
    401                                   vsysThis.strName.c_str(), cEthernetAdapters, maxNetworkAdapters);
     390                    i_addWarning(tr("The virtual system \"%s\" claims support for %zu network adapters, but VirtualBox "
     391                                    "has support for max %u network adapter only."),
     392                                    vsysThis.strName.c_str(), cEthernetAdapters, maxNetworkAdapters);
    402393
    403394                /* Get the default network adapter type for the selected guest OS */
     
    461452#endif /* VBOX_WITH_E1000 */
    462453
    463                     pNewDesc->addEntry(VirtualSystemDescriptionType_NetworkAdapter,
    464                                        "",      // ref
    465                                        ea.strNetworkName,      // orig
    466                                        Utf8StrFmt("%RU32", (uint32_t)nwAdapterVBox),   // conf
    467                                        0,
    468                                        Utf8StrFmt("type=%s", strNetwork.c_str()));       // extra conf
     454                    pNewDesc->i_addEntry(VirtualSystemDescriptionType_NetworkAdapter,
     455                                         "",      // ref
     456                                         ea.strNetworkName,      // orig
     457                                         Utf8StrFmt("%RU32", (uint32_t)nwAdapterVBox),   // conf
     458                                         0,
     459                                         Utf8StrFmt("type=%s", strNetwork.c_str()));       // extra conf
    469460                }
    470461            }
     
    503494            /* Floppy Drive */
    504495            if (fFloppy)
    505                 pNewDesc->addEntry(VirtualSystemDescriptionType_Floppy, "", "", "");
     496                pNewDesc->i_addEntry(VirtualSystemDescriptionType_Floppy, "", "", "");
    506497            /* CD Drive */
    507498            if (fDVD)
    508                 pNewDesc->addEntry(VirtualSystemDescriptionType_CDROM, "", "", "");
     499                pNewDesc->i_addEntry(VirtualSystemDescriptionType_CDROM, "", "", "");
    509500
    510501            /* Hard disk Controller */
     
    534525                            else if (!hdc.strControllerType.compare("ICH6", Utf8Str::CaseInsensitive))
    535526                                strType = "ICH6";
    536                             pNewDesc->addEntry(VirtualSystemDescriptionType_HardDiskControllerIDE,
    537                                                strControllerID,         // strRef
    538                                                hdc.strControllerType,   // aOvfValue
    539                                                strType);                // aVboxValue
     527                            pNewDesc->i_addEntry(VirtualSystemDescriptionType_HardDiskControllerIDE,
     528                                                 strControllerID,         // strRef
     529                                                 hdc.strControllerType,   // aOvfValue
     530                                                 strType);                // aVboxValue
    540531                        }
    541532                        else
    542533                            /* Warn only once */
    543534                            if (cIDEused == 2)
    544                                 addWarning(tr("The virtual \"%s\" system requests support for more than two "
     535                                i_addWarning(tr("The virtual \"%s\" system requests support for more than two "
    545536                                              "IDE controller channels, but VirtualBox supports only two."),
    546                                             vsysThis.strName.c_str());
     537                                              vsysThis.strName.c_str());
    547538
    548539                        ++cIDEused;
     
    555546                            // @todo: figure out the SATA types
    556547                            /* We only support a plain AHCI controller, so use them always */
    557                             pNewDesc->addEntry(VirtualSystemDescriptionType_HardDiskControllerSATA,
    558                                                 strControllerID,
    559                                                 hdc.strControllerType,
    560                                                 "AHCI");
     548                            pNewDesc->i_addEntry(VirtualSystemDescriptionType_HardDiskControllerSATA,
     549                                                 strControllerID,
     550                                                 hdc.strControllerType,
     551                                                 "AHCI");
    561552                        }
    562553                        else
     
    564555                            /* Warn only once */
    565556                            if (cSATAused == 1)
    566                                 addWarning(tr("The virtual system \"%s\" requests support for more than one "
    567                                               "SATA controller, but VirtualBox has support for only one"),
    568                                             vsysThis.strName.c_str());
     557                                i_addWarning(tr("The virtual system \"%s\" requests support for more than one "
     558                                                "SATA controller, but VirtualBox has support for only one"),
     559                                                vsysThis.strName.c_str());
    569560
    570561                        }
     
    586577                            else if (!hdc.strControllerType.compare("BusLogic", Utf8Str::CaseInsensitive))
    587578                                hdcController = "BusLogic";
    588 
    589                             pNewDesc->addEntry(vsdet,
    590                                                strControllerID,
    591                                                hdc.strControllerType,
    592                                                hdcController);
     579                            pNewDesc->i_addEntry(vsdet,
     580                                                 strControllerID,
     581                                                 hdc.strControllerType,
     582                                                 hdcController);
    593583                        }
    594584                        else
    595                             addWarning(tr("The virtual system \"%s\" requests support for an additional "
    596                                           "SCSI controller of type \"%s\" with ID %s, but VirtualBox presently "
    597                                           "supports only one SCSI controller."),
    598                                         vsysThis.strName.c_str(),
    599                                         hdc.strControllerType.c_str(),
    600                                         strControllerID.c_str());
     585                            i_addWarning(tr("The virtual system \"%s\" requests support for an additional "
     586                                            "SCSI controller of type \"%s\" with ID %s, but VirtualBox presently "
     587                                            "supports only one SCSI controller."),
     588                                            vsysThis.strName.c_str(),
     589                                            hdc.strControllerType.c_str(),
     590                                            strControllerID.c_str());
    601591                        ++cSCSIused;
    602592                    break;
     
    634624
    635625                    ComObjPtr<MediumFormat> mediumFormat;
    636                     rc = findMediumFormatFromDiskImage(di, mediumFormat);
     626                    rc = i_findMediumFormatFromDiskImage(di, mediumFormat);
    637627                    if (FAILED(rc))
    638628                        throw rc;
     
    642632                    if (FAILED(rc))
    643633                        throw rc;
    644 
    645634                    Utf8Str vdf = Utf8Str(bstrFormatName);
    646635
     
    659648                        Utf8Str strTargetPath = Utf8Str(strMachineFolder);
    660649                        strTargetPath.append(RTPATH_DELIMITER).append(di.strHref);
    661                         searchUniqueDiskImageFilePath(strTargetPath);
     650                        i_searchUniqueDiskImageFilePath(strTargetPath);
    662651
    663652                        /* find the description for the hard disk controller
    664653                         * that has the same ID as hd.idController */
    665654                        const VirtualSystemDescriptionEntry *pController;
    666                         if (!(pController = pNewDesc->findControllerFromID(hd.idController)))
     655                        if (!(pController = pNewDesc->i_findControllerFromID(hd.idController)))
    667656                            throw setError(E_FAIL,
    668657                                           tr("Cannot find hard disk controller with OVF instance ID %RI32 "
     
    675664                                                  pController->ulIndex,
    676665                                                  hd.ulAddressOnParent);
    677                         pNewDesc->addEntry(VirtualSystemDescriptionType_HardDiskImage,
    678                                            hd.strDiskId,
    679                                            di.strHref,
    680                                            strTargetPath,
    681                                            di.ulSuggestedSizeMB,
    682                                            strExtraConfig);
     666                        pNewDesc->i_addEntry(VirtualSystemDescriptionType_HardDiskImage,
     667                                             hd.strDiskId,
     668                                             di.strHref,
     669                                             strTargetPath,
     670                                             di.ulSuggestedSizeMB,
     671                                             strExtraConfig);
    683672                    }
    684673                    else if (vdf.compare("RAW", Utf8Str::CaseInsensitive) == 0)
     
    692681                            .append(RTPATH_DELIMITER)
    693682                            .append(di.strHref);
    694                         searchUniqueDiskImageFilePath(strTargetPath);
     683                        i_searchUniqueDiskImageFilePath(strTargetPath);
    695684
    696685                        /* find the description for the hard disk controller
    697686                         * that has the same ID as hd.idController */
    698687                        const VirtualSystemDescriptionEntry *pController;
    699                         if (!(pController = pNewDesc->findControllerFromID(hd.idController)))
     688                        if (!(pController = pNewDesc->i_findControllerFromID(hd.idController)))
    700689                            throw setError(E_FAIL,
    701690                                           tr("Cannot find disk controller with OVF instance ID %RI32 "
     
    708697                                                  pController->ulIndex,
    709698                                                  hd.ulAddressOnParent);
    710                         pNewDesc->addEntry(VirtualSystemDescriptionType_HardDiskImage,
    711                                            hd.strDiskId,
    712                                            di.strHref,
    713                                            strTargetPath,
    714                                            di.ulSuggestedSizeMB,
    715                                            strExtraConfig);
     699                        pNewDesc->i_addEntry(VirtualSystemDescriptionType_HardDiskImage,
     700                                             hd.strDiskId,
     701                                             di.strHref,
     702                                             strTargetPath,
     703                                             di.ulSuggestedSizeMB,
     704                                             strExtraConfig);
    716705                    }
    717706                    else
     
    743732 * Public method implementation. This creates one or more new machines according to the
    744733 * VirtualSystemScription instances created by Appliance::Interpret().
    745  * Thread implementation is in Appliance::importImpl().
     734 * Thread implementation is in Appliance::i_importImpl().
    746735 * @param aProgress
    747736 * @return
    748737 */
    749 STDMETHODIMP Appliance::ImportMachines(ComSafeArrayIn(ImportOptions_T, options), IProgress **aProgress)
     738HRESULT Appliance::importMachines(const std::vector<ImportOptions_T> &aOptions,
     739                                  ComPtr<IProgress> &aProgress)
    750740{
    751     CheckComArgOutPointerValid(aProgress);
    752 
    753     AutoCaller autoCaller(this);
    754     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    755 
    756741    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    757742
    758     if (options != NULL)
    759         m->optListImport = com::SafeArray<ImportOptions_T>(ComSafeArrayInArg(options)).toList();
     743    if (aOptions.size())
     744    {
     745        m->optListImport.setCapacity(aOptions.size());
     746        for (size_t i = 0; i < aOptions.size(); ++i)
     747        {
     748            m->optListImport.insert(i, aOptions[i]);
     749        }
     750    }
    760751
    761752    AssertReturn(!(m->optListImport.contains(ImportOptions_KeepAllMACs) && m->optListImport.contains(ImportOptions_KeepNATMACs)), E_INVALIDARG);
    762753
    763754    // do not allow entering this method if the appliance is busy reading or writing
    764     if (!isApplianceIdle())
     755    if (!i_isApplianceIdle())
    765756        return E_ACCESSDENIED;
    766757
    767758    if (!m->pReader)
    768759        return setError(E_FAIL,
    769                         tr("Cannot import machines without reading it first (call read() before importMachines())"));
     760                        tr("Cannot import machines without reading it first (call read() before i_importMachines())"));
    770761
    771762    ComObjPtr<Progress> progress;
     
    773764    try
    774765    {
    775         rc = importImpl(m->locInfo, progress);
     766        rc = i_importImpl(m->locInfo, progress);
    776767    }
    777768    catch (HRESULT aRC)
     
    782773    if (SUCCEEDED(rc))
    783774        /* Return progress to the caller */
    784         progress.queryInterfaceTo(aProgress);
     775        progress.queryInterfaceTo(aProgress.asOutParam());
    785776
    786777    return rc;
     
    793784////////////////////////////////////////////////////////////////////////////////
    794785
    795 HRESULT Appliance::preCheckImageAvailability(PSHASTORAGE pSHAStorage,
     786HRESULT Appliance::i_preCheckImageAvailability(PSHASTORAGE pSHAStorage,
    796787                                               RTCString &availableImage)
    797788{
     
    836827 * 1) from the public Appliance::Read().
    837828 *
    838  * 2) in a second worker thread; in that case, Appliance::ImportMachines() called Appliance::importImpl(), which
    839  *    called Appliance::readFSOVA(), which called Appliance::importImpl(), which then called this again.
     829 * 2) in a second worker thread; in that case, Appliance::ImportMachines() called Appliance::i_importImpl(), which
     830 *    called Appliance::readFSOVA(), which called Appliance::i_importImpl(), which then called this again.
    840831 *
    841832 * 3) from Appliance::readS3(), which got called from a previous instance of Appliance::taskThreadImportOrExport().
     
    845836 * @return
    846837 */
    847 HRESULT Appliance::readImpl(const LocationInfo &aLocInfo, ComObjPtr<Progress> &aProgress)
     838HRESULT Appliance::i_readImpl(const LocationInfo &aLocInfo, ComObjPtr<Progress> &aProgress)
    848839{
    849840    BstrFmt bstrDesc = BstrFmt(tr("Reading appliance '%s'"),
     
    895886 * @return
    896887 */
    897 HRESULT Appliance::readFS(TaskOVF *pTask)
     888HRESULT Appliance::i_readFS(TaskOVF *pTask)
    898889{
    899890    LogFlowFuncEnter();
     
    908899
    909900    if (pTask->locInfo.strPath.endsWith(".ovf", Utf8Str::CaseInsensitive))
    910         rc = readFSOVF(pTask);
     901        rc = i_readFSOVF(pTask);
    911902    else
    912         rc = readFSOVA(pTask);
     903        rc = i_readFSOVA(pTask);
    913904
    914905    LogFlowFunc(("rc=%Rhrc\n", rc));
     
    918909}
    919910
    920 HRESULT Appliance::readFSOVF(TaskOVF *pTask)
     911HRESULT Appliance::i_readFSOVF(TaskOVF *pTask)
    921912{
    922913    LogFlowFuncEnter();
     
    10091000                    }
    10101001
    1011                     Utf8Str name = applianceIOName(applianceIOFile);
     1002                    Utf8Str name = i_applianceIOName(applianceIOFile);
    10121003
    10131004                    vrc = VDInterfaceAdd(&pFileIo->Core, name.c_str(),
     
    10171008                        throw setError(VBOX_E_IPRT_ERROR, "Creation of the VD interface failed (%Rrc)", vrc);
    10181009
    1019                     rc = readFSImpl(pTask, pTask->locInfo.strPath, pShaIo, &storage);
     1010                    rc = i_readFSImpl(pTask, pTask->locInfo.strPath, pShaIo, &storage);
    10201011                    if (FAILED(rc))
    10211012                        break;
     
    10311022            {
    10321023                storage.fCreateDigest = false;
    1033                 rc = readFSImpl(pTask, pTask->locInfo.strPath, pFileIo, &storage);
     1024                rc = i_readFSImpl(pTask, pTask->locInfo.strPath, pFileIo, &storage);
    10341025                if (FAILED(rc))
    10351026                    break;
     
    10551046}
    10561047
    1057 HRESULT Appliance::readFSOVA(TaskOVF *pTask)
     1048HRESULT Appliance::i_readFSOVA(TaskOVF *pTask)
    10581049{
    10591050    LogFlowFuncEnter();
     
    11121103            }
    11131104
    1114             Utf8Str name = applianceIOName(applianceIOTar);
     1105            Utf8Str name = i_applianceIOName(applianceIOTar);
    11151106
    11161107            vrc = VDInterfaceAdd(&pTarIo->Core, name.c_str(),
     
    11231114            }
    11241115
    1125             rc = readFSImpl(pTask, pszFilename, pShaIo, &storage);
     1116            rc = i_readFSImpl(pTask, pszFilename, pShaIo, &storage);
    11261117            if (FAILED(rc))
    11271118                break;
     
    11481139}
    11491140
    1150 HRESULT Appliance::readFSImpl(TaskOVF *pTask, const RTCString &strFilename, PVDINTERFACEIO pIfIo, PSHASTORAGE pStorage)
     1141HRESULT Appliance::i_readFSImpl(TaskOVF *pTask, const RTCString &strFilename, PVDINTERFACEIO pIfIo, PSHASTORAGE pStorage)
    11511142{
    11521143    LogFlowFuncEnter();
     
    12351226 * @return
    12361227 */
    1237 HRESULT Appliance::readS3(TaskOVF *pTask)
     1228HRESULT Appliance::i_readS3(TaskOVF *pTask)
    12381229{
    12391230    LogFlowFuncEnter();
     
    12601251        Utf8Str tmpPath = pTask->locInfo.strPath;
    12611252        Utf8Str bucket;
    1262         parseBucket(tmpPath, bucket);
     1253        i_parseBucket(tmpPath, bucket);
    12631254
    12641255        /* We need a temporary directory which we can put the OVF file & all
     
    13151306        li.strPath = strTmpOvf;
    13161307        /* Start the reading from the fs */
    1317         rc = readImpl(li, progress);
     1308        rc = i_readImpl(li, progress);
    13181309        if (FAILED(rc)) throw rc;
    13191310
     
    13231314           caller */
    13241315        ComPtr<IProgress> progressInt(progress);
    1325         waitForAsyncProgress(pTask->pProgress, progressInt); /* Any errors will be thrown */
     1316        i_waitForAsyncProgress(pTask->pProgress, progressInt); /* Any errors will be thrown */
    13261317
    13271318        /* Again lock the appliance for the next steps */
     
    13741365 *
    13751366 * 1) from the public Appliance::ImportMachines().
    1376  * 2) from Appliance::importS3(), which got called from a previous instance of Appliance::taskThreadImportOrExport().
     1367 * 2) from Appliance::i_importS3(), which got called from a previous instance of Appliance::taskThreadImportOrExport().
    13771368 *
    13781369 * @param aLocInfo
     
    13801371 * @return
    13811372 */
    1382 HRESULT Appliance::importImpl(const LocationInfo &locInfo,
    1383                               ComObjPtr<Progress> &progress)
     1373HRESULT Appliance::i_importImpl(const LocationInfo &locInfo,
     1374                                ComObjPtr<Progress> &progress)
    13841375{
    13851376    HRESULT rc = S_OK;
     
    13911382        mode = ImportS3;
    13921383
    1393     rc = setUpProgress(progress,
    1394                        BstrFmt(tr("Importing appliance '%s'"), locInfo.strPath.c_str()),
    1395                        mode);
     1384    rc = i_setUpProgress(progress,
     1385                         BstrFmt(tr("Importing appliance '%s'"), locInfo.strPath.c_str()),
     1386                         mode);
    13961387    if (FAILED(rc)) throw rc;
    13971388
     
    14151406 * This runs in three contexts:
    14161407 *
    1417  * 1) in a first worker thread; in that case, Appliance::ImportMachines() called Appliance::importImpl();
     1408 * 1) in a first worker thread; in that case, Appliance::ImportMachines() called Appliance::i_importImpl();
    14181409 *
    1419  * 2) in a second worker thread; in that case, Appliance::ImportMachines() called Appliance::importImpl(), which
    1420  *    called Appliance::importFSOVA(), which called Appliance::importImpl(), which then called this again.
     1410 * 2) in a second worker thread; in that case, Appliance::ImportMachines() called Appliance::i_importImpl(), which
     1411 *    called Appliance::i_i_importFSOVA(), which called Appliance::i_importImpl(), which then called this again.
    14211412 *
    1422  * 3) in a second worker thread; in that case, Appliance::ImportMachines() called Appliance::importImpl(), which
    1423  *    called Appliance::importS3(), which called Appliance::importImpl(), which then called this again.
     1413 * 3) in a second worker thread; in that case, Appliance::ImportMachines() called Appliance::i_importImpl(), which
     1414 *    called Appliance::i_importS3(), which called Appliance::i_importImpl(), which then called this again.
    14241415 *
    14251416 * @param pTask
    14261417 * @return
    14271418 */
    1428 HRESULT Appliance::importFS(TaskOVF *pTask)
     1419HRESULT Appliance::i_importFS(TaskOVF *pTask)
    14291420{
    14301421
    14311422    LogFlowFuncEnter();
    14321423    LogFlowFunc(("Appliance %p\n", this));
    1433 
    1434     AutoCaller autoCaller(this);
    1435     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    14361424
    14371425    /* Change the appliance state so we can safely leave the lock while doing
     
    14401428    AutoWriteLock writeLock(this COMMA_LOCKVAL_SRC_POS);
    14411429    /* Check if the appliance is currently busy. */
    1442     if (!isApplianceIdle())
     1430    if (!i_isApplianceIdle())
    14431431        return E_ACCESSDENIED;
    14441432    /* Set the internal state to importing. */
     
    14511439
    14521440    if (pTask->locInfo.strPath.endsWith(".ovf", Utf8Str::CaseInsensitive))
    1453         rc = importFSOVF(pTask, writeLock);
     1441        rc = i_importFSOVF(pTask, writeLock);
    14541442    else
    1455         rc = importFSOVA(pTask, writeLock);
     1443        rc = i_importFSOVA(pTask, writeLock);
    14561444
    14571445    if (FAILED(rc))
     
    14891477}
    14901478
    1491 HRESULT Appliance::importFSOVF(TaskOVF *pTask, AutoWriteLockBase& writeLock)
     1479HRESULT Appliance::i_importFSOVF(TaskOVF *pTask, AutoWriteLockBase& writeLock)
    14921480{
    14931481    LogFlowFuncEnter();
     
    15121500        RT_ZERO(storage);
    15131501
    1514         Utf8Str name = applianceIOName(applianceIOFile);
     1502        Utf8Str name = i_applianceIOName(applianceIOFile);
    15151503
    15161504        int vrc = VDInterfaceAdd(&pFileIo->Core, name.c_str(),
     
    15291517                throw setError(E_OUTOFMEMORY);
    15301518
    1531             Utf8Str nameSha = applianceIOName(applianceIOSha);
     1519            Utf8Str nameSha = i_applianceIOName(applianceIOSha);
    15321520            /* Fill out interface descriptor. */
    15331521            pShaIo->Core.u32Magic         = VDINTERFACE_MAGIC;
     
    15431531
    15441532            /* Now import the appliance. */
    1545             importMachines(stack, pShaIo, &storage);
     1533            i_importMachines(stack, pShaIo, &storage);
    15461534            /* Read & verify the manifest file. */
    15471535            /* Add the ovf file to the digest list. */
    15481536            stack.llSrcDisksDigest.push_front(STRPAIR(pTask->locInfo.strPath, m->strOVFSHADigest));
    1549             rc = readFileToBuf(strMfFile, &pvMfBuf, &cbMfSize, true, pShaIo, &storage);
     1537            rc = i_readFileToBuf(strMfFile, &pvMfBuf, &cbMfSize, true, pShaIo, &storage);
    15501538            if (FAILED(rc)) throw rc;
    1551             rc = verifyManifestFile(strMfFile, stack, pvMfBuf, cbMfSize);
     1539            rc = i_verifyManifestFile(strMfFile, stack, pvMfBuf, cbMfSize);
    15521540            if (FAILED(rc)) throw rc;
    15531541
     
    15601548            if (RTFileExists(strCertFile.c_str()))
    15611549            {
    1562                 rc = readFileToBuf(strCertFile, &pvCertBuf, &cbCertSize, false, pShaIo, &storage);
     1550                rc = i_readFileToBuf(strCertFile, &pvCertBuf, &cbCertSize, false, pShaIo, &storage);
    15631551                if (FAILED(rc)) throw rc;
    15641552
     
    15691557        {
    15701558            storage.fCreateDigest = false;
    1571             importMachines(stack, pFileIo, &storage);
     1559            i_importMachines(stack, pFileIo, &storage);
    15721560        }
    15731561    }
     
    15941582}
    15951583
    1596 HRESULT Appliance::importFSOVA(TaskOVF *pTask, AutoWriteLockBase& writeLock)
     1584HRESULT Appliance::i_importFSOVA(TaskOVF *pTask, AutoWriteLockBase& writeLock)
    15971585{
    15981586    LogFlowFuncEnter();
     
    16301618        RT_ZERO(storage);
    16311619
    1632         Utf8Str nameTar = applianceIOName(applianceIOTar);
     1620        Utf8Str nameTar = i_applianceIOName(applianceIOTar);
    16331621
    16341622        vrc = VDInterfaceAdd(&pTarIo->Core, nameTar.c_str(),
     
    16391627                           tr("Creation of the VD interface failed (%Rrc)"), vrc);
    16401628
    1641         Utf8Str nameSha = applianceIOName(applianceIOSha);
     1629        Utf8Str nameSha = i_applianceIOName(applianceIOSha);
    16421630        /* Fill out interface descriptor. */
    16431631        pShaIo->Core.u32Magic         = VDINTERFACE_MAGIC;
     
    17111699         * If it fails here, we will try it again after all disks where read.
    17121700         */
    1713         rc = readTarFileToBuf(tar, strMfFile, &pvMfBuf, &cbMfSize, true, pCallbacks, pStorage);
     1701        rc = i_readTarFileToBuf(tar, strMfFile, &pvMfBuf, &cbMfSize, true, pCallbacks, pStorage);
    17141702        if (FAILED(rc)) throw rc;
    17151703
     
    17261714                if (strCertFile.compare(pszFilename) == 0)
    17271715                {
    1728                     rc = readTarFileToBuf(tar, strCertFile, &pvCertBuf, &cbCertSize, false, pCallbacks, pStorage);
     1716                    rc = i_readTarFileToBuf(tar, strCertFile, &pvCertBuf, &cbCertSize, false, pCallbacks, pStorage);
    17291717                    if (FAILED(rc)) throw rc;
    17301718
     
    17381726
    17391727        /* Now import the appliance. */
    1740         importMachines(stack, pCallbacks, pStorage);
     1728        i_importMachines(stack, pCallbacks, pStorage);
    17411729        /* Try to read the manifest file. Second try. */
    17421730        if (!pvMfBuf)
    17431731        {
    1744             rc = readTarFileToBuf(tar, strMfFile, &pvMfBuf, &cbMfSize, true, pCallbacks, pStorage);
     1732            rc = i_readTarFileToBuf(tar, strMfFile, &pvMfBuf, &cbMfSize, true, pCallbacks, pStorage);
    17451733            if (FAILED(rc)) throw rc;
    17461734
     
    17501738                /* Add the ovf file to the digest list. */
    17511739                stack.llSrcDisksDigest.push_front(STRPAIR(OVFfilename, m->strOVFSHADigest));
    1752                 rc = verifyManifestFile(strMfFile, stack, pvMfBuf, cbMfSize);
     1740                rc = i_verifyManifestFile(strMfFile, stack, pvMfBuf, cbMfSize);
    17531741                if (FAILED(rc)) throw rc;
    17541742
     
    17631751                    if (strCertFile.compare(pszFilename) == 0)
    17641752                    {
    1765                         rc = readTarFileToBuf(tar, strCertFile, &pvCertBuf, &cbCertSize, false, pCallbacks, pStorage);
     1753                        rc = i_readTarFileToBuf(tar, strCertFile, &pvCertBuf, &cbCertSize, false, pCallbacks, pStorage);
    17661754                        if (FAILED(rc)) throw rc;
    17671755
     
    18051793 * Worker code for importing OVF from the cloud. This is called from Appliance::taskThreadImportOrExport()
    18061794 * in S3 mode and therefore runs on the OVF import worker thread. This then starts a second worker
    1807  * thread to import from temporary files (see Appliance::importFS()).
     1795 * thread to import from temporary files (see Appliance::i_importFS()).
    18081796 * @param pTask
    18091797 * @return
    18101798 */
    1811 HRESULT Appliance::importS3(TaskOVF *pTask)
     1799HRESULT Appliance::i_importS3(TaskOVF *pTask)
    18121800{
    18131801    LogFlowFuncEnter();
    18141802    LogFlowFunc(("Appliance %p\n", this));
    1815 
    1816     AutoCaller autoCaller(this);
    1817     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    18181803
    18191804    AutoWriteLock appLock(this COMMA_LOCKVAL_SRC_POS);
     
    18331818        Utf8Str tmpPath = pTask->locInfo.strPath;
    18341819        Utf8Str bucket;
    1835         parseBucket(tmpPath, bucket);
     1820        i_parseBucket(tmpPath, bucket);
    18361821
    18371822        /* We need a temporary directory which we can put the all disk images
     
    18491834        {
    18501835            ComObjPtr<VirtualSystemDescription> vsdescThis = (*it);
    1851             std::list<VirtualSystemDescriptionEntry*> avsdeHDs = vsdescThis->findByType(VirtualSystemDescriptionType_HardDiskImage);
     1836            std::list<VirtualSystemDescriptionEntry*> avsdeHDs = vsdescThis->i_findByType(VirtualSystemDescriptionType_HardDiskImage);
    18521837            std::list<VirtualSystemDescriptionEntry*>::const_iterator itH;
    18531838            for (itH = avsdeHDs.begin();
     
    19511936        LocationInfo li;
    19521937        li.strPath = strTmpOvf;
    1953         rc = importImpl(li, progress);
     1938        rc = i_importImpl(li, progress);
    19541939        if (FAILED(rc)) throw rc;
    19551940
     
    19591944           caller */
    19601945        ComPtr<IProgress> progressInt(progress);
    1961         waitForAsyncProgress(pTask->pProgress, progressInt); /* Any errors will be thrown */
     1946        i_waitForAsyncProgress(pTask->pProgress, progressInt); /* Any errors will be thrown */
    19621947
    19631948        /* Again lock the appliance for the next steps */
     
    20001985#endif /* VBOX_WITH_S3 */
    20011986
    2002 HRESULT Appliance::readFileToBuf(const Utf8Str &strFile,
    2003                                  void **ppvBuf,
    2004                                  size_t *pcbSize,
    2005                                  bool fCreateDigest,
    2006                                  PVDINTERFACEIO pCallbacks,
    2007                                  PSHASTORAGE pStorage)
     1987HRESULT Appliance::i_readFileToBuf(const Utf8Str &strFile,
     1988                                   void **ppvBuf,
     1989                                   size_t *pcbSize,
     1990                                   bool fCreateDigest,
     1991                                   PVDINTERFACEIO pCallbacks,
     1992                                   PSHASTORAGE pStorage)
    20081993{
    20091994    HRESULT rc = S_OK;
     
    20222007}
    20232008
    2024 HRESULT Appliance::readTarFileToBuf(RTTAR tar,
    2025                                     const Utf8Str &strFile,
    2026                                     void **ppvBuf,
    2027                                     size_t *pcbSize,
    2028                                     bool fCreateDigest,
    2029                                     PVDINTERFACEIO pCallbacks,
    2030                                     PSHASTORAGE pStorage)
     2009HRESULT Appliance::i_readTarFileToBuf(RTTAR tar,
     2010                                      const Utf8Str &strFile,
     2011                                      void **ppvBuf,
     2012                                      size_t *pcbSize,
     2013                                      bool fCreateDigest,
     2014                                      PVDINTERFACEIO pCallbacks,
     2015                                      PSHASTORAGE pStorage)
    20312016{
    20322017    HRESULT rc = S_OK;
     
    20462031        {
    20472032            if (!strcmp(pszCurFile, RTPathFilename(strFile.c_str())))
    2048                 rc = readFileToBuf(strFile, ppvBuf, pcbSize, fCreateDigest, pCallbacks, pStorage);
     2033                rc = i_readFileToBuf(strFile, ppvBuf, pcbSize, fCreateDigest, pCallbacks, pStorage);
    20492034            RTStrFree(pszCurFile);
    20502035        }
     
    20562041}
    20572042
    2058 HRESULT Appliance::verifyManifestFile(const Utf8Str &strFile, ImportStack &stack, void *pvBuf, size_t cbSize)
     2043HRESULT Appliance::i_verifyManifestFile(const Utf8Str &strFile, ImportStack &stack, void *pvBuf, size_t cbSize)
    20592044{
    20602045    HRESULT rc = S_OK;
     
    20992084 * @param lDevice out: the device number to attach to.
    21002085 */
    2101 void Appliance::convertDiskAttachmentValues(const ovf::HardDiskController &hdc,
     2086void Appliance::i_convertDiskAttachmentValues(const ovf::HardDiskController &hdc,
    21022087                                            uint32_t ulAddressOnParent,
    21032088                                            Bstr &controllerType,
     
    21052090                                            int32_t &lDevice)
    21062091{
    2107     Log(("Appliance::convertDiskAttachmentValues: hdc.system=%d, hdc.fPrimary=%d, ulAddressOnParent=%d\n",
     2092    Log(("Appliance::i_convertDiskAttachmentValues: hdc.system=%d, hdc.fPrimary=%d, ulAddressOnParent=%d\n",
    21082093         hdc.system,
    21092094         hdc.fPrimary,
     
    21812166            else
    21822167                controllerType = Bstr("SCSI Controller");
    2183 
    21842168            lControllerPort = (long)ulAddressOnParent;
    21852169            lDevice = (long)0;
     
    21952179/**
    21962180 * Imports one disk image. This is common code shared between
    2197  *  --  importMachineGeneric() for the OVF case; in that case the information comes from
     2181 *  --  i_importMachineGeneric() for the OVF case; in that case the information comes from
    21982182 *      the OVF virtual systems;
    2199  *  --  importVBoxMachine(); in that case, the information comes from the <vbox:Machine>
     2183 *  --  i_importVBoxMachine(); in that case, the information comes from the <vbox:Machine>
    22002184 *      tag.
    22012185 *
     
    22142198 * @param stack
    22152199 */
    2216 void Appliance::importOneDiskImage(const ovf::DiskImage &di,
    2217                                    Utf8Str *strTargetPath,
    2218                                    ComObjPtr<Medium> &pTargetHD,
    2219                                    ImportStack &stack,
    2220                                    PVDINTERFACEIO pCallbacks,
    2221                                    PSHASTORAGE pStorage)
     2200void Appliance::i_importOneDiskImage(const ovf::DiskImage &di,
     2201                                     Utf8Str *strTargetPath,
     2202                                     ComObjPtr<Medium> &pTargetHD,
     2203                                     ImportStack &stack,
     2204                                     PVDINTERFACEIO pCallbacks,
     2205                                     PSHASTORAGE pStorage)
    22222206{
    22232207    SHASTORAGE finalStorage;
     
    22462230
    22472231    /* Construct source file path */
    2248     Utf8Str name = applianceIOName(applianceIOTar);
     2232    Utf8Str name = i_applianceIOName(applianceIOTar);
    22492233
    22502234    if (RTStrNICmp(pStorage->pVDImageIfaces->pszInterfaceName, name.c_str(), name.length()) == 0)
     
    23042288                    throw setError(E_OUTOFMEMORY);
    23052289
    2306                 name = applianceIOName(applianceIOFile);
     2290                name = i_applianceIOName(applianceIOFile);
    23072291
    23082292                vrc = VDInterfaceAdd(&pFileIo->Core, name.c_str(),
     
    24492433                    /* We need a proper source format description */
    24502434                    /* Which format to use? */
    2451                     ComObjPtr<MediumFormat> srcFormat; 
    2452                     rc = findMediumFormatFromDiskImage(di, srcFormat);
     2435                    ComObjPtr<MediumFormat> srcFormat;
     2436                    rc = i_findMediumFormatFromDiskImage(di, srcFormat);
    24532437                    if (FAILED(rc))
    24542438                        throw setError(VBOX_E_NOT_SUPPORTED,
     
    24682452                    if (FAILED(rc)) throw rc;
    24692453
     2454
     2455
    24702456                    /* Advance to the next operation. */
    24712457                    /* operation's weight, as set up with the IProgress originally */
     
    24782464                 * HRESULTs on error. */
    24792465                ComPtr<IProgress> pp(pProgress);
    2480                 waitForAsyncProgress(stack.pProgress, pp);
     2466                i_waitForAsyncProgress(stack.pProgress, pp);
    24812467
    24822468                if (fGzipUsed == true)
     
    25232509 * @param stack Cleanup stack for when this throws.
    25242510 */
    2525 void Appliance::importMachineGeneric(const ovf::VirtualSystem &vsysThis,
    2526                                      ComObjPtr<VirtualSystemDescription> &vsdescThis,
    2527                                      ComPtr<IMachine> &pNewMachine,
    2528                                      ImportStack &stack,
    2529                                      PVDINTERFACEIO pCallbacks,
    2530                                      PSHASTORAGE pStorage)
     2511void Appliance::i_importMachineGeneric(const ovf::VirtualSystem &vsysThis,
     2512                                       ComObjPtr<VirtualSystemDescription> &vsdescThis,
     2513                                       ComPtr<IMachine> &pNewMachine,
     2514                                       ImportStack &stack,
     2515                                       PVDINTERFACEIO pCallbacks,
     2516                                       PSHASTORAGE pStorage)
    25312517{
    25322518    HRESULT rc;
     
    26282614    uint32_t maxNetworkAdapters = Global::getMaxNetworkAdapters(ChipsetType_PIIX3);
    26292615
    2630     std::list<VirtualSystemDescriptionEntry*> vsdeNW = vsdescThis->findByType(VirtualSystemDescriptionType_NetworkAdapter);
     2616    std::list<VirtualSystemDescriptionEntry*> vsdeNW = vsdescThis->i_findByType(VirtualSystemDescriptionType_NetworkAdapter);
    26312617    if (vsdeNW.size() == 0)
    26322618    {
     
    27442730                if (FAILED(rc)) throw rc;
    27452731            }
     2732
    27462733            /* Next test for NAT network interfaces */
    27472734            else if (pvsys->strExtraConfigCurrent.endsWith("type=NATNetwork", Utf8Str::CaseInsensitive))
     
    27692756
    27702757    // IDE Hard disk controller
    2771     std::list<VirtualSystemDescriptionEntry*> vsdeHDCIDE = vsdescThis->findByType(VirtualSystemDescriptionType_HardDiskControllerIDE);
     2758    std::list<VirtualSystemDescriptionEntry*> vsdeHDCIDE = vsdescThis->i_findByType(VirtualSystemDescriptionType_HardDiskControllerIDE);
    27722759    /*
    27732760     * In OVF (at least VMware's version of it), an IDE controller has two ports,
     
    28012788
    28022789    /* Hard disk controller SATA */
    2803     std::list<VirtualSystemDescriptionEntry*> vsdeHDCSATA = vsdescThis->findByType(VirtualSystemDescriptionType_HardDiskControllerSATA);
     2790    std::list<VirtualSystemDescriptionEntry*> vsdeHDCSATA = vsdescThis->i_findByType(VirtualSystemDescriptionType_HardDiskControllerSATA);
    28042791    if (vsdeHDCSATA.size() > 1)
    28052792        throw setError(VBOX_E_FILE_ERROR,
     
    28232810
    28242811    /* Hard disk controller SCSI */
    2825     std::list<VirtualSystemDescriptionEntry*> vsdeHDCSCSI = vsdescThis->findByType(VirtualSystemDescriptionType_HardDiskControllerSCSI);
     2812    std::list<VirtualSystemDescriptionEntry*> vsdeHDCSCSI = vsdescThis->i_findByType(VirtualSystemDescriptionType_HardDiskControllerSCSI);
    28262813    if (vsdeHDCSCSI.size() > 1)
    28272814        throw setError(VBOX_E_FILE_ERROR,
     
    28572844
    28582845    /* Hard disk controller SAS */
    2859     std::list<VirtualSystemDescriptionEntry*> vsdeHDCSAS = vsdescThis->findByType(VirtualSystemDescriptionType_HardDiskControllerSAS);
     2846    std::list<VirtualSystemDescriptionEntry*> vsdeHDCSAS = vsdescThis->i_findByType(VirtualSystemDescriptionType_HardDiskControllerSAS);
    28602847    if (vsdeHDCSAS.size() > 1)
    28612848        throw setError(VBOX_E_FILE_ERROR,
     
    28842871
    28852872    // Add floppies and CD-ROMs to the appropriate controllers.
    2886     std::list<VirtualSystemDescriptionEntry*> vsdeFloppy = vsdescThis->findByType(VirtualSystemDescriptionType_Floppy);
     2873    std::list<VirtualSystemDescriptionEntry*> vsdeFloppy = vsdescThis->i_findByType(VirtualSystemDescriptionType_Floppy);
    28872874    if (vsdeFloppy.size() > 1)
    28882875        throw setError(VBOX_E_FILE_ERROR,
    28892876                       tr("Too many floppy controllers in OVF; import facility only supports one"));
    2890     std::list<VirtualSystemDescriptionEntry*> vsdeCDROM = vsdescThis->findByType(VirtualSystemDescriptionType_CDROM);
     2877    std::list<VirtualSystemDescriptionEntry*> vsdeCDROM = vsdescThis->i_findByType(VirtualSystemDescriptionType_CDROM);
    28912878    if (    (vsdeFloppy.size() > 0)
    28922879         || (vsdeCDROM.size() > 0)
     
    29622949
    29632950    // create the hard disks & connect them to the appropriate controllers
    2964     std::list<VirtualSystemDescriptionEntry*> avsdeHDs = vsdescThis->findByType(VirtualSystemDescriptionType_HardDiskImage);
     2951    std::list<VirtualSystemDescriptionEntry*> avsdeHDs = vsdescThis->i_findByType(VirtualSystemDescriptionType_HardDiskImage);
    29652952    if (avsdeHDs.size() > 0)
    29662953    {
     
    29752962
    29762963            /* get VM name from virtual system description. Only one record is possible (size of list is equal 1). */
    2977             std::list<VirtualSystemDescriptionEntry*> vmName = vsdescThis->findByType(VirtualSystemDescriptionType_Name);
     2964            std::list<VirtualSystemDescriptionEntry*> vmName = vsdescThis->i_findByType(VirtualSystemDescriptionType_Name);
    29782965            std::list<VirtualSystemDescriptionEntry*>::iterator vmNameIt = vmName.begin();
    29792966            VirtualSystemDescriptionEntry* vmNameEntry = *vmNameIt;
     2967
    29802968
    29812969            ovf::DiskImagesMap::const_iterator oit = stack.mapDisks.begin();
     
    30353023                 */
    30363024
    3037                 Utf8Str name = applianceIOName(applianceIOTar);
     3025                Utf8Str name = i_applianceIOName(applianceIOTar);
    30383026
    30393027                if (strncmp(pStorage->pVDImageIfaces->pszInterfaceName, name.c_str(), name.length()) == 0)
     
    30503038                    RTCString availableImage(diCurrent.strHref);
    30513039
    3052                     rc = preCheckImageAvailability(pStorage,
    3053                                                    availableImage
    3054                                                   );
     3040                    rc = i_preCheckImageAvailability(pStorage, availableImage);
    30553041
    30563042                    if (SUCCEEDED(rc))
     
    30733059                                }
    30743060                                if (itDiskImage == stack.mapDisks.end())
     3061                                {
    30753062                                    throw setError(E_FAIL,
    30763063                                                   tr("Internal inconsistency looking up disk image '%s'. "
    30773064                                                      "Check compliance OVA package structure and file names "
    3078                                                       "references in the section <References> in the OVF file"),
     3065                                                      "references in the section <References> in the OVF file."),
    30793066                                                   availableImage.c_str());
     3067                                }
    30803068
    30813069                                /* replace with a new found disk image */
     
    31013089                                }
    31023090                                if (!vsdeTargetHD)
     3091                                {
    31033092                                    /*
    3104                                      * in this case it's an error because something wrong with OVF description file.
     3093 -                                   * in this case it's an error because something wrong with OVF description file.
    31053094                                     * May be VB imports OVA package with wrong file sequence inside the archive.
    31063095                                     */
     
    31083097                                                   tr("Internal inconsistency looking up disk image '%s'"),
    31093098                                                   diCurrent.strHref.c_str());
     3099                                }
    31103100
    31113101                                itVDisk = vsysThis.mapVirtualDisks.find(diCurrent.strDiskId);
     
    31423132                Utf8Str savedVboxCurrent = vsdeTargetHD->strVboxCurrent;
    31433133
    3144                 importOneDiskImage(diCurrent,
    3145                                    &vsdeTargetHD->strVboxCurrent,
    3146                                    pTargetHD,
    3147                                    stack,
    3148                                    pCallbacks,
    3149                                    pStorage);
     3134                i_importOneDiskImage(diCurrent,
     3135                                     &vsdeTargetHD->strVboxCurrent,
     3136                                     pTargetHD,
     3137                                     stack,
     3138                                     pCallbacks,
     3139                                     pStorage);
    31503140
    31513141                // now use the new uuid to attach the disk image to our new machine
     
    31623152                mhda.pMachine = pNewMachine;
    31633153
    3164                 convertDiskAttachmentValues(hdc,
    3165                                             ovfVdisk.ulAddressOnParent,
    3166                                             mhda.controllerType,        // Bstr
    3167                                             mhda.lControllerPort,
    3168                                             mhda.lDevice);
     3154                i_convertDiskAttachmentValues(hdc,
     3155                                              ovfVdisk.ulAddressOnParent,
     3156                                              mhda.controllerType,        // Bstr
     3157                                              mhda.lControllerPort,
     3158                                              mhda.lDevice);
    31693159
    31703160                Log(("Attaching disk %s to port %d on device %d\n",
     
    31723162
    31733163                ComObjPtr<MediumFormat> mediumFormat;
    3174                 rc = findMediumFormatFromDiskImage(diCurrent, mediumFormat);
     3164                rc = i_findMediumFormatFromDiskImage(diCurrent, mediumFormat);
    31753165                if (FAILED(rc))
    31763166                    throw rc;
     
    32403230            // only now that we're done with all disks, close the session
    32413231            rc = stack.pSession->UnlockMachine();
    3242 
    32433232            if (FAILED(rc))
    32443233                throw rc;
    3245 
    32463234            stack.fSessionOpen = false;
    32473235        }
    3248         catch(HRESULT  aRC)
     3236        catch(HRESULT aRC)
    32493237        {
    32503238            com::ErrorInfo info;
    3251 
    32523239            if (stack.fSessionOpen)
    32533240                stack.pSession->UnlockMachine();
     
    32903277 * @param stack
    32913278 */
    3292 void Appliance::importVBoxMachine(ComObjPtr<VirtualSystemDescription> &vsdescThis,
    3293                                   ComPtr<IMachine> &pReturnNewMachine,
    3294                                   ImportStack &stack,
    3295                                   PVDINTERFACEIO pCallbacks,
    3296                                   PSHASTORAGE pStorage)
     3279void Appliance::i_importVBoxMachine(ComObjPtr<VirtualSystemDescription> &vsdescThis,
     3280                                    ComPtr<IMachine> &pReturnNewMachine,
     3281                                    ImportStack &stack,
     3282                                    PVDINTERFACEIO pCallbacks,
     3283                                    PSHASTORAGE pStorage)
    32973284{
    32983285    Assert(vsdescThis->m->pConfig);
     
    33783365              || (fKeepNATMACs && it1->mode == NetworkAttachmentType_NAT)
    33793366              || (fKeepNATMACs && it1->mode == NetworkAttachmentType_NATNetwork)))
    3380             Host::generateMACAddress(it1->strMACAddress);
     3367            Host::i_generateMACAddress(it1->strMACAddress);
    33813368    }
    33823369    /* Now iterate over all network entries. */
    3383     std::list<VirtualSystemDescriptionEntry*> avsdeNWs = vsdescThis->findByType(VirtualSystemDescriptionType_NetworkAdapter);
     3370    std::list<VirtualSystemDescriptionEntry*> avsdeNWs = vsdescThis->i_findByType(VirtualSystemDescriptionType_NetworkAdapter);
    33843371    if (avsdeNWs.size() > 0)
    33853372    {
     
    34153402
    34163403    /* Floppy controller */
    3417     bool fFloppy = vsdescThis->findByType(VirtualSystemDescriptionType_Floppy).size() > 0;
     3404    bool fFloppy = vsdescThis->i_findByType(VirtualSystemDescriptionType_Floppy).size() > 0;
    34183405    /* DVD controller */
    3419     bool fDVD = vsdescThis->findByType(VirtualSystemDescriptionType_CDROM).size() > 0;
     3406    bool fDVD = vsdescThis->i_findByType(VirtualSystemDescriptionType_CDROM).size() > 0;
    34203407    /* Iterate over all storage controller check the attachments and remove
    34213408     * them when necessary. Also detect broken configs with more than one
     
    34753462     * step 2: scan the machine config for media attachments
    34763463     */
    3477 
    34783464    /* get VM name from virtual system description. Only one record is possible (size of list is equal 1). */
    3479     std::list<VirtualSystemDescriptionEntry*> vmName = vsdescThis->findByType(VirtualSystemDescriptionType_Name);
     3465    std::list<VirtualSystemDescriptionEntry*> vmName = vsdescThis->i_findByType(VirtualSystemDescriptionType_Name);
    34803466    std::list<VirtualSystemDescriptionEntry*>::iterator vmNameIt = vmName.begin();
    34813467    VirtualSystemDescriptionEntry* vmNameEntry = *vmNameIt;
    34823468
    34833469    /* Get all hard disk descriptions. */
    3484     std::list<VirtualSystemDescriptionEntry*> avsdeHDs = vsdescThis->findByType(VirtualSystemDescriptionType_HardDiskImage);
     3470    std::list<VirtualSystemDescriptionEntry*> avsdeHDs = vsdescThis->i_findByType(VirtualSystemDescriptionType_HardDiskImage);
    34853471    std::list<VirtualSystemDescriptionEntry*>::iterator avsdeHDsIt = avsdeHDs.begin();
    34863472    /* paranoia - if there is no 1:1 match do not try to repair. */
     
    35173503                }
    35183504            }
    3519 
    35203505            if (!vsdeTargetHD)
    35213506            {
     
    35343519         */
    35353520
    3536         Utf8Str name = applianceIOName(applianceIOTar);
     3521        Utf8Str name = i_applianceIOName(applianceIOTar);
    35373522
    35383523        if (strncmp(pStorage->pVDImageIfaces->pszInterfaceName, name.c_str(), name.length()) == 0)
     
    35493534            RTCString availableImage(diCurrent.strHref);
    35503535
    3551             rc = preCheckImageAvailability(pStorage,
    3552                                            availableImage
    3553                                           );
     3536            rc = i_preCheckImageAvailability(pStorage, availableImage);
    35543537
    35553538            if (SUCCEEDED(rc))
     
    36873670                Utf8Str savedVboxCurrent = vsdeTargetHD->strVboxCurrent;
    36883671                ComObjPtr<Medium> pTargetHD;
    3689                 importOneDiskImage(diCurrent,
    3690                                    &vsdeTargetHD->strVboxCurrent,
    3691                                    pTargetHD,
    3692                                    stack,
    3693                                    pCallbacks,
    3694                                    pStorage);
     3672                i_importOneDiskImage(diCurrent,
     3673                                     &vsdeTargetHD->strVboxCurrent,
     3674                                     pTargetHD,
     3675                                     stack,
     3676                                     pCallbacks,
     3677                                     pStorage);
    36953678
    36963679                Bstr hdId;
    36973680
    36983681                ComObjPtr<MediumFormat> mediumFormat;
    3699                 rc = findMediumFormatFromDiskImage(diCurrent, mediumFormat);
     3682                rc = i_findMediumFormatFromDiskImage(diCurrent, mediumFormat);
    37003683                if (FAILED(rc))
    37013684                    throw rc;
     
    37533736    }// while(oit != stack.mapDisks.end())
    37543737
     3738
    37553739    /*
    37563740     * quantity of the imported disks isn't equal to the size of the avsdeHDs list.
     
    37903774}
    37913775
    3792 void Appliance::importMachines(ImportStack &stack,
    3793                                PVDINTERFACEIO pCallbacks,
    3794                                PSHASTORAGE pStorage)
     3776void Appliance::i_importMachines(ImportStack &stack,
     3777                                 PVDINTERFACEIO pCallbacks,
     3778                                 PSHASTORAGE pStorage)
    37953779{
    37963780    HRESULT rc = S_OK;
     
    38353819
    38363820        // VM name
    3837         std::list<VirtualSystemDescriptionEntry*> vsdeName = vsdescThis->findByType(VirtualSystemDescriptionType_Name);
     3821        std::list<VirtualSystemDescriptionEntry*> vsdeName = vsdescThis->i_findByType(VirtualSystemDescriptionType_Name);
    38383822        if (vsdeName.size() < 1)
    38393823            throw setError(VBOX_E_FILE_ERROR,
     
    38563840        // guest OS type
    38573841        std::list<VirtualSystemDescriptionEntry*> vsdeOS;
    3858         vsdeOS = vsdescThis->findByType(VirtualSystemDescriptionType_OS);
     3842        vsdeOS = vsdescThis->i_findByType(VirtualSystemDescriptionType_OS);
    38593843        if (vsdeOS.size() < 1)
    38603844            throw setError(VBOX_E_FILE_ERROR,
     
    38633847
    38643848        // CPU count
    3865         std::list<VirtualSystemDescriptionEntry*> vsdeCPU = vsdescThis->findByType(VirtualSystemDescriptionType_CPU);
     3849        std::list<VirtualSystemDescriptionEntry*> vsdeCPU = vsdescThis->i_findByType(VirtualSystemDescriptionType_CPU);
    38663850        if (vsdeCPU.size() != 1)
    38673851            throw setError(VBOX_E_FILE_ERROR, tr("CPU count missing"));
     
    38763860
    38773861        // RAM
    3878         std::list<VirtualSystemDescriptionEntry*> vsdeRAM = vsdescThis->findByType(VirtualSystemDescriptionType_Memory);
     3862        std::list<VirtualSystemDescriptionEntry*> vsdeRAM = vsdescThis->i_findByType(VirtualSystemDescriptionType_Memory);
    38793863        if (vsdeRAM.size() != 1)
    38803864            throw setError(VBOX_E_FILE_ERROR, tr("RAM size missing"));
     
    38833867#ifdef VBOX_WITH_USB
    38843868        // USB controller
    3885         std::list<VirtualSystemDescriptionEntry*> vsdeUSBController = vsdescThis->findByType(VirtualSystemDescriptionType_USBController);
     3869        std::list<VirtualSystemDescriptionEntry*> vsdeUSBController = vsdescThis->i_findByType(VirtualSystemDescriptionType_USBController);
    38863870        // USB support is enabled if there's at least one such entry; to disable USB support,
    38873871        // the type of the USB item would have been changed to "ignore"
     
    38893873#endif
    38903874        // audio adapter
    3891         std::list<VirtualSystemDescriptionEntry*> vsdeAudioAdapter = vsdescThis->findByType(VirtualSystemDescriptionType_SoundCard);
     3875        std::list<VirtualSystemDescriptionEntry*> vsdeAudioAdapter = vsdescThis->i_findByType(VirtualSystemDescriptionType_SoundCard);
    38923876        /* @todo: we support one audio adapter only */
    38933877        if (vsdeAudioAdapter.size() > 0)
     
    38953879
    38963880        // for the description of the new machine, always use the OVF entry, the user may have changed it in the import config
    3897         std::list<VirtualSystemDescriptionEntry*> vsdeDescription = vsdescThis->findByType(VirtualSystemDescriptionType_Description);
     3881        std::list<VirtualSystemDescriptionEntry*> vsdeDescription = vsdescThis->i_findByType(VirtualSystemDescriptionType_Description);
    38983882        if (vsdeDescription.size())
    38993883            stack.strDescription = vsdeDescription.front()->strVboxCurrent;
     
    39023886        if (vsdescThis->m->pConfig)
    39033887            // vbox:Machine config
    3904             importVBoxMachine(vsdescThis, pNewMachine, stack, pCallbacks, pStorage);
     3888            i_importVBoxMachine(vsdescThis, pNewMachine, stack, pCallbacks, pStorage);
    39053889        else
    39063890            // generic OVF config
    3907             importMachineGeneric(vsysThis, vsdescThis, pNewMachine, stack, pCallbacks, pStorage);
     3891            i_importMachineGeneric(vsysThis, vsdescThis, pNewMachine, stack, pCallbacks, pStorage);
    39083892
    39093893    } // for (it = pAppliance->m->llVirtualSystems.begin() ...
  • trunk/src/VBox/Main/src-server/DHCPServerImpl.cpp

    r49673 r49742  
    267267
    268268    m->GlobalDhcpOptions.insert(DhcpOptValuePair(aOption, aValue));
    269    
     269
    270270    /* Indirect way to understand that we're on NAT network */
    271271    if (aOption == DhcpOpt_Router)
    272272        m->dhcp.setOption(NetworkServiceRunner::kNsrKeyNeedMain, "on");
    273    
     273
    274274    alock.release();
    275275
  • trunk/src/VBox/Main/src-server/HostImpl.cpp

    r49409 r49742  
    108108typedef SOLARISDVD *PSOLARISDVD;
    109109
     110
     111
    110112#endif /* RT_OS_SOLARIS */
    111113
     
    213215    VBoxMainDriveInfo       hostDrives;
    214216#endif
     217
    215218    /** @name Features that can be queried with GetProcessorFeature.
    216219     * @{ */
     
    231234};
    232235
     236
    233237////////////////////////////////////////////////////////////////////////////////
    234238//
     
    236240//
    237241////////////////////////////////////////////////////////////////////////////////
     242DEFINE_EMPTY_CTOR_DTOR(Host)
    238243
    239244HRESULT Host::FinalConstruct()
     
    290295
    291296#ifdef VBOX_WITH_RESOURCE_USAGE_API
    292     registerMetrics(aParent->performanceCollector());
     297    i_registerMetrics(aParent->performanceCollector());
    293298#endif /* VBOX_WITH_RESOURCE_USAGE_API */
    294299    /* Create the list of network interfaces so their metrics get registered. */
    295     updateNetIfList();
     300    i_updateNetIfList();
    296301
    297302    m->hostDnsMonitorProxy.init(HostDnsMonitor::getHostDnsMonitor(), m->pParent);
     
    466471#ifdef VBOX_WITH_RESOURCE_USAGE_API
    467472    PerformanceCollector *aCollector = m->pParent->performanceCollector();
    468     unregisterMetrics (aCollector);
     473    i_unregisterMetrics (aCollector);
    469474#endif /* VBOX_WITH_RESOURCE_USAGE_API */
    470475    /*
     
    514519 * @param drives address of result pointer
    515520 */
    516 STDMETHODIMP Host::COMGETTER(DVDDrives)(ComSafeArrayOut(IMedium *, aDrives))
    517 {
    518     CheckComArgOutSafeArrayPointerValid(aDrives);
    519 
    520     AutoCaller autoCaller(this);
    521     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    522 
     521
     522HRESULT Host::getDVDDrives(std::vector<ComPtr<IMedium> > &aDVDDrives)
     523{
    523524    AutoWriteLock alock(m->pParent->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
    524 
    525525    MediaList *pList;
    526     HRESULT rc = getDrives(DeviceType_DVD, true /* fRefresh */, pList);
     526    HRESULT rc = i_getDrives(DeviceType_DVD, true /* fRefresh */, pList);
    527527    if (SUCCEEDED(rc))
    528528    {
    529         SafeIfaceArray<IMedium> array(*pList);
    530         array.detachTo(ComSafeArrayOutArg(aDrives));
     529        aDVDDrives.resize(pList->size());
     530        size_t i = 0;
     531        for (MediaList::const_iterator it= pList->begin(); it!= pList->end(); ++it, ++i)
     532        {
     533            (*it).queryInterfaceTo(aDVDDrives[i].asOutParam());
     534        }
    531535    }
    532536
     
    540544 * @param drives address of result pointer
    541545 */
    542 STDMETHODIMP Host::COMGETTER(FloppyDrives)(ComSafeArrayOut(IMedium *, aDrives))
    543 {
    544     CheckComArgOutPointerValid(aDrives);
    545 
    546     AutoCaller autoCaller(this);
    547     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    548 
     546HRESULT Host::getFloppyDrives(std::vector<ComPtr<IMedium> > &aFloppyDrives)
     547{
    549548    AutoWriteLock alock(m->pParent->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
    550549
    551550    MediaList *pList;
    552     HRESULT rc = getDrives(DeviceType_Floppy, true /* fRefresh */, pList);
     551    HRESULT rc = i_getDrives(DeviceType_Floppy, true /* fRefresh */, pList);
    553552    if (SUCCEEDED(rc))
    554553    {
    555         SafeIfaceArray<IMedium> collection(*pList);
    556         collection.detachTo(ComSafeArrayOutArg(aDrives));
     554        aFloppyDrives.resize(pList->size());
     555        size_t i = 0;
     556        for (MediaList::const_iterator it = pList->begin(); it != pList->end(); ++it, ++i)
     557        {
     558            (*it).queryInterfaceTo(aFloppyDrives[i].asOutParam());
     559        }
    557560    }
    558561
     
    610613 * @param drives address of result pointer
    611614 */
    612 STDMETHODIMP Host::COMGETTER(NetworkInterfaces)(ComSafeArrayOut(IHostNetworkInterface*, aNetworkInterfaces))
     615HRESULT Host::getNetworkInterfaces(std::vector<ComPtr<IHostNetworkInterface> > &aNetworkInterfaces)
    613616{
    614617#if defined(RT_OS_WINDOWS) ||  defined(VBOX_WITH_NETFLT) /*|| defined(RT_OS_OS2)*/
    615     if (ComSafeArrayOutIsNull(aNetworkInterfaces))
    616         return E_POINTER;
    617 
    618     AutoCaller autoCaller(this);
    619     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    620 
    621618    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    622619# ifdef VBOX_WITH_HOSTNETIF_API
    623     int rc = updateNetIfList();
     620    int rc = i_updateNetIfList();
    624621    if (rc)
    625622    {
    626623        Log(("Failed to get host network interface list with rc=%Rrc\n", rc));
    627624    }
    628 
    629     SafeIfaceArray<IHostNetworkInterface> networkInterfaces (m->llNetIfs);
    630     networkInterfaces.detachTo(ComSafeArrayOutArg(aNetworkInterfaces));
     625    aNetworkInterfaces.resize(m->llNetIfs.size());
     626    size_t i = 0;
     627    for (HostNetworkInterfaceList::iterator it = m->llNetIfs.begin(); it != m->llNetIfs.end(); ++it, ++i)
     628    {
     629        (*it).queryInterfaceTo(aNetworkInterfaces[i].asOutParam());
     630    }
    631631
    632632    return S_OK;
     
    793793}
    794794
    795 STDMETHODIMP Host::COMGETTER(USBDevices)(ComSafeArrayOut(IHostUSBDevice*, aUSBDevices))
     795HRESULT Host::getUSBDevices(std::vector<ComPtr<IHostUSBDevice> > &aUSBDevices)
    796796{
    797797#ifdef VBOX_WITH_USB
    798     CheckComArgOutSafeArrayPointerValid(aUSBDevices);
    799 
    800     AutoCaller autoCaller(this);
    801     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    802 
    803798    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    804 
    805     HRESULT rc = checkUSBProxyService();
     799    aUSBDevices.resize(0);
     800    HRESULT rc = i_checkUSBProxyService();
    806801    if (FAILED(rc)) return rc;
    807 
    808     return m->pUSBProxyService->getDeviceCollection(ComSafeArrayOutArg(aUSBDevices));
     802    SafeIfaceArray<IHostUSBDevice> resultArr;
     803    rc = m->pUSBProxyService->getDeviceCollection(ComSafeArrayAsOutParam(resultArr));
     804    if (FAILED(rc)) return rc;
     805    aUSBDevices.resize(resultArr.size());
     806    for (size_t i = 0; i < resultArr.size(); ++i)
     807    {
     808         ComObjPtr<IHostUSBDevice> iHu = static_cast<IHostUSBDevice *>(resultArr[i]);
     809         iHu.queryInterfaceTo(aUSBDevices[i].asOutParam());
     810    }
     811
     812    return rc;
    809813
    810814#else
     
    812816     * extended error info to indicate that USB is simply not available
    813817     * (w/o treating it as a failure), for example, as in OSE. */
    814     NOREF(aUSBDevices);
     818    NOREF(aUSBDeviceFilters);
    815819# ifndef RT_OS_WINDOWS
    816     NOREF(aUSBDevicesSize);
     820    NOREF(aUSBDeviceFiltersSize);
    817821# endif
    818822    ReturnComNotImplemented();
    819823#endif
    820 }
    821 
     824    return S_OK;
     825}
    822826
    823827/**
    824828 * This method return the list of registered name servers
    825829 */
    826 STDMETHODIMP Host::COMGETTER(NameServers)(ComSafeArrayOut(BSTR, aNameServers))
    827 {
    828     CheckComArgOutSafeArrayPointerValid(aNameServers);
    829 
    830     AutoCaller autoCaller(this);
    831     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    832 
     830HRESULT Host::getNameServers(std::vector<com::Utf8Str> &aNameServers)
     831{
    833832    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    834833
    835     return m->hostDnsMonitorProxy.GetNameServers(ComSafeArrayOutArg(aNameServers));
     834    aNameServers.resize(0);
     835    com::SafeArray<BSTR> resultArr;
     836    resultArr.setNull();
     837    HRESULT rc = m->hostDnsMonitorProxy.COMGETTER(NameServers)(ComSafeArrayAsOutParam(resultArr));
     838    if (FAILED(rc)) return rc;
     839    aNameServers.resize(resultArr.size());
     840    for (size_t i = 0; i < resultArr.size(); ++i)
     841    {
     842        aNameServers[i] = com::Utf8Str(resultArr[i]);
     843    }
     844    return rc;
    836845}
    837846
     
    840849 * This method returns the domain name of the host
    841850 */
    842 STDMETHODIMP Host::COMGETTER(DomainName)(BSTR *aDomainName)
    843 {
     851HRESULT Host::getDomainName(com::Utf8Str &aDomainName)
     852{
     853    BSTR bstr;
     854    HRESULT rc = m->hostDnsMonitorProxy.COMGETTER(DomainName)(&bstr);
     855    if SUCCEEDED(rc)
     856        aDomainName = com::Utf8Str(bstr);
     857    return rc;
    844858    /* XXX: note here should be synchronization with thread polling state
    845859     * changes in name resoving system on host */
    846 
    847     AutoCaller autoCaller(this);
    848     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    849 
    850     return m->hostDnsMonitorProxy.GetDomainName(aDomainName);
    851860}
    852861
     
    855864 * This method returns the search string.
    856865 */
    857 STDMETHODIMP Host::COMGETTER(SearchStrings)(ComSafeArrayOut(BSTR, aSearchStrings))
    858 {
    859     CheckComArgOutSafeArrayPointerValid(aSearchStrings);
    860 
    861     AutoCaller autoCaller(this);
    862     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    863 
     866HRESULT Host::getSearchStrings(std::vector<com::Utf8Str> &aSearchStrings)
     867{
    864868    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    865 
    866     return m->hostDnsMonitorProxy.GetSearchStrings(ComSafeArrayOutArg(aSearchStrings));
    867 }
    868 
    869 
    870 STDMETHODIMP Host::COMGETTER(USBDeviceFilters)(ComSafeArrayOut(IHostUSBDeviceFilter*, aUSBDeviceFilters))
     869    com::SafeArray<BSTR> resultArr;
     870    resultArr.setNull();
     871    HRESULT rc = m->hostDnsMonitorProxy.COMGETTER(SearchStrings)(ComSafeArrayAsOutParam(resultArr));
     872    if (FAILED(rc)) return rc;
     873    aSearchStrings.resize(resultArr.size());
     874    for (size_t i = 0; i < resultArr.size(); ++i)
     875    {
     876        aSearchStrings[i] = com::Utf8Str(resultArr[i]);
     877    }
     878    return rc;
     879}
     880
     881HRESULT Host::getUSBDeviceFilters(std::vector<ComPtr<IHostUSBDeviceFilter> > &aUSBDeviceFilters)
    871882{
    872883#ifdef VBOX_WITH_USB
    873     CheckComArgOutSafeArrayPointerValid(aUSBDeviceFilters);
    874 
    875     AutoCaller autoCaller(this);
    876     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    877 
    878884    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    879 
    880     HRESULT rc = checkUSBProxyService();
     885    aUSBDeviceFilters.resize(0);
     886    HRESULT rc = i_checkUSBProxyService();
    881887    if (FAILED(rc)) return rc;
    882 
    883     SafeIfaceArray<IHostUSBDeviceFilter> collection(m->llUSBDeviceFilters);
    884     collection.detachTo(ComSafeArrayOutArg(aUSBDeviceFilters));
     888    aUSBDeviceFilters.resize(m->llUSBDeviceFilters.size());
     889    size_t i = 0;
     890    for (USBDeviceFilterList::iterator it = m->llUSBDeviceFilters.begin(); it != m->llUSBDeviceFilters.end(); ++it, ++i)
     891    {
     892        (*it).queryInterfaceTo(aUSBDeviceFilters[i].asOutParam());
     893    }
    885894
    886895    return rc;
     
    900909 * Returns the number of installed logical processors
    901910 *
    902  * @returns COM status code
     911 * @returns VBOX status code
    903912 * @param   count address of result variable
    904913 */
    905 STDMETHODIMP Host::COMGETTER(ProcessorCount)(ULONG *aCount)
    906 {
    907     CheckComArgOutPointerValid(aCount);
     914
     915HRESULT Host::getProcessorCount(ULONG *aCount)
     916{
    908917    // no locking required
    909918
     
    918927 * @param   count address of result variable
    919928 */
    920 STDMETHODIMP Host::COMGETTER(ProcessorOnlineCount)(ULONG *aCount)
    921 {
    922     CheckComArgOutPointerValid(aCount);
     929HRESULT Host::getProcessorOnlineCount(ULONG *aCount)
     930{
    923931    // no locking required
    924932
     
    933941 * @param   count address of result variable
    934942 */
    935 STDMETHODIMP Host::COMGETTER(ProcessorCoreCount)(ULONG *aCount)
    936 {
    937     CheckComArgOutPointerValid(aCount);
     943HRESULT Host::getProcessorCoreCount(ULONG *aCount)
     944{
    938945    // no locking required
    939946
     
    948955 * @param   count address of result variable
    949956 */
    950 STDMETHODIMP Host::COMGETTER(ProcessorOnlineCoreCount)(ULONG *aCount)
    951 {
    952     CheckComArgOutPointerValid(aCount);
     957HRESULT Host::getProcessorOnlineCoreCount(ULONG *aCount)
     958{
    953959    // no locking required
    954960
     
    964970 * @param   speed address of result variable, speed is 0 if unknown or aCpuId is invalid.
    965971 */
    966 STDMETHODIMP Host::GetProcessorSpeed(ULONG aCpuId, ULONG *aSpeed)
    967 {
    968     CheckComArgOutPointerValid(aSpeed);
     972HRESULT Host::getProcessorSpeed(ULONG aCpuId,
     973                                ULONG *aSpeed)
     974{
    969975    // no locking required
    970976
     
    980986 * @param   description address of result variable, empty string if not known or aCpuId is invalid.
    981987 */
    982 STDMETHODIMP Host::GetProcessorDescription(ULONG aCpuId, BSTR *aDescription)
    983 {
    984     CheckComArgOutPointerValid(aDescription);
     988HRESULT  Host::getProcessorDescription(ULONG aCpuId, com::Utf8Str &aDescription)
     989{
    985990    // no locking required
    986991
    987992    char szCPUModel[80];
     993    szCPUModel[0] = *"\0";
    988994    int vrc = RTMpGetDescription(aCpuId, szCPUModel, sizeof(szCPUModel));
    989995    if (RT_FAILURE(vrc))
    990996        return E_FAIL; /** @todo error reporting? */
    991     Bstr (szCPUModel).cloneTo(aDescription);
     997    aDescription = Utf8Str(szCPUModel);
    992998    return S_OK;
    993999}
     
    10001006 * @param   address of supported bool result variable
    10011007 */
    1002 STDMETHODIMP Host::GetProcessorFeature(ProcessorFeature_T aFeature, BOOL *aSupported)
     1008HRESULT  Host::getProcessorFeature(ProcessorFeature_T aFeature, BOOL *aSupported)
    10031009{
    10041010    /* Validate input. */
    1005     CheckComArgOutPointerValid(aSupported);
    10061011    switch (aFeature)
    10071012    {
     
    10921097 * @param   aValEDX             Where to return EDX.
    10931098 */
    1094 STDMETHODIMP Host::GetProcessorCPUIDLeaf(ULONG aCpuId, ULONG aLeaf, ULONG aSubLeaf,
    1095                                          ULONG *aValEAX, ULONG *aValEBX, ULONG *aValECX, ULONG *aValEDX)
    1096 {
    1097     CheckComArgOutPointerValid(aValEAX);
    1098     CheckComArgOutPointerValid(aValEBX);
    1099     CheckComArgOutPointerValid(aValECX);
    1100     CheckComArgOutPointerValid(aValEDX);
     1099HRESULT Host::getProcessorCPUIDLeaf(ULONG aCpuId, ULONG aLeaf, ULONG aSubLeaf,
     1100                                    ULONG *aValEAX, ULONG *aValEBX, ULONG *aValECX, ULONG *aValEDX)
     1101{
    11011102    // no locking required
    11021103
     
    11241125 * @param   size address of result variable
    11251126 */
    1126 STDMETHODIMP Host::COMGETTER(MemorySize)(ULONG *aSize)
    1127 {
    1128     CheckComArgOutPointerValid(aSize);
     1127HRESULT Host::getMemorySize(ULONG *aSize)
     1128{
    11291129    // no locking required
    11301130
     
    11431143 * @param   available address of result variable
    11441144 */
    1145 STDMETHODIMP Host::COMGETTER(MemoryAvailable)(ULONG *aAvailable)
    1146 {
    1147     CheckComArgOutPointerValid(aAvailable);
     1145HRESULT Host::getMemoryAvailable(ULONG *aAvailable)
     1146{
    11481147    // no locking required
    11491148
     
    11621161 * @param   os address of result variable
    11631162 */
    1164 STDMETHODIMP Host::COMGETTER(OperatingSystem)(BSTR *aOs)
    1165 {
    1166     CheckComArgOutPointerValid(aOs);
     1163HRESULT Host::getOperatingSystem(com::Utf8Str &aOperatingSystem)
     1164{
    11671165    // no locking required
    11681166
     
    11711169    if (RT_FAILURE(vrc))
    11721170        return E_FAIL; /** @todo error reporting? */
    1173     Bstr (szOSName).cloneTo(aOs);
     1171    aOperatingSystem = Utf8Str(szOSName);
    11741172    return S_OK;
    11751173}
     
    11811179 * @param   os address of result variable
    11821180 */
    1183 STDMETHODIMP Host::COMGETTER(OSVersion)(BSTR *aVersion)
    1184 {
    1185     CheckComArgOutPointerValid(aVersion);
     1181HRESULT Host::getOSVersion(com::Utf8Str &aVersion)
     1182{
    11861183    // no locking required
    11871184
     
    12071204    }
    12081205
    1209     Bstr(szOSRelease).cloneTo(aVersion);
     1206    aVersion = szOSRelease;
    12101207    return S_OK;
    12111208}
     
    12171214 * @param   time address of result variable
    12181215 */
    1219 STDMETHODIMP Host::COMGETTER(UTCTime)(LONG64 *aUTCTime)
    1220 {
    1221     CheckComArgOutPointerValid(aUTCTime);
     1216HRESULT Host::getUTCTime(LONG64 *aUTCTime)
     1217{
    12221218    // no locking required
    12231219
     
    12281224}
    12291225
    1230 STDMETHODIMP Host::COMGETTER(Acceleration3DAvailable)(BOOL *aSupported)
    1231 {
    1232     CheckComArgOutPointerValid(aSupported);
    1233     AutoCaller autoCaller(this);
    1234     HRESULT hrc = autoCaller.rc();
    1235     if (SUCCEEDED(hrc))
    1236     {
    1237         AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    1238         if (m->f3DAccelerationSupported != -1)
    1239             *aSupported = m->f3DAccelerationSupported;
    1240         else
    1241         {
    1242             alock.release();
     1226
     1227HRESULT Host::getAcceleration3DAvailable(BOOL *aSupported)
     1228{
     1229    HRESULT hrc = S_OK;
     1230    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     1231    if (m->f3DAccelerationSupported != -1)
     1232        *aSupported = m->f3DAccelerationSupported;
     1233    else
     1234    {
     1235        alock.release();
     1236
    12431237#ifdef VBOX_WITH_CROGL
    1244             bool fSupported = VBoxOglIs3DAccelerationSupported();
     1238        bool fSupported = VBoxOglIs3DAccelerationSupported();
    12451239#else
    1246             bool fSupported = false; /* shoudn't get here, but just in case. */
    1247 #endif
    1248             AutoWriteLock alock2(this COMMA_LOCKVAL_SRC_POS);
    1249             m->f3DAccelerationSupported = fSupported;
    1250             alock2.release();
    1251 
    1252             *aSupported = fSupported;
    1253         }
     1240        bool fSupported = false; /* shoudn't get here, but just in case. */
     1241#endif
     1242        AutoWriteLock alock2(this COMMA_LOCKVAL_SRC_POS);
     1243
     1244        m->f3DAccelerationSupported = fSupported;
     1245        alock2.release();
     1246        *aSupported = fSupported;
    12541247    }
    12551248
     
    12611254}
    12621255
    1263 STDMETHODIMP Host::CreateHostOnlyNetworkInterface(IHostNetworkInterface **aHostNetworkInterface,
    1264                                                   IProgress **aProgress)
    1265 {
    1266     CheckComArgOutPointerValid(aHostNetworkInterface);
    1267     CheckComArgOutPointerValid(aProgress);
    1268 
    1269     AutoCaller autoCaller(this);
    1270     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    1271 
     1256HRESULT Host::createHostOnlyNetworkInterface(ComPtr<IHostNetworkInterface> &aHostInterface,
     1257                                             ComPtr<IProgress> &aProgress)
     1258
     1259{
    12721260#ifdef VBOX_WITH_HOSTNETIF_API
    12731261    /* No need to lock anything. If there ever will - watch out, the function
    12741262     * called below grabs the VirtualBox lock. */
    1275 
    1276     int r = NetIfCreateHostOnlyNetworkInterface(m->pParent, aHostNetworkInterface, aProgress);
     1263    IHostNetworkInterface *iHn = static_cast<IHostNetworkInterface *>(aHostInterface);
     1264    IProgress *iHn2 = static_cast<IProgress *>(aProgress);
     1265
     1266    int r = NetIfCreateHostOnlyNetworkInterface(m->pParent, &iHn, &iHn2);
    12771267    if (RT_SUCCESS(r))
    12781268    {
    1279         if (!*aHostNetworkInterface)
     1269        if (!iHn)
    12801270            return setError(E_FAIL,
    12811271                            tr("Unable to create a host network interface"));
     
    12841274        Bstr tmpAddr, tmpMask, tmpName;
    12851275        HRESULT hrc;
    1286         hrc = (*aHostNetworkInterface)->COMGETTER(Name)(tmpName.asOutParam());
     1276        hrc = aHostInterface->COMGETTER(Name)(tmpName.asOutParam());
    12871277        ComAssertComRCRet(hrc, hrc);
    1288         hrc = (*aHostNetworkInterface)->COMGETTER(IPAddress)(tmpAddr.asOutParam());
     1278        hrc = aHostInterface->COMGETTER(IPAddress)(tmpAddr.asOutParam());
    12891279        ComAssertComRCRet(hrc, hrc);
    1290         hrc = (*aHostNetworkInterface)->COMGETTER(NetworkMask)(tmpMask.asOutParam());
     1280        hrc = aHostInterface->COMGETTER(NetworkMask)(tmpMask.asOutParam());
    12911281        ComAssertComRCRet(hrc, hrc);
    12921282        /*
     
    12991289        hrc = m->pParent->SetExtraData(BstrFmt("HostOnly/%ls/IPAddress",
    13001290                                               tmpName.raw()).raw(),
    1301                                        tmpAddr.raw());
     1291                                               tmpAddr.raw());
    13021292        ComAssertComRCRet(hrc, hrc);
    13031293
    13041294        hrc = m->pParent->SetExtraData(BstrFmt("HostOnly/%ls/IPNetMask",
    13051295                                               tmpName.raw()).raw(),
    1306                                        tmpMask.raw());
     1296                                               tmpMask.raw());
    13071297        ComAssertComRCRet(hrc, hrc);
    13081298#endif
     
    13151305}
    13161306
    1317 STDMETHODIMP Host::RemoveHostOnlyNetworkInterface(IN_BSTR aId,
    1318                                                   IProgress **aProgress)
    1319 {
    1320     CheckComArgOutPointerValid(aProgress);
    1321 
    1322     AutoCaller autoCaller(this);
    1323     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    1324 
     1307HRESULT Host::removeHostOnlyNetworkInterface(const com::Guid &aId,
     1308                                             ComPtr<IProgress> &aProgress)
     1309
     1310{
    13251311#ifdef VBOX_WITH_HOSTNETIF_API
    13261312    /* No need to lock anything, the code below does not touch the state
     
    13341320    {
    13351321        ComPtr<IHostNetworkInterface> iface;
    1336         if (FAILED(FindHostNetworkInterfaceById(aId,
    1337                                                 iface.asOutParam())))
     1322        rc  = findHostNetworkInterfaceById(aId, iface);
     1323        if (FAILED(rc))
    13381324            return setError(VBOX_E_OBJECT_NOT_FOUND,
    13391325                            tr("Host network interface with UUID {%RTuuid} does not exist"),
     
    13431329    }
    13441330
    1345     int r = NetIfRemoveHostOnlyNetworkInterface(m->pParent, Guid(aId).ref(), aProgress);
     1331    IProgress *iPr  = static_cast<IProgress *>(aProgress);
     1332
     1333    int r = NetIfRemoveHostOnlyNetworkInterface(m->pParent, Guid(aId).ref(), &iPr);
    13461334    if (RT_SUCCESS(r))
    13471335    {
     
    13611349}
    13621350
    1363 STDMETHODIMP Host::CreateUSBDeviceFilter(IN_BSTR aName,
    1364                                          IHostUSBDeviceFilter **aFilter)
     1351HRESULT Host::createUSBDeviceFilter(const com::Utf8Str &aName,
     1352                                    ComPtr<IHostUSBDeviceFilter> &aFilter)
    13651353{
    13661354#ifdef VBOX_WITH_USB
    1367     CheckComArgStrNotEmptyOrNull(aName);
    1368     CheckComArgOutPointerValid(aFilter);
    1369 
    1370     AutoCaller autoCaller(this);
    1371     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    13721355
    13731356    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    13751358    ComObjPtr<HostUSBDeviceFilter> filter;
    13761359    filter.createObject();
    1377     HRESULT rc = filter->init(this, aName);
     1360    HRESULT rc = filter->init(this, Bstr(aName).raw());
    13781361    ComAssertComRCRet(rc, rc);
    1379     rc = filter.queryInterfaceTo(aFilter);
     1362    rc = filter.queryInterfaceTo(aFilter.asOutParam());
    13801363    AssertComRCReturn(rc, rc);
    13811364    return S_OK;
     
    13901373}
    13911374
    1392 STDMETHODIMP Host::InsertUSBDeviceFilter(ULONG aPosition,
    1393                                          IHostUSBDeviceFilter *aFilter)
     1375HRESULT Host::insertUSBDeviceFilter(ULONG aPosition,
     1376                                    const ComPtr<IHostUSBDeviceFilter> &aFilter)
    13941377{
    13951378#ifdef VBOX_WITH_USB
    1396     CheckComArgNotNull(aFilter);
    1397 
    13981379    /* Note: HostUSBDeviceFilter and USBProxyService also uses this lock. */
    1399     AutoCaller autoCaller(this);
    1400     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    14011380
    14021381    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    14031382
    14041383    clearError();
    1405     MultiResult rc = checkUSBProxyService();
     1384    MultiResult rc = i_checkUSBProxyService();
    14061385    if (FAILED(rc)) return rc;
    14071386
     
    14451424    return rc = m->pParent->saveSettings();
    14461425#else
     1426
    14471427    /* Note: The GUI depends on this method returning E_NOTIMPL with no
    14481428     * extended error info to indicate that USB is simply not available
     
    14541434}
    14551435
    1456 STDMETHODIMP Host::RemoveUSBDeviceFilter(ULONG aPosition)
     1436HRESULT Host::removeUSBDeviceFilter(ULONG aPosition)
    14571437{
    14581438#ifdef VBOX_WITH_USB
    14591439
    14601440    /* Note: HostUSBDeviceFilter and USBProxyService also uses this lock. */
    1461     AutoCaller autoCaller(this);
    1462     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    1463 
    14641441    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    14651442
    14661443    clearError();
    1467     MultiResult rc = checkUSBProxyService();
     1444    MultiResult rc = i_checkUSBProxyService();
    14681445    if (FAILED(rc)) return rc;
    14691446
     
    15101487}
    15111488
    1512 STDMETHODIMP Host::FindHostDVDDrive(IN_BSTR aName, IMedium **aDrive)
    1513 {
    1514     CheckComArgStrNotEmptyOrNull(aName);
    1515     CheckComArgOutPointerValid(aDrive);
     1489HRESULT Host::findHostDVDDrive(const com::Utf8Str &aName,
     1490                               ComPtr<IMedium> &aDrive)
     1491{
     1492    ComObjPtr<Medium> medium;
     1493    HRESULT rc = i_findHostDriveByNameOrId(DeviceType_DVD, aName, medium);
     1494    if (SUCCEEDED(rc))
     1495        rc = medium.queryInterfaceTo(aDrive.asOutParam());
     1496    else
     1497        rc = setError(rc, Medium::tr("The host DVD drive named '%ls' could not be found"), Bstr(aName).raw());
     1498    return rc;
     1499}
     1500
     1501HRESULT Host::findHostFloppyDrive(const com::Utf8Str &aName, ComPtr<IMedium> &aDrive)
     1502{
     1503    aDrive = NULL;
    15161504
    15171505    ComObjPtr<Medium>medium;
    1518     HRESULT rc = findHostDriveByNameOrId(DeviceType_DVD, Utf8Str(aName), medium);
     1506
     1507    HRESULT rc = i_findHostDriveByNameOrId(DeviceType_Floppy, aName, medium);
    15191508    if (SUCCEEDED(rc))
    1520         return medium.queryInterfaceTo(aDrive);
     1509        return medium.queryInterfaceTo(aDrive.asOutParam());
    15211510    else
    1522         return setError(rc, Medium::tr("The host DVD drive named '%ls' could not be found"), aName);
    1523 }
    1524 
    1525 STDMETHODIMP Host::FindHostFloppyDrive(IN_BSTR aName, IMedium **aDrive)
    1526 {
    1527     CheckComArgStrNotEmptyOrNull(aName);
    1528     CheckComArgOutPointerValid(aDrive);
    1529 
    1530     *aDrive = NULL;
    1531 
    1532     ComObjPtr<Medium>medium;
    1533     HRESULT rc = findHostDriveByNameOrId(DeviceType_Floppy, Utf8Str(aName), medium);
    1534     if (SUCCEEDED(rc))
    1535         return medium.queryInterfaceTo(aDrive);
    1536     else
    1537         return setError(rc, Medium::tr("The host floppy drive named '%ls' could not be found"), aName);
    1538 }
    1539 
    1540 STDMETHODIMP Host::FindHostNetworkInterfaceByName(IN_BSTR name, IHostNetworkInterface **networkInterface)
     1511        return setError(rc, Medium::tr("The host floppy drive named '%ls' could not be found"), Bstr(aName).raw());
     1512}
     1513
     1514HRESULT Host::findHostNetworkInterfaceByName(const com::Utf8Str &aName,
     1515                                             ComPtr<IHostNetworkInterface> &aNetworkInterface)
    15411516{
    15421517#ifndef VBOX_WITH_HOSTNETIF_API
    15431518    return E_NOTIMPL;
    15441519#else
    1545     if (!name)
     1520    if (!aName.length())
    15461521        return E_INVALIDARG;
    1547     if (!networkInterface)
     1522    if (!aNetworkInterface)
    15481523        return E_POINTER;
    15491524
    15501525    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    15511526
    1552     *networkInterface = NULL;
     1527    aNetworkInterface = NULL;
     1528
    15531529    ComObjPtr<HostNetworkInterface> found;
    1554     int rc = updateNetIfList();
     1530    int rc = i_updateNetIfList();
    15551531    if (RT_FAILURE(rc))
    15561532    {
     
    15581534        return E_FAIL;
    15591535    }
    1560     HostNetworkInterfaceList::iterator it;
    1561     for (it = m->llNetIfs.begin(); it != m->llNetIfs.end(); ++it)
     1536    for (HostNetworkInterfaceList::iterator it = m->llNetIfs.begin(); it != m->llNetIfs.end(); ++it)
    15621537    {
    15631538        Bstr n;
    15641539        (*it)->COMGETTER(Name) (n.asOutParam());
    1565         if (n == name)
     1540        if (n == aName)
    15661541            found = *it;
    15671542    }
     
    15711546                        HostNetworkInterface::tr("The host network interface with the given name could not be found"));
    15721547
    1573     return found.queryInterfaceTo(networkInterface);
    1574 #endif
    1575 }
    1576 
    1577 STDMETHODIMP Host::FindHostNetworkInterfaceById(IN_BSTR id, IHostNetworkInterface **networkInterface)
     1548    return found.queryInterfaceTo(aNetworkInterface.asOutParam());
     1549#endif
     1550}
     1551
     1552HRESULT Host::findHostNetworkInterfaceById(const com::Guid &aId,
     1553                                           ComPtr<IHostNetworkInterface> &aNetworkInterface)
    15781554{
    15791555#ifndef VBOX_WITH_HOSTNETIF_API
    15801556    return E_NOTIMPL;
    15811557#else
    1582     if (!Guid(id).isValid())
     1558    if (!aId.isValid())
    15831559        return E_INVALIDARG;
    1584     if (!networkInterface)
     1560    if (!aNetworkInterface)
    15851561        return E_POINTER;
    15861562
    15871563    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    15881564
    1589     *networkInterface = NULL;
     1565    aNetworkInterface = NULL;
     1566
    15901567    ComObjPtr<HostNetworkInterface> found;
    1591     int rc = updateNetIfList();
     1568    int rc = i_updateNetIfList();
    15921569    if (RT_FAILURE(rc))
    15931570    {
     
    16001577        Bstr g;
    16011578        (*it)->COMGETTER(Id) (g.asOutParam());
    1602         if (g == id)
     1579        if (Guid(g) == aId)
    16031580            found = *it;
    16041581    }
     
    16071584        return setError(E_INVALIDARG,
    16081585                        HostNetworkInterface::tr("The host network interface with the given GUID could not be found"));
    1609 
    1610     return found.queryInterfaceTo(networkInterface);
    1611 #endif
    1612 }
    1613 
    1614 STDMETHODIMP Host::FindHostNetworkInterfacesOfType(HostNetworkInterfaceType_T type,
    1615                                                    ComSafeArrayOut(IHostNetworkInterface *, aNetworkInterfaces))
     1586    return found.queryInterfaceTo(aNetworkInterface.asOutParam());
     1587
     1588#endif
     1589}
     1590
     1591HRESULT Host::findHostNetworkInterfacesOfType(HostNetworkInterfaceType_T aType,
     1592                                              std::vector<ComPtr<IHostNetworkInterface> > &aNetworkInterfaces)
    16161593{
    16171594#ifdef VBOX_WITH_HOSTNETIF_API
    16181595    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    16191596
    1620     int rc = updateNetIfList();
     1597    int rc = i_updateNetIfList();
    16211598    if (RT_FAILURE(rc))
    16221599        return E_FAIL;
     
    16241601    HostNetworkInterfaceList resultList;
    16251602
    1626     HostNetworkInterfaceList::iterator it;
    1627     for (it = m->llNetIfs.begin(); it != m->llNetIfs.end(); ++it)
     1603    for (HostNetworkInterfaceList::iterator it = m->llNetIfs.begin(); it != m->llNetIfs.end(); ++it)
    16281604    {
    16291605        HostNetworkInterfaceType_T t;
     
    16321608            return hr;
    16331609
    1634         if (t == type)
    1635             resultList.push_back (*it);
    1636     }
    1637 
    1638     SafeIfaceArray<IHostNetworkInterface> filteredNetworkInterfaces (resultList);
    1639     filteredNetworkInterfaces.detachTo(ComSafeArrayOutArg(aNetworkInterfaces));
     1610        if (t == aType)
     1611            resultList.push_back(*it);
     1612    }
     1613    aNetworkInterfaces.resize(resultList.size());
     1614    size_t i = 0;
     1615    for (HostNetworkInterfaceList::iterator it = resultList.begin(); it != resultList.end(); ++it, ++i)
     1616    {
     1617        (*it).queryInterfaceTo(aNetworkInterfaces[i].asOutParam());
     1618    }
    16401619
    16411620    return S_OK;
     
    16451624}
    16461625
    1647 STDMETHODIMP Host::FindUSBDeviceByAddress(IN_BSTR aAddress,
    1648                                           IHostUSBDevice **aDevice)
     1626HRESULT Host::findUSBDeviceByAddress(const com::Utf8Str &aName,
     1627                                     ComPtr<IHostUSBDevice> &aDevice)
    16491628{
    16501629#ifdef VBOX_WITH_USB
    1651     CheckComArgStrNotEmptyOrNull(aAddress);
    1652     CheckComArgOutPointerValid(aDevice);
    1653 
    1654     *aDevice = NULL;
    1655 
     1630
     1631    aDevice = NULL;
    16561632    SafeIfaceArray<IHostUSBDevice> devsvec;
    16571633    HRESULT rc = COMGETTER(USBDevices) (ComSafeArrayAsOutParam(devsvec));
     
    16631639        rc = devsvec[i]->COMGETTER(Address) (address.asOutParam());
    16641640        if (FAILED(rc)) return rc;
    1665         if (address == aAddress)
    1666         {
    1667             return ComObjPtr<IHostUSBDevice> (devsvec[i]).queryInterfaceTo(aDevice);
     1641        if (address == aName)
     1642        {
     1643            ComObjPtr<IHostUSBDevice> (devsvec[i]).queryInterfaceTo(aDevice.asOutParam());
     1644            return S_OK;
    16681645        }
    16691646    }
     
    16711648    return setErrorNoLog(VBOX_E_OBJECT_NOT_FOUND,
    16721649                         tr("Could not find a USB device with address '%ls'"),
    1673                          aAddress);
     1650                         Bstr(aName).raw());
    16741651
    16751652#else   /* !VBOX_WITH_USB */
     
    16791656#endif  /* !VBOX_WITH_USB */
    16801657}
    1681 
    1682 STDMETHODIMP Host::FindUSBDeviceById(IN_BSTR aId,
    1683                                      IHostUSBDevice **aDevice)
     1658HRESULT Host::findUSBDeviceById(const com::Guid &aId,
     1659                                ComPtr<IHostUSBDevice> &aDevice)
    16841660{
    16851661#ifdef VBOX_WITH_USB
    1686     CheckComArgExpr(aId, Guid (aId).isValid());
    1687     CheckComArgOutPointerValid(aDevice);
    1688 
    1689     *aDevice = NULL;
     1662    if (!aId.isValid())
     1663        return E_INVALIDARG;
     1664
     1665    aDevice = NULL;
    16901666
    16911667    SafeIfaceArray<IHostUSBDevice> devsvec;
     
    16981674        rc = devsvec[i]->COMGETTER(Id) (id.asOutParam());
    16991675        if (FAILED(rc)) return rc;
    1700         if (id == aId)
    1701         {
    1702             return ComObjPtr<IHostUSBDevice> (devsvec[i]).queryInterfaceTo(aDevice);
    1703         }
    1704     }
    1705 
     1676        if (Guid(id) == aId)
     1677        {
     1678            ComObjPtr<IHostUSBDevice> (devsvec[i]).queryInterfaceTo(aDevice.asOutParam());
     1679            return rc;
     1680        }
     1681    }
    17061682    return setErrorNoLog (VBOX_E_OBJECT_NOT_FOUND, tr (
    17071683        "Could not find a USB device with uuid {%RTuuid}"),
    1708         Guid (aId).raw());
     1684        aId.raw());
    17091685
    17101686#else   /* !VBOX_WITH_USB */
     
    17151691}
    17161692
    1717 STDMETHODIMP Host::GenerateMACAddress(BSTR *aAddress)
    1718 {
    1719     CheckComArgOutPointerValid(aAddress);
     1693HRESULT Host::generateMACAddress(com::Utf8Str &aAddress)
     1694{
    17201695    // no locking required
    1721     Utf8Str mac;
    1722     generateMACAddress(mac);
    1723     Bstr(mac).cloneTo(aAddress);
     1696    i_generateMACAddress(aAddress);
    17241697    return S_OK;
    17251698}
     
    17311704 * @param aVideoInputDevices Array of interface pointers to be filled.
    17321705 */
    1733 STDMETHODIMP Host::COMGETTER(VideoInputDevices)(ComSafeArrayOut(IHostVideoInputDevice*, aVideoInputDevices))
    1734 {
    1735     if (ComSafeArrayOutIsNull(aVideoInputDevices))
    1736         return E_POINTER;
    1737 
    1738     AutoCaller autoCaller(this);
    1739     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    1740 
     1706HRESULT Host::getVideoInputDevices(std::vector<ComPtr<IHostVideoInputDevice> > &aVideoInputDevices)
     1707{
    17411708    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    17421709    HostVideoInputDeviceList list;
     
    17461713    if (SUCCEEDED(hr))
    17471714    {
    1748         SafeIfaceArray<IHostVideoInputDevice> devices(list);
    1749         devices.detachTo(ComSafeArrayOutArg(aVideoInputDevices));
     1715        size_t i = 0;
     1716        for (HostVideoInputDeviceList::const_iterator it = list.begin(); it != list.end(); ++it, ++i)
     1717        {
     1718            (*it).queryInterfaceTo(aVideoInputDevices[i].asOutParam());
     1719        }
    17501720    }
    17511721
     
    17561726////////////////////////////////////////////////////////////////////////////////
    17571727
    1758 HRESULT Host::loadSettings(const settings::Host &data)
     1728HRESULT Host::i_loadSettings(const settings::Host &data)
    17591729{
    17601730    HRESULT rc = S_OK;
     
    17911761}
    17921762
    1793 HRESULT Host::saveSettings(settings::Host &data)
     1763HRESULT Host::i_saveSettings(settings::Host &data)
    17941764{
    17951765#ifdef VBOX_WITH_USB
     
    18341804 * @return
    18351805 */
    1836 HRESULT Host::getDrives(DeviceType_T mediumType,
    1837                         bool fRefresh,
    1838                         MediaList *&pll)
     1806HRESULT Host::i_getDrives(DeviceType_T mediumType,
     1807                          bool fRefresh,
     1808                          MediaList *&pll)
    18391809{
    18401810    HRESULT rc = S_OK;
     
    18501820            if (!m->fDVDDrivesListBuilt || fRefresh)
    18511821            {
    1852                 rc = buildDVDDrivesList(llNew);
     1822                rc = i_buildDVDDrivesList(llNew);
    18531823                if (FAILED(rc))
    18541824                    return rc;
     
    18611831            if (!m->fFloppyDrivesListBuilt || fRefresh)
    18621832            {
    1863                 rc = buildFloppyDrivesList(llNew);
     1833                rc = i_buildFloppyDrivesList(llNew);
    18641834                if (FAILED(rc))
    18651835                    return rc;
     
    19571927 * @return VBOX_E_OBJECT_NOT_FOUND if not found, or S_OK if found, or errors from getDrives().
    19581928 */
    1959 HRESULT Host::findHostDriveById(DeviceType_T mediumType,
    1960                                 const Guid &uuid,
    1961                                 bool fRefresh,
    1962                                 ComObjPtr<Medium> &pMedium)
     1929HRESULT Host::i_findHostDriveById(DeviceType_T mediumType,
     1930                                  const Guid &uuid,
     1931                                  bool fRefresh,
     1932                                  ComObjPtr<Medium> &pMedium)
    19631933{
    19641934    MediaList *pllMedia;
    19651935
    19661936    AutoWriteLock wlock(m->pParent->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
    1967     HRESULT rc = getDrives(mediumType, fRefresh, pllMedia);
     1937    HRESULT rc = i_getDrives(mediumType, fRefresh, pllMedia);
    19681938    if (SUCCEEDED(rc))
    19691939    {
     
    19971967 * @return VBOX_E_OBJECT_NOT_FOUND if not found, or S_OK if found, or errors from getDrives().
    19981968 */
    1999 HRESULT Host::findHostDriveByName(DeviceType_T mediumType,
    2000                                   const Utf8Str &strLocationFull,
    2001                                   bool fRefresh,
    2002                                   ComObjPtr<Medium> &pMedium)
     1969HRESULT Host::i_findHostDriveByName(DeviceType_T mediumType,
     1970                                    const Utf8Str &strLocationFull,
     1971                                    bool fRefresh,
     1972                                    ComObjPtr<Medium> &pMedium)
    20031973{
    20041974    MediaList *pllMedia;
    20051975
    20061976    AutoWriteLock wlock(m->pParent->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
    2007     HRESULT rc = getDrives(mediumType, fRefresh, pllMedia);
     1977    HRESULT rc = i_getDrives(mediumType, fRefresh, pllMedia);
    20081978    if (SUCCEEDED(rc))
    20091979    {
     
    20362006 * @return VBOX_E_OBJECT_NOT_FOUND if not found, or S_OK if found, or errors from getDrives().
    20372007 */
    2038 HRESULT Host::findHostDriveByNameOrId(DeviceType_T mediumType,
    2039                                       const Utf8Str &strNameOrId,
    2040                                       ComObjPtr<Medium> &pMedium)
     2008HRESULT Host::i_findHostDriveByNameOrId(DeviceType_T mediumType,
     2009                                        const Utf8Str &strNameOrId,
     2010                                        ComObjPtr<Medium> &pMedium)
    20412011{
    20422012    AutoWriteLock wlock(m->pParent->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
     
    20442014    Guid uuid(strNameOrId);
    20452015    if (uuid.isValid() && !uuid.isZero())
    2046         return findHostDriveById(mediumType, uuid, true /* fRefresh */, pMedium);
     2016        return i_findHostDriveById(mediumType, uuid, true /* fRefresh */, pMedium);
    20472017
    20482018    // string is not a syntactically valid UUID: try a name then
    2049     return findHostDriveByName(mediumType, strNameOrId, true /* fRefresh */, pMedium);
     2019    return i_findHostDriveByName(mediumType, strNameOrId, true /* fRefresh */, pMedium);
    20502020}
    20512021
     
    20552025 * @return
    20562026 */
    2057 HRESULT Host::buildDVDDrivesList(MediaList &list)
     2027HRESULT Host::i_buildDVDDrivesList(MediaList &list)
    20582028{
    20592029    HRESULT rc = S_OK;
     
    21372107 * @return
    21382108 */
    2139 HRESULT Host::buildFloppyDrivesList(MediaList &list)
     2109HRESULT Host::i_buildFloppyDrivesList(MediaList &list)
    21402110{
    21412111    HRESULT rc = S_OK;
     
    21942164
    21952165#ifdef VBOX_WITH_USB
    2196 USBProxyService* Host::usbProxyService()
     2166USBProxyService* Host::i_usbProxyService()
    21972167{
    21982168    return m->pUSBProxyService;
    21992169}
    22002170
    2201 HRESULT Host::addChild(HostUSBDeviceFilter *pChild)
     2171HRESULT Host::i_addChild(HostUSBDeviceFilter *pChild)
    22022172{
    22032173    AutoCaller autoCaller(this);
     
    22112181}
    22122182
    2213 HRESULT Host::removeChild(HostUSBDeviceFilter *pChild)
     2183HRESULT Host::i_removeChild(HostUSBDeviceFilter *pChild)
    22142184{
    22152185    AutoCaller autoCaller(this);
     
    22322202}
    22332203
    2234 VirtualBox* Host::parent()
     2204VirtualBox* Host::i_parent()
    22352205{
    22362206    return m->pParent;
     
    22402210 *  Called by setter methods of all USB device filters.
    22412211 */
    2242 HRESULT Host::onUSBDeviceFilterChange(HostUSBDeviceFilter *aFilter,
    2243                                       BOOL aActiveChanged /* = FALSE */)
     2212HRESULT Host::i_onUSBDeviceFilterChange(HostUSBDeviceFilter *aFilter,
     2213                                        BOOL aActiveChanged /* = FALSE */)
    22442214{
    22452215    AutoCaller autoCaller(this);
     
    22942264 * @param   aMachines           Where to put the machine vector.
    22952265 */
    2296 void Host::getUSBFilters(Host::USBDeviceFilterList *aGlobalFilters)
     2266void Host::i_getUSBFilters(Host::USBDeviceFilterList *aGlobalFilters)
    22972267{
    22982268    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    29542924 *  @note Locks this object for reading.
    29552925 */
    2956 HRESULT Host::checkUSBProxyService()
     2926HRESULT Host::i_checkUSBProxyService()
    29572927{
    29582928    AutoCaller autoCaller(this);
     
    29922962#endif /* VBOX_WITH_USB */
    29932963
    2994 HRESULT Host::updateNetIfList()
     2964HRESULT Host::i_updateNetIfList()
    29952965{
    29962966#ifdef VBOX_WITH_HOSTNETIF_API
     
    30683038#ifdef VBOX_WITH_RESOURCE_USAGE_API
    30693039
    3070 void Host::registerDiskMetrics(PerformanceCollector *aCollector)
     3040void Host::i_registerDiskMetrics(PerformanceCollector *aCollector)
    30713041{
    30723042    pm::CollectorHAL *hal = aCollector->getHAL();
     
    31543124}
    31553125
    3156 void Host::registerMetrics(PerformanceCollector *aCollector)
     3126void Host::i_registerMetrics(PerformanceCollector *aCollector)
    31573127{
    31583128    pm::CollectorHAL *hal = aCollector->getHAL();
     
    32873257    aCollector->registerMetric(new pm::Metric(ramVmm, ramVMMShared,
    32883258                                              new pm::AggregateMax()));
    3289     registerDiskMetrics(aCollector);
    3290 }
    3291 
    3292 void Host::unregisterMetrics (PerformanceCollector *aCollector)
     3259    i_registerDiskMetrics(aCollector);
     3260}
     3261
     3262void Host::i_unregisterMetrics (PerformanceCollector *aCollector)
    32933263{
    32943264    aCollector->unregisterMetricsFor(this);
     
    33003270
    33013271/* static */
    3302 void Host::generateMACAddress(Utf8Str &mac)
     3272void Host::i_generateMACAddress(Utf8Str &mac)
    33033273{
    33043274    /*
  • trunk/src/VBox/Main/src-server/MachineImpl.cpp

    r49644 r49742  
    27062706
    27072707# ifdef VBOX_WITH_USB
    2708     rc = mParent->host()->checkUSBProxyService();
     2708    rc = mParent->host()->i_checkUSBProxyService();
    27092709    if (FAILED(rc)) return rc;
    27102710# endif
     
    27362736
    27372737# ifdef VBOX_WITH_USB
    2738     rc = mParent->host()->checkUSBProxyService();
     2738    rc = mParent->host()->i_checkUSBProxyService();
    27392739    if (FAILED(rc)) return rc;
    27402740# endif
     
    57245724                pMedium->Close();
    57255725            }
     5726
    57265727        }
    57275728        setMachineState(oldState);
     
    96679668            case DeviceType_DVD:
    96689669                if (dev.strHostDriveSrc.isNotEmpty())
    9669                     rc = mParent->host()->findHostDriveByName(dev.deviceType, dev.strHostDriveSrc, false /* fRefresh */, medium);
     9670                    rc = mParent->host()->i_findHostDriveByName(dev.deviceType, dev.strHostDriveSrc, false /* fRefresh */, medium);
    96709671                else
    96719672                    rc = mParent->findRemoveableMedium(dev.deviceType,
     
    1297812979        NOREF(rc);
    1297912980
    12980         USBProxyService *service = mParent->host()->usbProxyService();
     12981        USBProxyService *service = mParent->host()->i_usbProxyService();
    1298112982        if (service)
    1298212983            service->detachAllDevicesFromVM(this, true /* aDone */, true /* aAbnormal */);
     
    1344513446    /* if captureDeviceForVM() fails, it must have set extended error info */
    1344613447    clearError();
    13447     MultiResult rc = mParent->host()->checkUSBProxyService();
     13448    MultiResult rc = mParent->host()->i_checkUSBProxyService();
    1344813449    if (FAILED(rc)) return rc;
    1344913450
    13450     USBProxyService *service = mParent->host()->usbProxyService();
     13451    USBProxyService *service = mParent->host()->i_usbProxyService();
    1345113452    AssertReturn(service, E_FAIL);
    1345213453    return service->captureDeviceForVM(this, Guid(aId).ref());
     
    1346813469
    1346913470#ifdef VBOX_WITH_USB
    13470     USBProxyService *service = mParent->host()->usbProxyService();
     13471    USBProxyService *service = mParent->host()->i_usbProxyService();
    1347113472    AssertReturn(service, E_FAIL);
    1347213473    return service->detachDeviceFromVM(this, Guid(aId).ref(), !!aDone);
     
    1349813499    NOREF(rc);
    1349913500
    13500     USBProxyService *service = mParent->host()->usbProxyService();
     13501    USBProxyService *service = mParent->host()->i_usbProxyService();
    1350113502    AssertReturn(service, E_FAIL);
    1350213503    return service->autoCaptureDevicesForVM(this);
     
    1352813529    NOREF(rc);
    1352913530
    13530     USBProxyService *service = mParent->host()->usbProxyService();
     13531    USBProxyService *service = mParent->host()->i_usbProxyService();
    1353113532    AssertReturn(service, E_FAIL);
    1353213533    return service->detachAllDevicesFromVM(this, !!aDone, false /* aAbnormal */);
  • trunk/src/VBox/Main/src-server/MachineImplCloneVM.cpp

    r49039 r49742  
    582582            && it->mode == NetworkAttachmentType_NAT)
    583583            continue;
    584         Host::generateMACAddress(it->strMACAddress);
     584        Host::i_generateMACAddress(it->strMACAddress);
    585585    }
    586586}
  • trunk/src/VBox/Main/src-server/NATNetworkImpl.cpp

    r49614 r49742  
    3232
    3333#include "EventImpl.h"
    34 #include "VBoxEvents.h"
    3534
    3635#include "VirtualBoxImpl.h"
     
    4746// constructor / destructor
    4847/////////////////////////////////////////////////////////////////////////////
    49 
    5048struct NATNetwork::Data
    5149{
     
    7371    ComObjPtr<IDHCPServer> dhcpServer;
    7472#endif
    75     Bstr IPv4Gateway;
    76     Bstr IPv4NetworkCidr;
    77     Bstr IPv4NetworkMask;
    78     Bstr IPv4DhcpServer;
    79     Bstr IPv4DhcpServerLowerIp;
    80     Bstr IPv4DhcpServerUpperIp;
     73    com::Utf8Str IPv4Gateway;
     74    com::Utf8Str IPv4NetworkCidr;
     75    com::Utf8Str IPv4NetworkMask;
     76    com::Utf8Str IPv4DhcpServer;
     77    com::Utf8Str IPv4DhcpServerLowerIp;
     78    com::Utf8Str IPv4DhcpServerUpperIp;
    8179    BOOL fEnabled;
    8280    BOOL fIPv6Enabled;
    83     Bstr IPv6Prefix;
     81    com::Utf8Str IPv6Prefix;
    8482    BOOL fAdvertiseDefaultIPv6Route;
    8583    BOOL fNeedDhcpServer;
    8684    NATRuleMap mapName2PortForwardRule4;
    8785    NATRuleMap mapName2PortForwardRule6;
    88     settings::NATLoopbackOffsetList llNATLoopbackOffsetList;
     86    settings::NATLoopbackOffsetList maNATLoopbackOffsetList;
    8987    uint32_t u32LoopbackIp6;
    9088    uint32_t offGateway;
     
    129127}
    130128
    131 
    132 HRESULT NATNetwork::init(VirtualBox *aVirtualBox, IN_BSTR aName)
    133 {
    134     AssertReturn(aName != NULL, E_INVALIDARG);
     129HRESULT NATNetwork::init(VirtualBox *aVirtualBox, com::Utf8Str aName)
     130{
     131    AssertReturn(!aName.isEmpty(), E_INVALIDARG);
    135132
    136133    AutoInitSpan autoInitSpan(this);
     
    148145    off.strLoopbackHostAddress = "127.0.0.1";
    149146    off.u32Offset = (uint32_t)2;
    150     m->llNATLoopbackOffsetList.push_back(off);
    151 
    152     recalculateIpv4AddressAssignments();
     147    m->maNATLoopbackOffsetList.push_back(off);
     148
     149    i_recalculateIpv4AddressAssignments();
    153150
    154151    HRESULT hrc = unconst(m->pEventSource).createObject();
     
    185182    m->u32LoopbackIp6 = data.u32HostLoopback6Offset;
    186183
    187     m->llNATLoopbackOffsetList.clear();
    188     m->llNATLoopbackOffsetList.assign(data.llHostLoopbackOffsetList.begin(),
     184    m->maNATLoopbackOffsetList.clear();
     185    m->maNATLoopbackOffsetList.assign(data.llHostLoopbackOffsetList.begin(),
    189186                               data.llHostLoopbackOffsetList.end());
    190187
    191     recalculateIpv4AddressAssignments();
     188    i_recalculateIpv4AddressAssignments();
    192189
    193190    /* IPv4 port-forward rules */
     
    218215}
    219216
    220 
    221 HRESULT NATNetwork::saveSettings(settings::NATNetwork &data)
     217HRESULT NATNetwork::i_saveSettings(settings::NATNetwork &data)
    222218{
    223219    AutoCaller autoCaller(this);
     
    249245
    250246    data.llHostLoopbackOffsetList.clear();
    251     data.llHostLoopbackOffsetList.assign(m->llNATLoopbackOffsetList.begin(),
    252                                          m->llNATLoopbackOffsetList.end());
    253 
    254     mVirtualBox->onNATNetworkSetting(mName.raw(),
     247    data.llHostLoopbackOffsetList.assign(m->maNATLoopbackOffsetList.begin(),
     248                                         m->maNATLoopbackOffsetList.end());
     249
     250    mVirtualBox->onNATNetworkSetting(Bstr(mName).raw(),
    255251                                     data.fEnabled ? TRUE : FALSE,
    256                                      m->IPv4NetworkCidr.raw(),
    257                                      m->IPv4Gateway.raw(),
     252                                     Bstr(m->IPv4NetworkCidr).raw(),
     253                                     Bstr(m->IPv4Gateway).raw(),
    258254                                     data.fAdvertiseDefaultIPv6Route ? TRUE : FALSE,
    259255                                     data.fNeedDhcpServer ? TRUE : FALSE);
     
    261257    /* Notify listerners listening on this network only */
    262258    fireNATNetworkSettingEvent(m->pEventSource,
    263                                      mName.raw(),
    264                                      data.fEnabled ? TRUE : FALSE,
    265                                      m->IPv4NetworkCidr.raw(),
    266                                      m->IPv4Gateway.raw(),
    267                                      data.fAdvertiseDefaultIPv6Route ? TRUE : FALSE,
    268                                      data.fNeedDhcpServer ? TRUE : FALSE);
    269 
    270     return S_OK;
    271 }
    272 
    273 
    274 STDMETHODIMP NATNetwork::COMGETTER(EventSource)(IEventSource ** aEventSource)
    275 {
    276     CheckComArgOutPointerValid(aEventSource);
    277 
    278     AutoCaller autoCaller(this);
    279     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    280 
     259                               Bstr(mName).raw(),
     260                               data.fEnabled ? TRUE : FALSE,
     261                               Bstr(m->IPv4NetworkCidr).raw(),
     262                               Bstr(m->IPv4Gateway).raw(),
     263                               data.fAdvertiseDefaultIPv6Route ? TRUE : FALSE,
     264                               data.fNeedDhcpServer ? TRUE : FALSE);
     265
     266    return S_OK;
     267}
     268
     269HRESULT NATNetwork::getEventSource(ComPtr<IEventSource> &aEventSource)
     270{
    281271    /* event source is const, no need to lock */
    282     m->pEventSource.queryInterfaceTo(aEventSource);
    283 
    284     return S_OK;
    285 }
    286 
    287 
    288 STDMETHODIMP NATNetwork::COMGETTER(NetworkName)(BSTR *aName)
    289 {
    290     CheckComArgOutPointerValid(aName);
    291 
    292     AutoCaller autoCaller(this);
    293     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    294 
    295     mName.cloneTo(aName);
    296 
    297     return S_OK;
    298 }
    299 
    300 
    301 STDMETHODIMP NATNetwork::COMSETTER(NetworkName)(IN_BSTR aName)
    302 {
    303     CheckComArgOutPointerValid(aName);
    304     AutoCaller autoCaller(this);
    305 
    306     if (FAILED(autoCaller.rc()))
    307         return autoCaller.rc();
    308 
     272    m->pEventSource.queryInterfaceTo(aEventSource.asOutParam());
     273    return S_OK;
     274}
     275
     276HRESULT NATNetwork::getNetworkName(com::Utf8Str &aNetworkName)
     277{
     278    aNetworkName = mName;
     279    return S_OK;
     280}
     281
     282HRESULT NATNetwork::setNetworkName(const com::Utf8Str &aNetworkName)
     283{
    309284    {
    310285        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    311 
    312         if (aName == mName)
     286        if (aNetworkName == mName)
    313287            return S_OK;
    314288
    315         unconst(mName) = aName;
    316     }
    317 
     289        unconst(mName) = aNetworkName;
     290    }
    318291    AutoWriteLock vboxLock(mVirtualBox COMMA_LOCKVAL_SRC_POS);
    319292    HRESULT rc = mVirtualBox->saveSettings();
     
    323296}
    324297
    325 
    326 STDMETHODIMP NATNetwork::COMGETTER(Enabled)(BOOL *aEnabled)
    327 {
    328     CheckComArgOutPointerValid(aEnabled);
    329 
    330     AutoCaller autoCaller(this);
    331     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    332 
     298HRESULT NATNetwork::getEnabled(BOOL *aEnabled)
     299{
    333300    *aEnabled = m->fEnabled;
    334     recalculateIpv4AddressAssignments();
    335 
    336     return S_OK;
    337 }
    338 
    339 
    340 STDMETHODIMP NATNetwork::COMSETTER(Enabled)(BOOL aEnabled)
    341 {
    342     AutoCaller autoCaller(this);
    343     if (FAILED(autoCaller.rc()))
    344         return autoCaller.rc();
    345 
     301
     302    i_recalculateIpv4AddressAssignments();
     303    return S_OK;
     304}
     305
     306HRESULT NATNetwork::setEnabled(const BOOL aEnabled)
     307{
    346308    {
    347309        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    348 
    349310        if (aEnabled == m->fEnabled)
    350311            return S_OK;
    351 
    352312        m->fEnabled = aEnabled;
    353313    }
     
    356316    HRESULT rc = mVirtualBox->saveSettings();
    357317    ComAssertComRCRetRC(rc);
    358 
    359     return S_OK;
    360 }
    361 
    362 
    363 STDMETHODIMP NATNetwork::COMGETTER(Gateway)(BSTR *aIPv4Gateway)
    364 {
    365     CheckComArgOutPointerValid(aIPv4Gateway);
    366 
    367     AutoCaller autoCaller(this);
    368     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    369 
    370     m->IPv4Gateway.cloneTo(aIPv4Gateway);
    371 
    372     return S_OK;
    373 }
    374 
    375 
    376 STDMETHODIMP NATNetwork::COMGETTER(Network)(BSTR *aIPv4NetworkCidr)
    377 {
    378     CheckComArgOutPointerValid(aIPv4NetworkCidr);
    379 
    380     AutoCaller autoCaller(this);
    381     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    382     m->IPv4NetworkCidr.cloneTo(aIPv4NetworkCidr);
    383     return S_OK;
    384 }
    385 
    386 
    387 STDMETHODIMP NATNetwork::COMSETTER(Network)(IN_BSTR aIPv4NetworkCidr)
    388 {
    389     CheckComArgOutPointerValid(aIPv4NetworkCidr);
    390 
    391     AutoCaller autoCaller(this);
    392     if (FAILED(autoCaller.rc()))
    393         return autoCaller.rc();
    394 
    395     {
     318    return S_OK;
     319}
     320
     321HRESULT NATNetwork::getGateway(com::Utf8Str &aIPv4Gateway)
     322{
     323    aIPv4Gateway = m->IPv4Gateway;
     324    return S_OK;
     325}
     326
     327HRESULT NATNetwork::getNetwork(com::Utf8Str &aNetwork)
     328{
     329    aNetwork = m->IPv4NetworkCidr;
     330    return S_OK;
     331}
     332
     333
     334HRESULT NATNetwork::setNetwork(const com::Utf8Str &aIPv4NetworkCidr)
     335{
     336    {
     337
    396338        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    397339
     
    406348            return S_OK;
    407349
    408         unconst(m->IPv4NetworkCidr) = Bstr(aIPv4NetworkCidr);
    409         recalculateIpv4AddressAssignments();
     350
     351        unconst(m->IPv4NetworkCidr) = aIPv4NetworkCidr;
     352        i_recalculateIpv4AddressAssignments();
    410353    }
    411354
     
    413356    HRESULT rc = mVirtualBox->saveSettings();
    414357    ComAssertComRCRetRC(rc);
    415 
    416     return S_OK;
    417 }
    418 
    419 
    420 STDMETHODIMP NATNetwork::COMGETTER(IPv6Enabled)(BOOL *aIPv6Enabled)
    421 {
    422     CheckComArgOutPointerValid(aIPv6Enabled);
    423 
    424     AutoCaller autoCaller(this);
    425     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    426 
     358    return S_OK;
     359}
     360
     361
     362HRESULT NATNetwork::getIPv6Enabled(BOOL *aIPv6Enabled)
     363{
    427364    *aIPv6Enabled = m->fIPv6Enabled;
    428365
     
    431368
    432369
    433 STDMETHODIMP NATNetwork::COMSETTER(IPv6Enabled)(BOOL aIPv6Enabled)
    434 {
    435     AutoCaller autoCaller(this);
    436     if (FAILED(autoCaller.rc()))
    437         return autoCaller.rc();
    438 
     370HRESULT NATNetwork::setIPv6Enabled(const BOOL aIPv6Enabled)
     371{
    439372    {
    440373        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    454387
    455388
    456 STDMETHODIMP NATNetwork::COMGETTER(IPv6Prefix) (BSTR *aIPv6Prefix)
    457 {
    458     CheckComArgOutPointerValid(aIPv6Prefix);
    459 
    460     AutoCaller autoCaller(this);
    461     if (FAILED(autoCaller.rc())) return autoCaller.rc();
     389HRESULT NATNetwork::getIPv6Prefix(com::Utf8Str &aIPv6Prefix)
     390{
    462391    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    463392
    464     m->IPv6Prefix.cloneTo(aIPv6Prefix);
    465 
    466     return S_OK;
    467 }
    468 
    469 
    470 STDMETHODIMP NATNetwork::COMSETTER(IPv6Prefix) (IN_BSTR aIPv6Prefix)
    471 {
    472     CheckComArgOutPointerValid(aIPv6Prefix);
    473 
    474     AutoCaller autoCaller(this);
    475     if (FAILED(autoCaller.rc()))
    476         return autoCaller.rc();
    477 
     393    aIPv6Prefix = m->IPv6Prefix;
     394    return S_OK;
     395}
     396
     397HRESULT NATNetwork::setIPv6Prefix(const com::Utf8Str &aIPv6Prefix)
     398{
    478399    {
    479400        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    499420
    500421
    501 STDMETHODIMP NATNetwork::COMGETTER(AdvertiseDefaultIPv6RouteEnabled)(BOOL *aAdvertiseDefaultIPv6Route)
    502 {
    503     CheckComArgOutPointerValid(aAdvertiseDefaultIPv6Route);
    504 
    505     AutoCaller autoCaller(this);
    506     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    507 
     422HRESULT NATNetwork::getAdvertiseDefaultIPv6RouteEnabled(BOOL *aAdvertiseDefaultIPv6Route)
     423{
    508424    *aAdvertiseDefaultIPv6Route = m->fAdvertiseDefaultIPv6Route;
    509425
     
    512428
    513429
    514 STDMETHODIMP NATNetwork::COMSETTER(AdvertiseDefaultIPv6RouteEnabled)(BOOL aAdvertiseDefaultIPv6Route)
    515 {
    516     AutoCaller autoCaller(this);
    517     if (FAILED(autoCaller.rc()))
    518         return autoCaller.rc();
    519 
     430HRESULT NATNetwork::setAdvertiseDefaultIPv6RouteEnabled(const BOOL aAdvertiseDefaultIPv6Route)
     431{
    520432    {
    521433        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    536448
    537449
    538 STDMETHODIMP NATNetwork::COMGETTER(NeedDhcpServer)(BOOL *aNeedDhcpServer)
    539 {
    540     CheckComArgOutPointerValid(aNeedDhcpServer);
    541 
    542     AutoCaller autoCaller(this);
    543     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    544 
     450HRESULT NATNetwork::getNeedDhcpServer(BOOL *aNeedDhcpServer)
     451{
    545452    *aNeedDhcpServer = m->fNeedDhcpServer;
    546453
     
    548455}
    549456
    550 
    551 STDMETHODIMP NATNetwork::COMSETTER(NeedDhcpServer)(BOOL aNeedDhcpServer)
    552 {
    553     AutoCaller autoCaller(this);
    554     if (FAILED(autoCaller.rc()))
    555         return autoCaller.rc();
    556 
     457HRESULT NATNetwork::setNeedDhcpServer(const BOOL aNeedDhcpServer)
     458{
    557459    {
    558460        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    563465        m->fNeedDhcpServer = aNeedDhcpServer;
    564466
    565         recalculateIpv4AddressAssignments();
     467        i_recalculateIpv4AddressAssignments();
    566468
    567469    }
     
    574476}
    575477
    576 
    577 STDMETHODIMP NATNetwork::COMGETTER(LocalMappings)(ComSafeArrayOut(BSTR, aLocalMappings))
    578 {
    579     CheckComArgOutSafeArrayPointerValid(aLocalMappings);
    580 
    581     AutoCaller autoCaller(this);
    582     if (FAILED(autoCaller.rc())) return autoCaller.rc();
     478HRESULT NATNetwork::getLocalMappings(std::vector<com::Utf8Str> &aLocalMappings)
     479{
    583480    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    584481
    585     com::SafeArray<BSTR> sf(m->llNATLoopbackOffsetList.size());
    586 
     482    aLocalMappings.resize(m->maNATLoopbackOffsetList.size());
    587483    size_t i = 0;
    588     settings::NATLoopbackOffsetList::const_iterator it;
    589 
    590     for (it = m->llNATLoopbackOffsetList.begin();
    591          it != m->llNATLoopbackOffsetList.end(); ++it, ++i)
    592       {
    593           BstrFmt bstr("%s=%d",
    594                        (*it).strLoopbackHostAddress.c_str(),
    595                        (*it).u32Offset);
    596         bstr.detachTo(&sf[i]);
    597     }
    598     sf.detachTo(ComSafeArrayOutArg(aLocalMappings));
    599 
    600     return S_OK;
    601 }
    602 
    603 
    604 STDMETHODIMP NATNetwork::AddLocalMapping(IN_BSTR aHostId, LONG aOffset)
    605 {
    606     AutoCaller autoCaller(this);
    607     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    608 
    609     //AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    610 
     484    for (settings::NATLoopbackOffsetList::const_iterator it = m->maNATLoopbackOffsetList.begin();
     485         it != m->maNATLoopbackOffsetList.end(); ++it, ++i)
     486    {
     487        aLocalMappings[i] = Utf8StrFmt("%s;%d",
     488                            (*it).strLoopbackHostAddress.c_str(),
     489                            (*it).u32Offset);
     490    }
     491
     492    return S_OK;
     493}
     494
     495HRESULT NATNetwork::addLocalMapping(const com::Utf8Str &aHostId, LONG aOffset)
     496{
    611497    RTNETADDRIPV4 addr, net, mask;
    612498
     
    629515    settings::NATLoopbackOffsetList::iterator it;
    630516
    631     it = std::find(m->llNATLoopbackOffsetList.begin(),
    632                    m->llNATLoopbackOffsetList.end(),
    633                    Utf8Str(aHostId).c_str());
    634 
    635     if (it != m->llNATLoopbackOffsetList.end())
     517    it = std::find(m->maNATLoopbackOffsetList.begin(),
     518                   m->maNATLoopbackOffsetList.end(),
     519                   aHostId);
     520    if (it != m->maNATLoopbackOffsetList.end())
    636521    {
    637522        if (aOffset == 0) /* erase */
    638             m->llNATLoopbackOffsetList.erase(it, it);
     523            m->maNATLoopbackOffsetList.erase(it, it);
    639524        else /* modify */
    640525        {
    641526            settings::NATLoopbackOffsetList::iterator it1;
    642             it1 = std::find(m->llNATLoopbackOffsetList.begin(),
    643                            m->llNATLoopbackOffsetList.end(),
     527            it1 = std::find(m->maNATLoopbackOffsetList.begin(),
     528                           m->maNATLoopbackOffsetList.end(),
    644529                           (uint32_t)aOffset);
    645             if (it1 != m->llNATLoopbackOffsetList.end())
     530            if (it1 != m->maNATLoopbackOffsetList.end())
    646531                return E_INVALIDARG; /* this offset is already registered. */
    647532
     
    654539
    655540    /* injection */
    656     it = std::find(m->llNATLoopbackOffsetList.begin(),
    657                    m->llNATLoopbackOffsetList.end(),
     541    it = std::find(m->maNATLoopbackOffsetList.begin(),
     542                   m->maNATLoopbackOffsetList.end(),
    658543                   (uint32_t)aOffset);
    659544
    660     if (it != m->llNATLoopbackOffsetList.end())
     545    if (it != m->maNATLoopbackOffsetList.end())
    661546        return E_INVALIDARG; /* offset is already registered. */
    662547
     
    664549    off.strLoopbackHostAddress = aHostId;
    665550    off.u32Offset = (uint32_t)aOffset;
    666     m->llNATLoopbackOffsetList.push_back(off);
     551    m->maNATLoopbackOffsetList.push_back(off);
    667552
    668553    AutoWriteLock vboxLock(mVirtualBox COMMA_LOCKVAL_SRC_POS);
     
    671556
    672557
    673 STDMETHODIMP NATNetwork::COMGETTER(LoopbackIp6)(LONG *aLoopbackIp6)
    674 {
    675     AutoCaller autoCaller(this);
    676     if (FAILED(autoCaller.rc())) return autoCaller.rc();
     558HRESULT NATNetwork::getLoopbackIp6(LONG *aLoopbackIp6)
     559{
    677560    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    678561
     
    682565
    683566
    684 STDMETHODIMP NATNetwork::COMSETTER(LoopbackIp6)(LONG aLoopbackIp6)
    685 {
    686     AutoCaller autoCaller(this);
    687     if (FAILED(autoCaller.rc()))
    688         return autoCaller.rc();
    689 
     567HRESULT NATNetwork::setLoopbackIp6(LONG aLoopbackIp6)
     568{
    690569    {
    691570        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    705584
    706585
    707 STDMETHODIMP NATNetwork::COMGETTER(PortForwardRules4)(ComSafeArrayOut(BSTR, aPortForwardRules4))
    708 {
    709     CheckComArgOutSafeArrayPointerValid(aPortForwardRules4);
    710 
    711     AutoCaller autoCaller(this);
    712     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    713 
     586HRESULT NATNetwork::getPortForwardRules4(std::vector<com::Utf8Str> &aPortForwardRules4)
     587{
    714588    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    715     GetPortForwardRulesFromMap(ComSafeArrayInArg(aPortForwardRules4),
    716                                m->mapName2PortForwardRule4);
    717     return S_OK;
    718 }
    719 
    720 STDMETHODIMP NATNetwork::COMGETTER(PortForwardRules6)(ComSafeArrayOut(BSTR,
    721                                                                       aPortForwardRules6))
    722 {
    723     CheckComArgOutSafeArrayPointerValid(aPortForwardRules6);
    724 
    725     AutoCaller autoCaller(this);
    726     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    727 
     589    i_getPortForwardRulesFromMap(aPortForwardRules4,
     590                                 m->mapName2PortForwardRule4);
     591    return S_OK;
     592}
     593
     594HRESULT NATNetwork::getPortForwardRules6(std::vector<com::Utf8Str> &aPortForwardRules6)
     595{
    728596    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    729     GetPortForwardRulesFromMap(ComSafeArrayInArg(aPortForwardRules6), m->mapName2PortForwardRule6);
    730     return S_OK;
    731 }
    732 
    733 
    734 STDMETHODIMP NATNetwork::AddPortForwardRule(BOOL aIsIpv6,
    735                                             IN_BSTR aPortForwardRuleName,
    736                                             NATProtocol_T aProto,
    737                                             IN_BSTR aHostIp,
    738                                             USHORT aHostPort,
    739                                             IN_BSTR aGuestIp,
    740                                             USHORT aGuestPort)
    741 {
    742     AutoCaller autoCaller(this);
    743     if (FAILED(autoCaller.rc()))
    744         return autoCaller.rc();
    745 
     597    i_getPortForwardRulesFromMap(aPortForwardRules6,
     598                                 m->mapName2PortForwardRule6);
     599    return S_OK;
     600}
     601
     602HRESULT NATNetwork::addPortForwardRule(BOOL aIsIpv6,
     603                                       const com::Utf8Str &aPortForwardRuleName,
     604                                       NATProtocol_T aProto,
     605                                       const com::Utf8Str &aHostIp,
     606                                       USHORT aHostPort,
     607                                       const com::Utf8Str &aGuestIp,
     608                                       USHORT aGuestPort)
     609{
    746610    {
    747611        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    763627        if (name.isEmpty())
    764628            name = Utf8StrFmt("%s_[%s]%%%d_[%s]%%%d", proto.c_str(),
    765                               Utf8Str(aHostIp).c_str(), aHostPort,
    766                               Utf8Str(aGuestIp).c_str(), aGuestPort);
    767 
    768         NATRuleMap::iterator it;
    769 
    770         for (it = mapRules.begin(); it != mapRules.end(); ++it)
     629                              aHostIp.c_str(), aHostPort,
     630                              aGuestIp.c_str(), aGuestPort);
     631
     632        for (NATRuleMap::iterator it = mapRules.begin(); it != mapRules.end(); ++it)
    771633        {
    772634            r = it->second;
     
    774636                return setError(E_INVALIDARG,
    775637                                tr("A NAT rule of this name already exists"));
    776             if (   r.strHostIP == Utf8Str(aHostIp)
     638            if (   r.strHostIP == aHostIp
    777639                   && r.u16HostPort == aHostPort
    778640                   && r.proto == aProto)
     
    789651        mapRules.insert(std::make_pair(name, r));
    790652    }
    791 
    792653    {
    793654        AutoWriteLock vboxLock(mVirtualBox COMMA_LOCKVAL_SRC_POS);
     
    796657    }
    797658
    798     mVirtualBox->onNATNetworkPortForward(mName.raw(), TRUE, aIsIpv6,
    799                                          aPortForwardRuleName, aProto,
    800                                          aHostIp, aHostPort,
    801                                          aGuestIp, aGuestPort);
     659    mVirtualBox->onNATNetworkPortForward(Bstr(mName).raw(), TRUE, aIsIpv6,
     660                                         Bstr(aPortForwardRuleName).raw(), aProto,
     661                                         Bstr(aHostIp).raw(), aHostPort,
     662                                         Bstr(aGuestIp).raw(), aGuestPort);
    802663
    803664    /* Notify listerners listening on this network only */
    804     fireNATNetworkPortForwardEvent(m->pEventSource, mName.raw(), TRUE,
    805                                    aIsIpv6, aPortForwardRuleName, aProto,
    806                                    aHostIp, aHostPort,
    807                                    aGuestIp, aGuestPort);
    808     return S_OK;
    809 }
    810 
    811 
    812 STDMETHODIMP NATNetwork::RemovePortForwardRule(BOOL aIsIpv6, IN_BSTR aPortForwardRuleName)
    813 {
    814     AutoCaller autoCaller(this);
    815     if (FAILED(autoCaller.rc()))
    816         return autoCaller.rc();
    817 
     665    fireNATNetworkPortForwardEvent(m->pEventSource, Bstr(mName).raw(), TRUE,
     666                                   aIsIpv6, Bstr(aPortForwardRuleName).raw(), aProto,
     667                                   Bstr(aHostIp).raw(), aHostPort,
     668                                   Bstr(aGuestIp).raw(), aGuestPort);
     669
     670    return S_OK;
     671}
     672
     673HRESULT NATNetwork::removePortForwardRule(BOOL aIsIpv6, const com::Utf8Str &aPortForwardRuleName)
     674{
    818675    Utf8Str strHostIP;
    819676    Utf8Str strGuestIP;
     
    822679    NATProtocol_T proto;
    823680
    824 
    825681    {
    826682        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    827         NATRuleMap& mapRules = aIsIpv6 ? m->mapName2PortForwardRule6
    828           : m->mapName2PortForwardRule4;
    829 
     683        NATRuleMap& mapRules = aIsIpv6 ? m->mapName2PortForwardRule6 : m->mapName2PortForwardRule4;
    830684        NATRuleMap::iterator it = mapRules.find(aPortForwardRuleName);
    831685
     
    848702    }
    849703
    850     mVirtualBox->onNATNetworkPortForward(mName.raw(), FALSE, aIsIpv6,
    851                                          aPortForwardRuleName, proto,
     704    mVirtualBox->onNATNetworkPortForward(Bstr(mName).raw(), FALSE, aIsIpv6,
     705                                         Bstr(aPortForwardRuleName).raw(), proto,
    852706                                         Bstr(strHostIP).raw(), u16HostPort,
    853707                                         Bstr(strGuestIP).raw(), u16GuestPort);
    854708
    855709    /* Notify listerners listening on this network only */
    856     fireNATNetworkPortForwardEvent(m->pEventSource, mName.raw(), FALSE,
    857                                    aIsIpv6, aPortForwardRuleName, proto,
     710    fireNATNetworkPortForwardEvent(m->pEventSource, Bstr(mName).raw(), FALSE,
     711                                   aIsIpv6, Bstr(aPortForwardRuleName).raw(), proto,
    858712                                   Bstr(strHostIP).raw(), u16HostPort,
    859713                                   Bstr(strGuestIP).raw(), u16GuestPort);
     
    862716
    863717
    864 STDMETHODIMP NATNetwork::Start(IN_BSTR aTrunkType)
     718HRESULT  NATNetwork::start(const com::Utf8Str &aTrunkType)
    865719{
    866720#ifdef VBOX_WITH_NAT_SERVICE
    867     AutoCaller autoCaller(this);
    868     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    869 
    870721    if (!m->fEnabled) return S_OK;
    871722
     
    893744         * 6. start dhcp server.
    894745         */
    895         HRESULT hrc = mVirtualBox->FindDHCPServerByNetworkName(mName.raw(),
    896                                                       m->dhcpServer.asOutParam());
     746        HRESULT hrc = mVirtualBox->FindDHCPServerByNetworkName(Bstr(mName).raw(),
     747                                                               m->dhcpServer.asOutParam());
    897748        switch (hrc)
    898749        {
    899750            case E_INVALIDARG:
    900751                /* server haven't beeen found let create it then */
    901                 hrc = mVirtualBox->CreateDHCPServer(mName.raw(),
     752                hrc = mVirtualBox->CreateDHCPServer(Bstr(mName).raw(),
    902753                                                   m->dhcpServer.asOutParam());
    903754                if (FAILED(hrc))
     
    907758            {
    908759                LogFunc(("gateway: %s, dhcpserver:%s, dhcplowerip:%s, dhcpupperip:%s\n",
    909                          Utf8Str(m->IPv4Gateway.raw()).c_str(),
    910                          Utf8Str(m->IPv4DhcpServer.raw()).c_str(),
    911                          Utf8Str(m->IPv4DhcpServerLowerIp.raw()).c_str(),
    912                          Utf8Str(m->IPv4DhcpServerUpperIp.raw()).c_str()));
     760                         m->IPv4Gateway.c_str(),
     761                         m->IPv4DhcpServer.c_str(),
     762                         m->IPv4DhcpServerLowerIp.c_str(),
     763                         m->IPv4DhcpServerUpperIp.c_str()));
    913764
    914765                hrc = m->dhcpServer->COMSETTER(Enabled)(true);
     
    936787
    937788        /* XXX: AddGlobalOption(DhcpOpt_Router,) - enables attachement of DhcpServer to Main. */
    938         m->dhcpServer->AddGlobalOption(DhcpOpt_Router, m->IPv4Gateway.raw());
    939 
    940         hrc = m->dhcpServer->Start(mName.raw(), Bstr("").raw(), aTrunkType);
     789        m->dhcpServer->AddGlobalOption(DhcpOpt_Router, Bstr(m->IPv4Gateway).raw());
     790
     791        hrc = m->dhcpServer->Start(Bstr(mName).raw(), Bstr("").raw(), Bstr(aTrunkType).raw());
    941792        if (FAILED(hrc))
    942793        {
     
    948799    if (RT_SUCCESS(m->NATRunner.start()))
    949800    {
    950         mVirtualBox->onNATNetworkStartStop(mName.raw(), TRUE);
     801        mVirtualBox->onNATNetworkStartStop(Bstr(mName).raw(), TRUE);
    951802        return S_OK;
    952803    }
     
    959810}
    960811
    961 
    962 STDMETHODIMP NATNetwork::Stop()
     812HRESULT NATNetwork::stop()
    963813{
    964814#ifdef VBOX_WITH_NAT_SERVICE
     
    968818    if (RT_SUCCESS(m->NATRunner.stop()))
    969819    {
    970         mVirtualBox->onNATNetworkStartStop(mName.raw(), FALSE);
     820        mVirtualBox->onNATNetworkStartStop(Bstr(mName).raw(), FALSE);
    971821        return S_OK;
    972822    }
     
    979829
    980830
    981 void NATNetwork::GetPortForwardRulesFromMap(ComSafeArrayOut(BSTR, aPortForwardRules), NATRuleMap& aRules)
    982 {
    983     com::SafeArray<BSTR> sf(aRules.size());
     831void NATNetwork::i_getPortForwardRulesFromMap(std::vector<com::Utf8Str> &aPortForwardRules, NATRuleMap& aRules)
     832{
     833    aPortForwardRules.resize(aRules.size());
    984834    size_t i = 0;
    985     NATRuleMap::const_iterator it;
    986     for (it = aRules.begin();
     835    for (NATRuleMap::const_iterator it = aRules.begin();
    987836         it != aRules.end(); ++it, ++i)
    988837      {
    989838        settings::NATRule r = it->second;
    990         BstrFmt bstr("%s:%s:[%s]:%d:[%s]:%d",
    991                      r.strName.c_str(),
    992                      (r.proto == NATProtocol_TCP? "tcp" : "udp"),
    993                      r.strHostIP.c_str(),
    994                      r.u16HostPort,
    995                      r.strGuestIP.c_str(),
    996                      r.u16GuestPort);
    997         bstr.detachTo(&sf[i]);
    998     }
    999     sf.detachTo(ComSafeArrayOutArg(aPortForwardRules));
    1000 }
    1001 
    1002 
    1003 int NATNetwork::findFirstAvailableOffset(ADDRESSLOOKUPTYPE addrType, uint32_t *poff)
     839        aPortForwardRules[i] =  Utf8StrFmt("%s:%s:[%s]:%d:[%s]:%d",
     840                                           r.strName.c_str(),
     841                                           (r.proto == NATProtocol_TCP? "tcp" : "udp"),
     842                                           r.strHostIP.c_str(),
     843                                           r.u16HostPort,
     844                                           r.strGuestIP.c_str(),
     845                                           r.u16GuestPort);
     846    }
     847}
     848
     849
     850int NATNetwork::i_findFirstAvailableOffset(ADDRESSLOOKUPTYPE addrType, uint32_t *poff)
    1004851{
    1005852    RTNETADDRIPV4 network, netmask;
    1006853
    1007     int rc = RTCidrStrToIPv4(Utf8Str(m->IPv4NetworkCidr.raw()).c_str(),
     854    int rc = RTCidrStrToIPv4(m->IPv4NetworkCidr.c_str(),
    1008855                             &network,
    1009856                             &netmask);
     
    1011858
    1012859    uint32_t off;
    1013     settings::NATLoopbackOffsetList::iterator it;
    1014860    for (off = 1; off < ~netmask.u; ++off)
    1015861    {
    1016 
    1017862        bool skip = false;
    1018         for (it = m->llNATLoopbackOffsetList.begin();
    1019              it != m->llNATLoopbackOffsetList.end();
     863        for (settings::NATLoopbackOffsetList::iterator it = m->maNATLoopbackOffsetList.begin();
     864             it != m->maNATLoopbackOffsetList.end();
    1020865             ++it)
    1021866        {
     
    1057902}
    1058903
    1059 
    1060 int NATNetwork::recalculateIpv4AddressAssignments()
     904int NATNetwork::i_recalculateIpv4AddressAssignments()
    1061905{
    1062906    RTNETADDRIPV4 network, netmask;
    1063     int rc = RTCidrStrToIPv4(Utf8Str(m->IPv4NetworkCidr.raw()).c_str(),
     907    int rc = RTCidrStrToIPv4(m->IPv4NetworkCidr.c_str(),
    1064908                             &network,
    1065909                             &netmask);
    1066910    AssertRCReturn(rc, rc);
    1067911
    1068     findFirstAvailableOffset(ADDR_GATEWAY, &m->offGateway);
     912    i_findFirstAvailableOffset(ADDR_GATEWAY, &m->offGateway);
    1069913    if (m->fNeedDhcpServer)
    1070         findFirstAvailableOffset(ADDR_DHCP, &m->offDhcp);
     914        i_findFirstAvailableOffset(ADDR_DHCP, &m->offDhcp);
    1071915
    1072916    /* I don't remember the reason CIDR calculated on the host. */
     
    1086930        RTNETADDRIPV4 dhcplowerip = network;
    1087931        uint32_t offDhcpLowerIp;
    1088         findFirstAvailableOffset(ADDR_DHCPLOWERIP, &offDhcpLowerIp);
     932        i_findFirstAvailableOffset(ADDR_DHCPLOWERIP, &offDhcpLowerIp);
    1089933        dhcplowerip.u = RT_H2N_U32(dhcplowerip.u + offDhcpLowerIp);
    1090934
  • trunk/src/VBox/Main/src-server/NetworkAdapterImpl.cpp

    r49644 r49742  
    14591459{
    14601460    Utf8Str mac;
    1461     Host::generateMACAddress(mac);
     1461    Host::i_generateMACAddress(mac);
    14621462    LogFlowThisFunc(("generated MAC: '%s'\n", mac.c_str()));
    14631463    mData->mMACAddress = mac;
  • trunk/src/VBox/Main/src-server/USBDeviceFilterImpl.cpp

    r47376 r49742  
    931931    /* register with parent early, since uninit() will unconditionally
    932932     * unregister on failure */
    933     mParent->addChild(this);
     933    mParent->i_addChild(this);
    934934
    935935    mData.allocate();
     
    10001000    /* register with parent early, since uninit() will unconditionally
    10011001     * unregister on failure */
    1002     mParent->addChild(this);
     1002    mParent->i_addChild(this);
    10031003
    10041004    mData.allocate();
     
    10341034    mData.free();
    10351035
    1036     mParent->removeChild(this);
     1036    mParent->i_removeChild(this);
    10371037
    10381038    unconst(mParent) = NULL;
     
    10831083        alock.release();
    10841084
    1085         return mParent->onUSBDeviceFilterChange (this);
     1085        return mParent->i_onUSBDeviceFilterChange (this);
    10861086    }
    10871087
     
    11171117        alock.release();
    11181118
    1119         return mParent->onUSBDeviceFilterChange (this, TRUE /* aActiveChanged  */);
     1119        return mParent->i_onUSBDeviceFilterChange (this, TRUE /* aActiveChanged  */);
    11201120    }
    11211121
     
    12861286        alock.release();
    12871287
    1288         return mParent->onUSBDeviceFilterChange (this);
     1288        return mParent->i_onUSBDeviceFilterChange (this);
    12891289    }
    12901290
     
    13731373        alock.release();
    13741374
    1375         return mParent->onUSBDeviceFilterChange(this);
     1375        return mParent->i_onUSBDeviceFilterChange(this);
    13761376    }
    13771377
  • trunk/src/VBox/Main/src-server/USBDeviceFiltersImpl.cpp

    r47401 r49742  
    390390        && pFilter->getData().mRemote.isMatch(false))
    391391    {
    392         USBProxyService *pProxySvc = m->pHost->usbProxyService();
     392        USBProxyService *pProxySvc = m->pHost->i_usbProxyService();
    393393        ComAssertRet(pProxySvc, E_FAIL);
    394394
     
    462462        && pFilter->getData().mRemote.isMatch(false))
    463463    {
    464         USBProxyService *pProxySvc = m->pHost->usbProxyService();
     464        USBProxyService *pProxySvc = m->pHost->i_usbProxyService();
    465465        ComAssertRet(pProxySvc, E_FAIL);
    466466
     
    602602    if (m->llDeviceFilters.isBackedUp())
    603603    {
    604         USBProxyService *pProxySvc = m->pHost->usbProxyService();
     604        USBProxyService *pProxySvc = m->pHost->i_usbProxyService();
    605605        Assert(pProxySvc);
    606606
     
    844844         && m->pParent->isRegistered())
    845845    {
    846         USBProxyService *pProxySvc = m->pHost->usbProxyService();
     846        USBProxyService *pProxySvc = m->pHost->i_usbProxyService();
    847847        ComAssertRet(pProxySvc, E_FAIL);
    848848
     
    10421042    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    10431043
    1044     USBProxyService *pProxySvc = m->pHost->usbProxyService();
     1044    USBProxyService *pProxySvc = m->pHost->i_usbProxyService();
    10451045    AssertReturn(pProxySvc, E_FAIL);
    10461046
  • trunk/src/VBox/Main/src-server/USBProxyService.cpp

    r41528 r49742  
    218218    // (getOpenedMachines requests locks which are incompatible with the lock of the machines list)
    219219    SessionMachinesList llOpenedMachines;
    220     mHost->parent()->getOpenedMachines(llOpenedMachines);
     220    mHost->i_parent()->getOpenedMachines(llOpenedMachines);
    221221
    222222    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    329329    // (getOpenedMachines requests locks which are incompatible with the host object lock)
    330330    SessionMachinesList llOpenedMachines;
    331     mHost->parent()->getOpenedMachines(llOpenedMachines);
     331    mHost->i_parent()->getOpenedMachines(llOpenedMachines);
    332332
    333333    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    411411    Host::USBDeviceFilterList globalFilters;
    412412
    413     mHost->getUSBFilters(&globalFilters);
     413    mHost->i_getUSBFilters(&globalFilters);
    414414
    415415    /*
     
    862862    // (getOpenedMachines requests higher priority locks)
    863863    SessionMachinesList llOpenedMachines;
    864     mHost->parent()->getOpenedMachines(llOpenedMachines);
     864    mHost->i_parent()->getOpenedMachines(llOpenedMachines);
    865865
    866866    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
  • trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp

    r49644 r49742  
    6969#endif /* VBOX_WITH_RESOURCE_USAGE_API */
    7070#include "EventImpl.h"
    71 #include "VBoxEvents.h"
    7271#ifdef VBOX_WITH_EXTPACK
    7372# include "ExtPackManagerImpl.h"
     
    428427        ComAssertComRCThrowRC(rc);
    429428
    430         rc = m->pHost->loadSettings(m->pMainConfigFile->host);
     429        rc = m->pHost->i_loadSettings(m->pMainConfigFile->host);
    431430        if (FAILED(rc)) throw rc;
    432431
     
    36903689
    36913690    // first search for host drive with that UUID
    3692     HRESULT rc = m->pHost->findHostDriveById(mediumType,
    3693                                              uuid,
    3694                                              fRefresh,
    3695                                              pMedium);
     3691    HRESULT rc = m->pHost->i_findHostDriveById(mediumType,
     3692                                               uuid,
     3693                                               fRefresh,
     3694                                               pMedium);
    36963695    if (rc == VBOX_E_OBJECT_NOT_FOUND)
    36973696                // then search for an image with that UUID
     
    42554254            {
    42564255                settings::NATNetwork n;
    4257                 rc = (*it)->saveSettings(n);
     4256                rc = (*it)->i_saveSettings(n);
    42584257                if (FAILED(rc)) throw rc;
    42594258                m->pMainConfigFile->llNATNetworks.push_back(n);
     
    42654264
    42664265        // host data (USB filters)
    4267         rc = m->pHost->saveSettings(m->pMainConfigFile->host);
     4266        rc = m->pHost->i_saveSettings(m->pMainConfigFile->host);
    42684267        if (FAILED(rc)) throw rc;
    42694268
  • trunk/src/VBox/Main/src-server/xpcom/server.cpp

    r49644 r49742  
    104104NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Machine, IMachine)
    105105
    106 NS_DECL_CLASSINFO(Appliance)
    107 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Appliance, IAppliance)
    108 
    109 NS_DECL_CLASSINFO(VirtualSystemDescription)
    110 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(VirtualSystemDescription, IVirtualSystemDescription)
    111 
    112106NS_DECL_CLASSINFO(SessionMachine)
    113107NS_IMPL_THREADSAFE_ISUPPORTS2_CI(SessionMachine, IMachine, IInternalMachineControl)
     
    134128NS_IMPL_THREADSAFE_ISUPPORTS1_CI(SharedFolder, ISharedFolder)
    135129
    136 NS_DECL_CLASSINFO(Host)
    137 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Host, IHost)
    138 
    139130NS_DECL_CLASSINFO(HostNetworkInterface)
    140131NS_IMPL_THREADSAFE_ISUPPORTS1_CI(HostNetworkInterface, IHostNetworkInterface)
    141 
    142 NS_DECL_CLASSINFO(NATNetwork)
    143 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(NATNetwork, INATNetwork)
    144132
    145133NS_DECL_CLASSINFO(NetworkAdapter)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette