Changeset 49644 in vbox for trunk/src/VBox/Main
- Timestamp:
- Nov 25, 2013 4:57:15 PM (11 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/BandwidthControlImpl.h
r42551 r49644 5 5 6 6 /* 7 * Copyright (C) 2006-201 2Oracle Corporation7 * Copyright (C) 2006-2013 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 19 19 #define ____H_BANDWIDTHCONTROLIMPL 20 20 21 #include " VirtualBoxBase.h"21 #include "BandwidthControlWrap.h" 22 22 23 23 class BandwidthGroup; … … 29 29 30 30 class ATL_NO_VTABLE BandwidthControl : 31 public VirtualBoxBase, 32 VBOX_SCRIPTABLE_IMPL(IBandwidthControl) 31 public BandwidthControlWrap 33 32 { 34 33 public: 35 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(BandwidthControl, IBandwidthControl)36 34 37 DECLARE_ NOT_AGGREGATABLE(BandwidthControl)35 DECLARE_EMPTY_CTOR_DTOR(BandwidthControl) 38 36 39 DECLARE_PROTECT_FINAL_CONSTRUCT() 40 41 BEGIN_COM_MAP(BandwidthControl) 42 VBOX_DEFAULT_INTERFACE_ENTRIES(IBandwidthControl) 43 END_COM_MAP() 44 45 BandwidthControl() { }; 46 ~BandwidthControl() { }; 37 HRESULT FinalConstruct(); 38 void FinalRelease(); 47 39 48 40 // public initializer/uninitializer for internal purposes only … … 52 44 void uninit(); 53 45 54 STDMETHOD(CreateBandwidthGroup) (IN_BSTR aName, BandwidthGroupType_T aType, LONG64 aMaxBytesPerSec);55 STDMETHOD(DeleteBandwidthGroup) (IN_BSTR aName);56 STDMETHOD(COMGETTER(NumGroups)) (ULONG *aGroups);57 STDMETHOD(GetBandwidthGroup) (IN_BSTR aName, IBandwidthGroup **aBandwidthGroup);58 STDMETHOD(GetAllBandwidthGroups) (ComSafeArrayOut(IBandwidthGroup *, aBandwidthGroups));59 60 HRESULT FinalConstruct();61 void FinalRelease();62 63 46 // public internal methods 64 65 HRESULT loadSettings(const settings::IOSettings &data); 66 HRESULT saveSettings(settings::IOSettings &data); 67 68 void rollback(); 69 void commit(); 70 void copyFrom (BandwidthControl *aThat); 71 72 Machine *getMachine() const; 73 74 HRESULT getBandwidthGroupByName(const Utf8Str &aName, 75 ComObjPtr<BandwidthGroup> &aBandwidthGroup, 76 bool aSetError /* = false */); 47 HRESULT i_loadSettings(const settings::IOSettings &data); 48 HRESULT i_saveSettings(settings::IOSettings &data); 49 void i_rollback(); 50 void i_commit(); 51 void i_copyFrom(BandwidthControl *aThat); 52 Machine *i_getMachine() const; 53 HRESULT i_getBandwidthGroupByName(const Utf8Str &aName, 54 ComObjPtr<BandwidthGroup> &aBandwidthGroup, 55 bool aSetError /* = false */); 77 56 78 57 private: 79 struct Data; 58 59 // wrapped IBandwidthControl properties 60 HRESULT getNumGroups(ULONG *aNumGroups); 61 62 // wrapped IBandwidthControl methods 63 HRESULT createBandwidthGroup(const com::Utf8Str &aName, 64 BandwidthGroupType_T aType, 65 LONG64 aMaxBytesPerSec); 66 HRESULT deleteBandwidthGroup(const com::Utf8Str &aName); 67 HRESULT getBandwidthGroup(const com::Utf8Str &aName, 68 ComPtr<IBandwidthGroup> &aBandwidthGroup); 69 HRESULT getAllBandwidthGroups(std::vector<ComPtr<IBandwidthGroup> > &aBandwidthGroups); 70 71 // Data 72 typedef std::list< ComObjPtr<BandwidthGroup> > BandwidthGroupList; 73 74 struct Data 75 { 76 Data(Machine *pMachine) 77 : pParent(pMachine) 78 { } 79 80 ~Data() 81 {}; 82 83 Machine * const pParent; 84 85 // peer machine's bandwidth control 86 const ComObjPtr<BandwidthControl> pPeer; 87 88 // the following fields need special backup/rollback/commit handling, 89 // so they cannot be a part of BackupableData 90 Backupable<BandwidthGroupList> llBandwidthGroups; 91 }; 92 80 93 Data *m; 81 94 }; -
trunk/src/VBox/Main/include/BandwidthGroupImpl.h
r44528 r49644 5 5 6 6 /* 7 * Copyright (C) 2006-201 2Oracle Corporation7 * Copyright (C) 2006-2013 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 19 19 #define ____H_BANDWIDTHGROUPIMPL 20 20 21 #include "VirtualBoxBase.h"22 21 #include "BandwidthControlImpl.h" 22 #include "BandwidthGroupWrap.h" 23 23 24 24 25 class ATL_NO_VTABLE BandwidthGroup : 25 public VirtualBoxBase, 26 VBOX_SCRIPTABLE_IMPL(IBandwidthGroup) 26 public BandwidthGroupWrap 27 27 { 28 28 public: 29 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(BandwidthGroup, IBandwidthGroup)30 29 31 DECLARE_ NOT_AGGREGATABLE(BandwidthGroup)30 DECLARE_EMPTY_CTOR_DTOR(BandwidthGroup) 32 31 33 DECLARE_PROTECT_FINAL_CONSTRUCT() 34 35 BEGIN_COM_MAP(BandwidthGroup) 36 VBOX_DEFAULT_INTERFACE_ENTRIES(IBandwidthGroup) 37 END_COM_MAP() 38 39 BandwidthGroup() { }; 40 ~BandwidthGroup() { }; 32 HRESULT FinalConstruct(); 33 void FinalRelease(); 41 34 42 35 // public initializer/uninitializer for internal purposes only … … 49 42 void uninit(); 50 43 51 HRESULT FinalConstruct(); 52 void FinalRelease(); 44 // public methods only for internal purposes 45 void i_rollback(); 46 void i_commit(); 47 void i_unshare(); 48 void i_reference(); 49 void i_release(); 53 50 54 STDMETHOD(COMGETTER(Name))(BSTR *aName); 55 STDMETHOD(COMGETTER(Type))(BandwidthGroupType_T *aType); 56 STDMETHOD(COMGETTER(Reference))(ULONG *aReferences); 57 STDMETHOD(COMGETTER(MaxBytesPerSec))(LONG64 *aMaxBytesPerSec); 58 STDMETHOD(COMSETTER(MaxBytesPerSec))(LONG64 aMaxBytesPerSec); 59 60 // public methods only for internal purposes 61 void rollback(); 62 void commit(); 63 void unshare(); 64 65 const Utf8Str &getName() const; 66 BandwidthGroupType_T getType() const; 67 LONG64 getMaxBytesPerSec() const; 68 ULONG getReferences() const; 69 70 void reference(); 71 void release(); 72 73 ComObjPtr<BandwidthGroup> getPeer(); 51 ComObjPtr<BandwidthGroup> i_getPeer() { return m->pPeer; } 52 const Utf8Str &i_getName() const { return m->bd->strName; } 53 BandwidthGroupType_T i_getType() const { return m->bd->enmType; } 54 LONG64 i_getMaxBytesPerSec() const { return m->bd->aMaxBytesPerSec; } 55 ULONG i_getReferences() const { return m->bd->cReferences; } 74 56 75 57 private: 76 struct Data; 58 59 // wrapped IBandwidthGroup properties 60 HRESULT getName(com::Utf8Str &aName); 61 HRESULT getType(BandwidthGroupType_T *aType); 62 HRESULT getReference(ULONG *aReferences); 63 HRESULT getMaxBytesPerSec(LONG64 *aMaxBytesPerSec); 64 HRESULT setMaxBytesPerSec(LONG64 MaxBytesPerSec); 65 66 //////////////////////////////////////////////////////////////////////////////// 67 //// 68 //// private member data definition 69 //// 70 ////////////////////////////////////////////////////////////////////////////////// 71 // 72 struct BackupableBandwidthGroupData 73 { 74 BackupableBandwidthGroupData() 75 : enmType(BandwidthGroupType_Null), 76 aMaxBytesPerSec(0), 77 cReferences(0) 78 { } 79 80 Utf8Str strName; 81 BandwidthGroupType_T enmType; 82 LONG64 aMaxBytesPerSec; 83 ULONG cReferences; 84 }; 85 86 struct Data 87 { 88 Data(BandwidthControl * const aBandwidthControl) 89 : pParent(aBandwidthControl), 90 pPeer(NULL) 91 { } 92 93 BandwidthControl * const pParent; 94 ComObjPtr<BandwidthGroup> pPeer; 95 96 // use the XML settings structure in the members for simplicity 97 Backupable<BackupableBandwidthGroupData> bd; 98 }; 99 77 100 Data *m; 78 101 }; -
trunk/src/VBox/Main/include/DHCPServerImpl.h
r49618 r49644 7 7 8 8 /* 9 * Copyright (C) 2006-201 1Oracle Corporation9 * Copyright (C) 2006-2013 Oracle Corporation 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 21 21 #define ____H_H_DHCPSERVERIMPL 22 22 23 #include " VirtualBoxBase.h"23 #include "DHCPServerWrap.h" 24 24 25 25 #ifdef VBOX_WITH_HOSTNETIF_API … … 73 73 74 74 class ATL_NO_VTABLE DHCPServer : 75 public VirtualBoxBase, 76 VBOX_SCRIPTABLE_IMPL(IDHCPServer) 75 public DHCPServerWrap 77 76 { 78 77 public: 79 80 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(DHCPServer, IDHCPServer)81 82 DECLARE_NOT_AGGREGATABLE (DHCPServer)83 84 DECLARE_PROTECT_FINAL_CONSTRUCT()85 86 BEGIN_COM_MAP (DHCPServer)87 VBOX_DEFAULT_INTERFACE_ENTRIES(IDHCPServer)88 END_COM_MAP()89 78 90 79 DECLARE_EMPTY_CTOR_DTOR (DHCPServer) … … 97 86 HRESULT init(VirtualBox *aVirtualBox, 98 87 const settings::DHCPServer &data); 99 HRESULT saveSettings(settings::DHCPServer &data);100 101 88 void uninit(); 102 89 103 // IDHCPServer properties 104 STDMETHOD(COMGETTER(NetworkName))(BSTR *aName); 105 STDMETHOD(COMGETTER(Enabled))(BOOL *aEnabled); 106 STDMETHOD(COMSETTER(Enabled))(BOOL aEnabled); 107 STDMETHOD(COMGETTER(IPAddress))(BSTR *aIPAddress); 108 STDMETHOD(COMGETTER(NetworkMask))(BSTR *aNetworkMask); 109 STDMETHOD(COMGETTER(LowerIP))(BSTR *aIPAddress); 110 STDMETHOD(COMGETTER(UpperIP))(BSTR *aIPAddress); 111 112 STDMETHOD(AddGlobalOption)(DhcpOpt_T aOption, IN_BSTR aValue); 113 STDMETHOD(COMGETTER(GlobalOptions))(ComSafeArrayOut(BSTR, aValue)); 114 STDMETHOD(COMGETTER(VmConfigs))(ComSafeArrayOut(BSTR, aValue)); 115 STDMETHOD(AddVmSlotOption)(IN_BSTR aVmName, LONG aSlot, DhcpOpt_T aOption, IN_BSTR aValue); 116 STDMETHOD(RemoveVmSlotOptions)(IN_BSTR aVmName, LONG aSlot); 117 STDMETHOD(GetVmSlotOptions)(IN_BSTR aVmName, LONG aSlot, ComSafeArrayOut(BSTR, aValues)); 118 STDMETHOD(GetMacOptions)(IN_BSTR aMAC, ComSafeArrayOut(BSTR, aValues)); 119 STDMETHOD(COMGETTER(EventSource))(IEventSource **aEventSource); 120 121 STDMETHOD(SetConfiguration)(IN_BSTR aIPAddress, IN_BSTR aNetworkMask, IN_BSTR aFromIPAddress, IN_BSTR aToIPAddress); 122 123 STDMETHOD(Start)(IN_BSTR aNetworkName, IN_BSTR aTrunkName, IN_BSTR aTrunkType); 124 STDMETHOD(Stop)(); 90 // Public internal methids. 91 HRESULT i_saveSettings(settings::DHCPServer &data); 92 DhcpOptionMap& i_findOptMapByVmNameSlot(const com::Utf8Str& aVmName, 93 LONG Slot); 125 94 126 95 private: 127 struct Data; 128 Data *m; 96 97 // wrapped IDHCPServer properties 98 HRESULT getEventSource(ComPtr<IEventSource> &aEventSource); 99 HRESULT getEnabled(BOOL *aEnabled); 100 HRESULT setEnabled(BOOL aEnabled); 101 HRESULT getIPAddress(com::Utf8Str &aIPAddress); 102 HRESULT getNetworkMask(com::Utf8Str &aNetworkMask); 103 HRESULT getNetworkName(com::Utf8Str &aName); 104 HRESULT getLowerIP(com::Utf8Str &aIPAddress); 105 HRESULT getUpperIP(com::Utf8Str &aIPAddress); 106 HRESULT getGlobalOptions(std::vector<com::Utf8Str> &aGlobalOptions); 107 HRESULT getVmConfigs(std::vector<com::Utf8Str> &aVmConfigs); 108 HRESULT getMacOptions(const com::Utf8Str &aMAC, std::vector<com::Utf8Str> &aValues); 109 HRESULT setConfiguration(const com::Utf8Str &aIPAddress, 110 const com::Utf8Str &aNetworkMask, 111 const com::Utf8Str &aFromIPAddress, 112 const com::Utf8Str &aToIPAddress); 113 HRESULT getVmSlotOptions(const com::Utf8Str &aVmName, 114 LONG aSlot, 115 std::vector<com::Utf8Str> &aValue); 116 117 // Wrapped IDHCPServer Methods 118 HRESULT addGlobalOption(DhcpOpt_T aOption, 119 const com::Utf8Str &aValue); 120 HRESULT addVmSlotOption(const com::Utf8Str &aVmName, 121 LONG aSlot, 122 DhcpOpt_T aOption, 123 const com::Utf8Str &aValue); 124 HRESULT removeVmSlotOptions(const com::Utf8Str &aVmName, 125 LONG aSlot); 126 HRESULT start(const com::Utf8Str &aNetworkName, 127 const com::Utf8Str &aTrunkName, 128 const com::Utf8Str &aTrunkType); 129 HRESULT stop(); 130 131 132 struct Data 133 { 134 Data() : enabled(FALSE) {} 135 136 Bstr IPAddress; 137 Bstr lowerIP; 138 Bstr upperIP; 139 140 BOOL enabled; 141 DHCPServerRunner dhcp; 142 143 DhcpOptionMap GlobalDhcpOptions; 144 VmSlot2OptionsMap VmSlot2Options; 145 }; 146 147 Data m; 129 148 /** weak VirtualBox parent */ 130 149 VirtualBox * const mVirtualBox; 131 150 const Bstr mName; 132 151 133 DhcpOptionMap& findOptMapByVmNameSlot(const com::Utf8Str& aVmName,134 LONG Slot);135 152 }; 136 153 -
trunk/src/VBox/Main/include/GuestOSTypeImpl.h
r49074 r49644 5 5 6 6 /* 7 * Copyright (C) 2006-201 2Oracle Corporation7 * Copyright (C) 2006-2013 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 16 16 */ 17 17 18 // static int i_vrdpServerVerifyPortsString(com::Utf8Str portRange); 18 19 #ifndef ____H_GUESTOSTYPEIMPL 19 20 #define ____H_GUESTOSTYPEIMPL 20 21 21 #include "VirtualBoxBase.h"22 22 #include "Global.h" 23 24 #include <VBox/ostypes.h> 23 #include "GuestOSTypeWrap.h" 25 24 26 25 class ATL_NO_VTABLE GuestOSType : 27 public VirtualBoxBase, 28 VBOX_SCRIPTABLE_IMPL(IGuestOSType) 26 public GuestOSTypeWrap 29 27 { 30 28 public: 31 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(GuestOSType, IGuestOSType)32 33 DECLARE_NOT_AGGREGATABLE(GuestOSType)34 35 DECLARE_PROTECT_FINAL_CONSTRUCT()36 37 BEGIN_COM_MAP(GuestOSType)38 VBOX_DEFAULT_INTERFACE_ENTRIES(IGuestOSType)39 END_COM_MAP()40 29 41 30 DECLARE_EMPTY_CTOR_DTOR(GuestOSType) … … 48 37 void uninit(); 49 38 50 // IGuestOSType properties51 STDMETHOD(COMGETTER(FamilyId))(BSTR *aFamilyId);52 STDMETHOD(COMGETTER(FamilyDescription))(BSTR *aFamilyDescription);53 STDMETHOD(COMGETTER(Id))(BSTR *aId);54 STDMETHOD(COMGETTER(Description))(BSTR *aDescription);55 STDMETHOD(COMGETTER(Is64Bit))(BOOL *aIs64Bit);56 STDMETHOD(COMGETTER(RecommendedIOAPIC))(BOOL *aRecommendedIOAPIC);57 STDMETHOD(COMGETTER(RecommendedVirtEx))(BOOL *aRecommendedVirtEx);58 STDMETHOD(COMGETTER(RecommendedRAM))(ULONG *aRAMSize);59 STDMETHOD(COMGETTER(RecommendedVRAM))(ULONG *aVRAMSize);60 STDMETHOD(COMGETTER(Recommended2DVideoAcceleration))(BOOL *aRecommended2DVideoAcceleration);61 STDMETHOD(COMGETTER(Recommended3DAcceleration))(BOOL *aRecommended3DAcceleration);62 STDMETHOD(COMGETTER(RecommendedHDD))(LONG64 *aHDDSize);63 STDMETHOD(COMGETTER(AdapterType))(NetworkAdapterType_T *aNetworkAdapterType);64 STDMETHOD(COMGETTER(RecommendedFirmware))(FirmwareType_T *aFirmwareType);65 STDMETHOD(COMGETTER(RecommendedDVDStorageBus))(StorageBus_T *aStorageBusType);66 STDMETHOD(COMGETTER(RecommendedDVDStorageController))(StorageControllerType_T *aStorageControllerType);67 STDMETHOD(COMGETTER(RecommendedHDStorageBus))(StorageBus_T *aStorageBusType);68 STDMETHOD(COMGETTER(RecommendedHDStorageController))(StorageControllerType_T *aStorageControllerType);69 STDMETHOD(COMGETTER(RecommendedPAE))(BOOL *aRecommendedExtHw);70 STDMETHOD(COMGETTER(RecommendedUSBHID))(BOOL *aRecommendedUSBHID);71 STDMETHOD(COMGETTER(RecommendedHPET))(BOOL *aRecommendedHPET);72 STDMETHOD(COMGETTER(RecommendedUSBTablet))(BOOL *aRecommendedUSBTablet);73 STDMETHOD(COMGETTER(RecommendedRTCUseUTC))(BOOL *aRecommendedRTCUseUTC);74 STDMETHOD(COMGETTER(RecommendedChipset))(ChipsetType_T *aChipsetType);75 STDMETHOD(COMGETTER(RecommendedAudioController))(AudioControllerType_T *aAudioController);76 STDMETHOD(COMGETTER(RecommendedFloppy))(BOOL *aRecommendedFloppy);77 STDMETHOD(COMGETTER(RecommendedUSB))(BOOL *aRecommendedUSB);78 STDMETHOD(COMGETTER(RecommendedTFReset))(BOOL *aRecommendedTFReset);79 80 39 // public methods only for internal purposes 81 const Bstr &i d() const { return mID; }82 bool i s64Bit() const { return !!(mOSHint & VBOXOSHINT_64BIT); }83 bool recommendedIOAPIC() const { return !!(mOSHint & VBOXOSHINT_IOAPIC); }84 bool recommendedVirtEx() const { return !!(mOSHint & VBOXOSHINT_HWVIRTEX); }85 bool recommendedEFI() const { return !!(mOSHint & VBOXOSHINT_EFI); }86 NetworkAdapterType_T networkAdapterType() const { return mNetworkAdapterType; }87 uint32_t numSerialEnabled() const { return mNumSerialEnabled; }40 const Bstr &i_id() const { return mID; } 41 bool i_is64Bit() const { return !!(mOSHint & VBOXOSHINT_64BIT); } 42 bool i_recommendedIOAPIC() const { return !!(mOSHint & VBOXOSHINT_IOAPIC); } 43 bool i_recommendedVirtEx() const { return !!(mOSHint & VBOXOSHINT_HWVIRTEX); } 44 bool i_recommendedEFI() const { return !!(mOSHint & VBOXOSHINT_EFI); } 45 NetworkAdapterType_T i_networkAdapterType() const { return mNetworkAdapterType; } 46 uint32_t i_numSerialEnabled() const { return mNumSerialEnabled; } 88 47 89 48 private: 49 50 // Wrapped IGuestOSType properties 51 HRESULT getFamilyId(com::Utf8Str &aFamilyId); 52 HRESULT getFamilyDescription(com::Utf8Str &aFamilyDescription); 53 HRESULT getId(com::Utf8Str &aId); 54 HRESULT getDescription(com::Utf8Str &aDescription); 55 HRESULT getIs64Bit(BOOL *aIs64Bit); 56 HRESULT getRecommendedIOAPIC(BOOL *aRecommendedIOAPIC); 57 HRESULT getRecommendedVirtEx(BOOL *aRecommendedVirtEx); 58 HRESULT getRecommendedRAM(ULONG *RAMSize); 59 HRESULT getRecommendedVRAM(ULONG *aVRAMSize); 60 HRESULT getRecommended2DVideoAcceleration(BOOL *aRecommended2DVideoAcceleration); 61 HRESULT getRecommended3DAcceleration(BOOL *aRecommended3DAcceleration); 62 HRESULT getRecommendedHDD(LONG64 *aHDDSize); 63 HRESULT getAdapterType(NetworkAdapterType_T *aNetworkAdapterType); 64 HRESULT getRecommendedPAE(BOOL *aRecommendedPAE); 65 HRESULT getRecommendedDVDStorageController(StorageControllerType_T *aStorageControllerType); 66 HRESULT getRecommendedFirmware(FirmwareType_T *aFirmwareType); 67 HRESULT getRecommendedDVDStorageBus(StorageBus_T *aStorageBusType); 68 HRESULT getRecommendedHDStorageController(StorageControllerType_T *aStorageControllerType); 69 HRESULT getRecommendedHDStorageBus(StorageBus_T *aStorageBusType); 70 HRESULT getRecommendedUSBHID(BOOL *aRecommendedUSBHID); 71 HRESULT getRecommendedHPET(BOOL *aRecommendedHPET); 72 HRESULT getRecommendedUSBTablet(BOOL *aRecommendedUSBTablet); 73 HRESULT getRecommendedRTCUseUTC(BOOL *aRecommendedRTCUseUTC); 74 HRESULT getRecommendedChipset(ChipsetType_T *aChipsetType); 75 HRESULT getRecommendedAudioController(AudioControllerType_T *aAudioController); 76 HRESULT getRecommendedFloppy(BOOL *aRecommendedFloppy); 77 HRESULT getRecommendedUSB(BOOL *aRecommendedUSB); 78 HRESULT getRecommendedTFReset(BOOL *aRecommendedTFReset); 79 90 80 91 81 const Bstr mFamilyID; -
trunk/src/VBox/Main/include/MachineImpl.h
r49059 r49644 814 814 bool fSetError = false) 815 815 { 816 return mBandwidthControl-> getBandwidthGroupByName(strBandwidthGroup,817 pBandwidthGroup,818 fSetError);816 return mBandwidthControl->i_getBandwidthGroupByName(strBandwidthGroup, 817 pBandwidthGroup, 818 fSetError); 819 819 } 820 820 -
trunk/src/VBox/Main/include/SerialPortImpl.h
r41214 r49644 7 7 8 8 /* 9 * Copyright (C) 2006-201 2Oracle Corporation9 * Copyright (C) 2006-2013 Oracle Corporation 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 21 21 #define ____H_SERIALPORTIMPL 22 22 23 #include " VirtualBoxBase.h"23 #include "SerialPortWrap.h" 24 24 25 25 class GuestOSType; … … 31 31 32 32 class ATL_NO_VTABLE SerialPort : 33 public VirtualBoxBase, 34 VBOX_SCRIPTABLE_IMPL(ISerialPort) 33 public SerialPortWrap 35 34 { 36 35 public: 37 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(SerialPort, ISerialPort)38 36 39 DECLARE_NOT_AGGREGATABLE(SerialPort) 40 41 DECLARE_PROTECT_FINAL_CONSTRUCT() 42 43 BEGIN_COM_MAP(SerialPort) 44 VBOX_DEFAULT_INTERFACE_ENTRIES (ISerialPort) 45 END_COM_MAP() 46 47 DECLARE_EMPTY_CTOR_DTOR (SerialPort) 37 DECLARE_EMPTY_CTOR_DTOR(SerialPort) 48 38 49 39 HRESULT FinalConstruct(); … … 56 46 void uninit(); 57 47 58 // ISerialPort properties 59 STDMETHOD(COMGETTER(Slot)) (ULONG *aSlot); 60 STDMETHOD(COMGETTER(Enabled)) (BOOL *aEnabled); 61 STDMETHOD(COMSETTER(Enabled)) (BOOL aEnabled); 62 STDMETHOD(COMGETTER(HostMode)) (PortMode_T *aHostMode); 63 STDMETHOD(COMSETTER(HostMode)) (PortMode_T aHostMode); 64 STDMETHOD(COMGETTER(IRQ)) (ULONG *aIRQ); 65 STDMETHOD(COMSETTER(IRQ)) (ULONG aIRQ); 66 STDMETHOD(COMGETTER(IOBase) ) (ULONG *aIOBase); 67 STDMETHOD(COMSETTER(IOBase)) (ULONG aIOBase); 68 STDMETHOD(COMGETTER(Path)) (BSTR *aPath); 69 STDMETHOD(COMSETTER(Path)) (IN_BSTR aPath); 70 STDMETHOD(COMGETTER(Server)) (BOOL *aServer); 71 STDMETHOD(COMSETTER(Server)) (BOOL aServer); 48 // public methods only for internal purposes 49 HRESULT i_loadSettings(const settings::SerialPort &data); 50 HRESULT i_saveSettings(settings::SerialPort &data); 72 51 73 // public methods only for internal purposes 52 bool i_isModified(); 53 void i_rollback(); 54 void i_commit(); 55 void i_copyFrom(SerialPort *aThat); 74 56 75 HRESULT loadSettings(const settings::SerialPort &data); 76 HRESULT saveSettings(settings::SerialPort &data); 77 78 bool isModified(); 79 void rollback(); 80 void commit(); 81 void copyFrom(SerialPort *aThat); 82 83 void applyDefaults (GuestOSType *aOsType); 57 void i_applyDefaults (GuestOSType *aOsType); 84 58 85 59 // public methods for internal purposes only … … 87 61 88 62 private: 89 HRESULT checkSetPath(const Utf8Str &str);90 63 91 struct Data; 64 HRESULT i_checkSetPath(const Utf8Str &str); 65 66 // Wrapped ISerialPort properties 67 HRESULT getEnabled(BOOL *aEnabled); 68 HRESULT setEnabled(BOOL aEnabled); 69 HRESULT getHostMode(PortMode_T *aHostMode); 70 HRESULT setHostMode(PortMode_T aHostMode); 71 HRESULT getSlot(ULONG *aSlot); 72 HRESULT getIRQ(ULONG *aIRQ); 73 HRESULT setIRQ(ULONG aIRQ); 74 HRESULT getIOBase(ULONG *aIOBase); 75 HRESULT setIOBase(ULONG aIOBase); 76 HRESULT getServer(BOOL *aServer); 77 HRESULT setServer(BOOL aServer); 78 HRESULT getPath(com::Utf8Str &aPath); 79 HRESULT setPath(const com::Utf8Str &aPath); 80 81 //////////////////////////////////////////////////////////////////////////////// 82 //// 83 //// SerialPort private data definition 84 //// 85 ////////////////////////////////////////////////////////////////////////////////// 86 // 87 struct Data 88 { 89 Data() 90 : fModified(false), 91 pMachine(NULL) 92 { } 93 94 bool fModified; 95 Machine * const pMachine; 96 const ComObjPtr<SerialPort> pPeer; 97 Backupable<settings::SerialPort> bd; 98 }; 99 92 100 Data *m; 93 101 }; -
trunk/src/VBox/Main/include/StorageControllerImpl.h
r44529 r49644 7 7 8 8 /* 9 * Copyright (C) 2008-201 2Oracle Corporation9 * Copyright (C) 2008-2013 Oracle Corporation 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 20 20 #ifndef ____H_STORAGECONTROLLERIMPL 21 21 #define ____H_STORAGECONTROLLERIMPL 22 23 #include "VirtualBoxBase.h" 22 #include "StorageControllerWrap.h" 24 23 25 24 class ATL_NO_VTABLE StorageController : 26 public VirtualBoxBase, 27 VBOX_SCRIPTABLE_IMPL(IStorageController) 25 public StorageControllerWrap 28 26 { 29 27 public: 30 28 31 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(StorageController, IStorageController) 32 33 DECLARE_NOT_AGGREGATABLE (StorageController) 34 35 DECLARE_PROTECT_FINAL_CONSTRUCT() 36 37 BEGIN_COM_MAP(StorageController) 38 VBOX_DEFAULT_INTERFACE_ENTRIES (IStorageController) 39 END_COM_MAP() 40 41 StorageController() { }; 42 ~StorageController() { }; 29 DECLARE_EMPTY_CTOR_DTOR(StorageController) 43 30 44 31 HRESULT FinalConstruct(); … … 58 45 void uninit(); 59 46 60 // IStorageController properties61 STDMETHOD(COMGETTER(Name)) (BSTR *aName);62 STDMETHOD(COMGETTER(Bus)) (StorageBus_T *aBus);63 STDMETHOD(COMGETTER(ControllerType)) (StorageControllerType_T *aControllerType);64 STDMETHOD(COMSETTER(ControllerType)) (StorageControllerType_T aControllerType);65 STDMETHOD(COMGETTER(MaxDevicesPerPortCount)) (ULONG *aMaxDevices);66 STDMETHOD(COMGETTER(MinPortCount)) (ULONG *aMinPortCount);67 STDMETHOD(COMGETTER(MaxPortCount)) (ULONG *aMaxPortCount);68 STDMETHOD(COMGETTER(PortCount)) (ULONG *aPortCount);69 STDMETHOD(COMSETTER(PortCount)) (ULONG aPortCount);70 STDMETHOD(COMGETTER(Instance)) (ULONG *aInstance);71 STDMETHOD(COMSETTER(Instance)) (ULONG aInstance);72 STDMETHOD(COMGETTER(UseHostIOCache)) (BOOL *fUseHostIOCache);73 STDMETHOD(COMSETTER(UseHostIOCache)) (BOOL fUseHostIOCache);74 STDMETHOD(COMGETTER(Bootable)) (BOOL *fBootable);75 76 47 // public methods only for internal purposes 77 78 const Utf8Str &getName() const; 79 StorageControllerType_T getControllerType() const; 80 StorageBus_T getStorageBus() const; 81 ULONG getInstance() const; 82 bool getBootable() const; 83 84 HRESULT checkPortAndDeviceValid(LONG aControllerPort, 85 LONG aDevice); 86 87 void setBootable(BOOL fBootable); 88 89 void rollback(); 90 void commit(); 91 HRESULT getIDEEmulationPort (LONG DevicePosition, LONG *aPortNumber); 92 HRESULT setIDEEmulationPort (LONG DevicePosition, LONG aPortNumber); 48 const Utf8Str &i_getName() const; 49 StorageControllerType_T i_getControllerType() const; 50 StorageBus_T i_getStorageBus() const; 51 ULONG i_getInstance() const; 52 bool i_getBootable() const; 53 HRESULT i_checkPortAndDeviceValid(LONG aControllerPort, 54 LONG aDevice); 55 void i_setBootable(BOOL fBootable); 56 void i_rollback(); 57 void i_commit(); 58 HRESULT i_getIDEEmulationPort (LONG DevicePosition, LONG *aPortNumber); 59 HRESULT i_setIDEEmulationPort (LONG DevicePosition, LONG aPortNumber); 93 60 94 61 // public methods for internal purposes only 95 62 // (ensure there is a caller and a read lock before calling them!) 96 63 97 void unshare();64 void i_unshare(); 98 65 99 66 /** @note this doesn't require a read lock since mParent is constant. */ 100 Machine* getMachine(); 101 102 ComObjPtr<StorageController> getPeer(); 67 Machine* i_getMachine(); 68 ComObjPtr<StorageController> i_getPeer(); 103 69 104 70 private: 105 71 106 void printList(); 72 // Wrapped IStorageController properties 73 HRESULT getName(com::Utf8Str &aName); 74 HRESULT getMaxDevicesPerPortCount(ULONG *aMaxDevicesPerPortCount); 75 HRESULT getMinPortCount(ULONG *aMinPortCount); 76 HRESULT getMaxPortCount(ULONG *aMaxPortCount); 77 HRESULT getInstance(ULONG *aInstance); 78 HRESULT setInstance(ULONG aInstance); 79 HRESULT getPortCount(ULONG *aPortCount); 80 HRESULT setPortCount(ULONG aPortCount); 81 HRESULT getBus(StorageBus_T *aBus); 82 HRESULT getControllerType(StorageControllerType_T *aControllerType); 83 HRESULT setControllerType(StorageControllerType_T aControllerType); 84 HRESULT getUseHostIOCache(BOOL *aUseHostIOCache); 85 HRESULT setUseHostIOCache(BOOL aUseHostIOCache); 86 HRESULT getBootable(BOOL *aBootable); 87 88 void i_printList(); 107 89 108 90 struct Data; -
trunk/src/VBox/Main/include/VFSExplorerImpl.h
r47922 r49644 7 7 8 8 /* 9 * Copyright (C) 2009-201 1Oracle Corporation9 * Copyright (C) 2009-2013 Oracle Corporation 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 21 21 #define ____H_VFSEXPLORERIMPL 22 22 23 #include "V irtualBoxBase.h"23 #include "VFSExplorerWrap.h" 24 24 25 25 class ATL_NO_VTABLE VFSExplorer : 26 public VirtualBoxBase, 27 VBOX_SCRIPTABLE_IMPL(IVFSExplorer) 26 public VFSExplorerWrap 28 27 { 29 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(VFSExplorer, IVFSExplorer) 30 31 DECLARE_NOT_AGGREGATABLE(VFSExplorer) 32 33 DECLARE_PROTECT_FINAL_CONSTRUCT() 34 35 BEGIN_COM_MAP(VFSExplorer) 36 VBOX_DEFAULT_INTERFACE_ENTRIES(IVFSExplorer) 37 END_COM_MAP() 28 public: 38 29 39 30 DECLARE_EMPTY_CTOR_DTOR(VFSExplorer) … … 46 37 void uninit(); 47 38 48 /* IVFSExplorer properties */49 STDMETHOD(COMGETTER(Path))(BSTR *aPath);50 STDMETHOD(COMGETTER(Type))(VFSType_T *aType);51 52 /* IVFSExplorer methods */53 STDMETHOD(Update)(IProgress **aProgress);54 55 STDMETHOD(Cd)(IN_BSTR aDir, IProgress **aProgress);56 STDMETHOD(CdUp)(IProgress **aProgress);57 58 STDMETHOD(EntryList)(ComSafeArrayOut(BSTR, aNames), ComSafeArrayOut(VFSFileType_T, aTypes), ComSafeArrayOut(LONG64, aSizes), ComSafeArrayOut(ULONG, aModes));59 60 STDMETHOD(Exists)(ComSafeArrayIn(IN_BSTR, aNames), ComSafeArrayOut(BSTR, aExists));61 62 STDMETHOD(Remove)(ComSafeArrayIn(IN_BSTR, aNames), IProgress **aProgress);63 64 39 /* public methods only for internal purposes */ 65 66 40 static HRESULT setErrorStatic(HRESULT aResultCode, 67 41 const Utf8Str &aText) … … 71 45 72 46 private: 47 48 // wrapped IVFSExplorer properties 49 HRESULT getPath(com::Utf8Str &aPath); 50 HRESULT getType(VFSType_T *aType); 51 52 // wrapped IVFSExplorer methods 53 HRESULT update(ComPtr<IProgress> &aProgress); 54 HRESULT cd(const com::Utf8Str &aDir, ComPtr<IProgress> &aProgress); 55 HRESULT cdUp(ComPtr<IProgress> &aProgress); 56 HRESULT entryList(std::vector<com::Utf8Str> &aNames, 57 std::vector<ULONG> &aTypes, 58 std::vector<LONG64> &aSizes, 59 std::vector<ULONG> &aModes); 60 HRESULT exists(const std::vector<com::Utf8Str> &aNames, 61 std::vector<com::Utf8Str> &aExists); 62 HRESULT remove(const std::vector<com::Utf8Str> &aNames, 63 ComPtr<IProgress> &aProgress); 64 73 65 /* Private member vars */ 74 66 VirtualBox * const mVirtualBox; 75 67 68 //////////////////////////////////////////////////////////////////////////////// 69 //// 70 //// VFSExplorer definitions 71 //// 72 ////////////////////////////////////////////////////////////////////////////////// 73 // 76 74 struct TaskVFSExplorer; /* Worker thread helper */ 77 struct Data; 75 struct Data 76 { 77 struct DirEntry 78 { 79 DirEntry(Utf8Str strName, VFSFileType_T fileType, uint64_t cbSize, uint32_t fMode) 80 : name(strName) 81 , type(fileType) 82 , size(cbSize) 83 , mode(fMode) {} 84 85 Utf8Str name; 86 VFSFileType_T type; 87 uint64_t size; 88 uint32_t mode; 89 }; 90 91 VFSType_T storageType; 92 Utf8Str strUsername; 93 Utf8Str strPassword; 94 Utf8Str strHostname; 95 Utf8Str strPath; 96 Utf8Str strBucket; 97 std::list<DirEntry> entryList; 98 }; 99 78 100 Data *m; 79 101 80 102 /* Private member methods */ 81 VFSFileType_T RTToVFSFileType(int aType) const;103 VFSFileType_T i_RTToVFSFileType(int aType) const; 82 104 83 HRESULT updateFS(TaskVFSExplorer *aTask); 84 HRESULT deleteFS(TaskVFSExplorer *aTask); 85 HRESULT updateS3(TaskVFSExplorer *aTask); 86 HRESULT deleteS3(TaskVFSExplorer *aTask); 105 HRESULT i_updateFS(TaskVFSExplorer *aTask); 106 HRESULT i_deleteFS(TaskVFSExplorer *aTask); 107 HRESULT i_updateS3(TaskVFSExplorer *aTask); 108 HRESULT i_deleteS3(TaskVFSExplorer *aTask); 109 87 110 }; 88 111 -
trunk/src/VBox/Main/include/VRDEServerImpl.h
r45680 r49644 21 21 #define ____H_VRDPSERVER 22 22 23 #include "VirtualBoxBase.h"24 25 #include <VBox/VBoxAuth.h>26 23 #include <VBox/settings.h> 24 #include "VRDEServerWrap.h" 27 25 28 26 class ATL_NO_VTABLE VRDEServer : 29 public VirtualBoxBase, 30 VBOX_SCRIPTABLE_IMPL(IVRDEServer) 27 public VRDEServerWrap 31 28 { 32 29 public: 33 30 34 struct Data 35 { 36 BOOL mEnabled; 37 Bstr mAuthLibrary; 38 AuthType_T mAuthType; 39 ULONG mAuthTimeout; 40 BOOL mAllowMultiConnection; 41 BOOL mReuseSingleConnection; 42 Utf8Str mVrdeExtPack; 43 settings::StringsMap mProperties; 44 }; 45 46 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(VRDEServer, IVRDEServer) 47 48 DECLARE_NOT_AGGREGATABLE(VRDEServer) 49 50 DECLARE_PROTECT_FINAL_CONSTRUCT() 51 52 BEGIN_COM_MAP(VRDEServer) 53 VBOX_DEFAULT_INTERFACE_ENTRIES(IVRDEServer) 54 END_COM_MAP() 31 typedef std::map<com::Utf8Str, com::Utf8Str> StringsMap; 55 32 56 33 DECLARE_EMPTY_CTOR_DTOR(VRDEServer) … … 65 42 void uninit(); 66 43 67 // IVRDEServer properties68 STDMETHOD(COMGETTER(Enabled))(BOOL *aEnabled);69 STDMETHOD(COMSETTER(Enabled))(BOOL aEnable);70 STDMETHOD(COMGETTER(AuthType))(AuthType_T *aType);71 STDMETHOD(COMSETTER(AuthType))(AuthType_T aType);72 STDMETHOD(COMGETTER(AuthTimeout))(ULONG *aTimeout);73 STDMETHOD(COMSETTER(AuthTimeout))(ULONG aTimeout);74 STDMETHOD(COMGETTER(AllowMultiConnection))(BOOL *aAllowMultiConnection);75 STDMETHOD(COMSETTER(AllowMultiConnection))(BOOL aAllowMultiConnection);76 STDMETHOD(COMGETTER(ReuseSingleConnection))(BOOL *aReuseSingleConnection);77 STDMETHOD(COMSETTER(ReuseSingleConnection))(BOOL aReuseSingleConnection);78 STDMETHOD(COMGETTER(VRDEExtPack))(BSTR *aExtPack);79 STDMETHOD(COMSETTER(VRDEExtPack))(IN_BSTR aExtPack);80 STDMETHOD(COMGETTER(AuthLibrary))(BSTR *aValue);81 STDMETHOD(COMSETTER(AuthLibrary))(IN_BSTR aValue);82 STDMETHOD(COMGETTER(VRDEProperties))(ComSafeArrayOut(BSTR, aProperties));83 84 // IVRDEServer methods85 STDMETHOD(SetVRDEProperty)(IN_BSTR aKey, IN_BSTR aValue);86 STDMETHOD(GetVRDEProperty)(IN_BSTR aKey, BSTR *aValue);87 88 44 // public methods only for internal purposes 89 90 HRESULT loadSettings(const settings::VRDESettings &data); 91 HRESULT saveSettings(settings::VRDESettings &data); 92 93 void rollback(); 94 void commit(); 95 void copyFrom(VRDEServer *aThat); 45 HRESULT i_loadSettings(const settings::VRDESettings &data); 46 HRESULT i_saveSettings(settings::VRDESettings &data); 47 void i_rollback(); 48 void i_commit(); 49 void i_copyFrom(VRDEServer *aThat); 96 50 97 51 private: 52 53 // wrapped IVRDEServer properties 54 HRESULT getEnabled(BOOL *aEnabled); 55 HRESULT setEnabled(BOOL aEnabled); 56 HRESULT getAuthType(AuthType_T *aAuthType); 57 HRESULT setAuthType(AuthType_T aAuthType); 58 HRESULT getAuthTimeout(ULONG *aAuthTimeout); 59 HRESULT setAuthTimeout(ULONG aAuthTimeout); 60 HRESULT getAllowMultiConnection(BOOL *aAllowMultiConnection); 61 HRESULT setAllowMultiConnection(BOOL aAllowMultiConnection); 62 HRESULT getReuseSingleConnection(BOOL *aReuseSingleConnection); 63 HRESULT setReuseSingleConnection(BOOL aReuseSingleConnection); 64 HRESULT getVRDEExtPack(com::Utf8Str &aVRDEExtPack); 65 HRESULT setVRDEExtPack(const com::Utf8Str &aVRDEExtPack); 66 HRESULT getAuthLibrary(com::Utf8Str &aAuthLibrary); 67 HRESULT setAuthLibrary(const com::Utf8Str &aAuthLibrary); 68 HRESULT getVRDEProperties(std::vector<com::Utf8Str> &aVRDEProperties); 69 70 // wrapped IVRDEServer methods 71 HRESULT setVRDEProperty(const com::Utf8Str &aKey, 72 const com::Utf8Str &aValue); 73 HRESULT getVRDEProperty(const com::Utf8Str &aKey, 74 com::Utf8Str &aValue); 75 76 struct Data 77 { 78 BOOL mEnabled; 79 com::Utf8Str mAuthLibrary; 80 AuthType_T mAuthType; 81 ULONG mAuthTimeout; 82 BOOL mAllowMultiConnection; 83 BOOL mReuseSingleConnection; 84 Utf8Str mVrdeExtPack; 85 StringsMap mProperties; 86 }; 98 87 99 88 Machine * const mParent; -
trunk/src/VBox/Main/src-client/PCIRawDevImpl.cpp
r45030 r49644 5 5 6 6 /* 7 * Copyright (C) 2010-201 2Oracle Corporation7 * Copyright (C) 2010-2013 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as -
trunk/src/VBox/Main/src-server/BIOSSettingsImpl.cpp
r48914 r49644 636 636 637 637 /* Initialize default BIOS settings here */ 638 m->bd->fIOAPICEnabled = aOsType-> recommendedIOAPIC();638 m->bd->fIOAPICEnabled = aOsType->i_recommendedIOAPIC(); 639 639 } 640 640 -
trunk/src/VBox/Main/src-server/BandwidthControlImpl.cpp
r46820 r49644 32 32 ///////////////////////////////////////////////////////////////////////////// 33 33 34 typedef std::list< ComObjPtr<BandwidthGroup> > BandwidthGroupList;35 36 struct BandwidthControl::Data37 {38 Data(Machine *pMachine)39 : pParent(pMachine)40 { }41 42 ~Data()43 {};44 45 Machine * const pParent;46 47 // peer machine's bandwidth control48 const ComObjPtr<BandwidthControl> pPeer;49 50 // the following fields need special backup/rollback/commit handling,51 // so they cannot be a part of BackupableData52 Backupable<BandwidthGroupList> llBandwidthGroups;53 };54 55 34 // constructor / destructor 56 35 ///////////////////////////////////////////////////////////////////////////// 36 DEFINE_EMPTY_CTOR_DTOR(BandwidthControl) 37 57 38 58 39 HRESULT BandwidthControl::FinalConstruct() … … 133 114 /* create copies of all groups */ 134 115 m->llBandwidthGroups.allocate(); 135 BandwidthGroupList::const_iterator it = aThat->m->llBandwidthGroups->begin(); 136 while (it != aThat->m->llBandwidthGroups->end()) 116 BandwidthGroupList::const_iterator it; 117 for(it = aThat->m->llBandwidthGroups->begin(); 118 it != aThat->m->llBandwidthGroups->end(); 119 ++it) 137 120 { 138 121 ComObjPtr<BandwidthGroup> group; … … 140 123 group->init(this, *it); 141 124 m->llBandwidthGroups->push_back(group); 142 ++ it;143 125 } 144 126 … … 174 156 /* create copies of all groups */ 175 157 m->llBandwidthGroups.allocate(); 176 BandwidthGroupList::const_iterator it = aThat->m->llBandwidthGroups->begin(); 177 while (it != aThat->m->llBandwidthGroups->end()) 158 BandwidthGroupList::const_iterator it; 159 for(it = aThat->m->llBandwidthGroups->begin(); 160 it != aThat->m->llBandwidthGroups->end(); 161 ++it) 178 162 { 179 163 ComObjPtr<BandwidthGroup> group; … … 181 165 group->init(this, *it); 182 166 m->llBandwidthGroups->push_back(group); 183 ++ it;184 167 } 185 168 … … 195 178 * represented by @a aThat (locked for reading). 196 179 */ 197 void BandwidthControl:: copyFrom (BandwidthControl *aThat)180 void BandwidthControl::i_copyFrom (BandwidthControl *aThat) 198 181 { 199 182 AssertReturnVoid (aThat != NULL); … … 221 204 m->llBandwidthGroups.backup(); 222 205 m->llBandwidthGroups->clear(); 223 for (BandwidthGroupList::const_iterator it = aThat->m->llBandwidthGroups->begin(); 206 BandwidthGroupList::const_iterator it; 207 for(it = aThat->m->llBandwidthGroups->begin(); 224 208 it != aThat->m->llBandwidthGroups->end(); 225 ++ 209 ++it) 226 210 { 227 211 ComObjPtr<BandwidthGroup> group; 228 212 group.createObject(); 229 213 group->initCopy (this, *it); 230 m->llBandwidthGroups->push_back 214 m->llBandwidthGroups->push_back(group); 231 215 } 232 216 } 233 217 234 218 /** @note Locks objects for writing! */ 235 void BandwidthControl:: rollback()219 void BandwidthControl::i_rollback() 236 220 { 237 221 AutoCaller autoCaller(this); … … 243 227 244 228 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 229 BandwidthGroupList::const_iterator it; 245 230 246 231 if (!m->llBandwidthGroups.isNull()) … … 249 234 { 250 235 /* unitialize all new groups (absent in the backed up list). */ 251 BandwidthGroupList::const_iterator it = m->llBandwidthGroups->begin();252 236 BandwidthGroupList *backedList = m->llBandwidthGroups.backedUpData(); 253 while (it != m->llBandwidthGroups->end()) 237 for(it = m->llBandwidthGroups->begin(); 238 it != m->llBandwidthGroups->end(); 239 ++it) 254 240 { 255 241 if ( std::find(backedList->begin(), backedList->end(), *it) 256 == backedList->end() 257 ) 258 { 242 == backedList->end()) 259 243 (*it)->uninit(); 260 }261 ++it;262 244 } 263 245 … … 267 249 268 250 /* rollback any changes to groups after restoring the list */ 269 BandwidthGroupList::const_iterator it = m->llBandwidthGroups->begin(); 270 while (it != m->llBandwidthGroups->end()) 271 { 272 (*it)->rollback(); 273 ++it; 274 } 275 } 276 } 277 278 void BandwidthControl::commit() 251 for(it = m->llBandwidthGroups->begin(); 252 it != m->llBandwidthGroups->end(); 253 ++it) 254 (*it)->i_rollback(); 255 } 256 } 257 258 void BandwidthControl::i_commit() 279 259 { 280 260 bool commitBandwidthGroups = false; 261 BandwidthGroupList::const_iterator it; 281 262 282 263 if (m->llBandwidthGroups.isBackedUp()) … … 291 272 * peers for those who have peers) */ 292 273 BandwidthGroupList *newList = new BandwidthGroupList(); 293 BandwidthGroupList::const_iterator it = m->llBandwidthGroups->begin(); 294 while (it != m->llBandwidthGroups->end()) 274 for(it = m->llBandwidthGroups->begin(); it != m->llBandwidthGroups->end(); ++it) 295 275 { 296 (*it)-> commit();276 (*it)->i_commit(); 297 277 298 278 /* look if this group has a peer group */ 299 ComObjPtr<BandwidthGroup> peer = (*it)-> getPeer();279 ComObjPtr<BandwidthGroup> peer = (*it)->i_getPeer(); 300 280 if (!peer) 301 281 { … … 317 297 318 298 /* uninit old peer's controllers that are left */ 319 it = m->pPeer->m->llBandwidthGroups->begin();320 while (it != m->pPeer->m->llBandwidthGroups->end())321 {299 for(it = m->pPeer->m->llBandwidthGroups->begin(); 300 it != m->pPeer->m->llBandwidthGroups->end(); 301 ++it) 322 302 (*it)->uninit(); 323 ++it;324 }325 303 326 304 /* attach new list of controllers to our peer */ … … 343 321 if (commitBandwidthGroups) 344 322 { 345 BandwidthGroupList::const_iterator it = m->llBandwidthGroups->begin(); 346 while (it != m->llBandwidthGroups->end()) 347 { 348 (*it)->commit(); 349 ++it; 350 } 323 for(it = m->llBandwidthGroups->begin(); 324 it != m->llBandwidthGroups->end(); 325 ++it) 326 (*it)->i_commit(); 351 327 } 352 328 } … … 367 343 // uninit all groups on the list (it's a standard std::list not an ObjectsList 368 344 // so we must uninit() manually) 369 for (BandwidthGroupList::iterator it = m->llBandwidthGroups->begin(); 345 BandwidthGroupList::iterator it; 346 for (it = m->llBandwidthGroups->begin(); 370 347 it != m->llBandwidthGroups->end(); 371 348 ++it) … … 385 362 * 386 363 * @param aName storage controller name to find 387 * @param a StorageControllerwhere to return the found storage controller364 * @param aBandwidthGroup where to return the found storage controller 388 365 * @param aSetError true to set extended error info on failure 389 366 */ 390 HRESULT BandwidthControl:: getBandwidthGroupByName(constUtf8Str &aName,391 ComObjPtr<BandwidthGroup> &aBandwidthGroup,392 bool aSetError /* = false */)367 HRESULT BandwidthControl::i_getBandwidthGroupByName(const com::Utf8Str &aName, 368 ComObjPtr<BandwidthGroup> &aBandwidthGroup, 369 bool aSetError /* = false */) 393 370 { 394 371 AssertReturn(!aName.isEmpty(), E_INVALIDARG); … … 398 375 ++it) 399 376 { 400 if ((*it)-> getName() == aName)377 if ((*it)->i_getName() == aName) 401 378 { 402 379 aBandwidthGroup = (*it); … … 411 388 return VBOX_E_OBJECT_NOT_FOUND; 412 389 } 413 414 STDMETHODIMP BandwidthControl::CreateBandwidthGroup(IN_BSTR aName, BandwidthGroupType_T aType, LONG64 aMaxBytesPerSec) 390 // To do 391 HRESULT BandwidthControl::createBandwidthGroup(const com::Utf8Str &aName, 392 BandwidthGroupType_T aType, 393 LONG64 aMaxBytesPerSec) 415 394 { 416 395 if (aMaxBytesPerSec < 0) … … 418 397 tr("Bandwidth group limit cannot be negative")); 419 398 420 AutoCaller autoCaller(this);421 if (FAILED(autoCaller.rc())) return autoCaller.rc();422 423 399 /* the machine needs to be mutable */ 424 400 AutoMutableStateDependency adep(m->pParent); … … 429 405 /* try to find one with the name first. */ 430 406 ComObjPtr<BandwidthGroup> group; 431 432 HRESULT rc = getBandwidthGroupByName(aName, group, false /* aSetError */); 407 HRESULT rc = i_getBandwidthGroupByName(aName, group, false /* aSetError */); 408 433 409 if (SUCCEEDED(rc)) 434 410 return setError(VBOX_E_OBJECT_IN_USE, 435 411 tr("Bandwidth group named '%ls' already exists"), 436 aName);412 Bstr(aName).raw()); 437 413 438 414 group.createObject(); … … 448 424 } 449 425 450 STDMETHODIMP BandwidthControl::DeleteBandwidthGroup(IN_BSTR aName) 451 { 452 CheckComArgStrNotEmptyOrNull(aName); 453 454 AutoCaller autoCaller(this); 455 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 456 426 HRESULT BandwidthControl::deleteBandwidthGroup(const com::Utf8Str &aName) 427 { 457 428 /* the machine needs to be mutable */ 458 429 AutoMutableStateDependency adep(m->pParent); … … 462 433 463 434 ComObjPtr<BandwidthGroup> group; 464 HRESULT rc = getBandwidthGroupByName(aName, group, true /* aSetError */);435 HRESULT rc = i_getBandwidthGroupByName(aName, group, true /* aSetError */); 465 436 if (FAILED(rc)) return rc; 466 437 467 if (group-> getReferences() != 0)438 if (group->i_getReferences() != 0) 468 439 return setError(VBOX_E_OBJECT_IN_USE, 469 tr("The bandwidth group '%ls' is still in use"), aName);440 tr("The bandwidth group '%ls' is still in use"), Bstr(aName).raw()); 470 441 471 442 /* We can remove it now. */ … … 473 444 m->llBandwidthGroups.backup(); 474 445 475 group-> unshare();446 group->i_unshare(); 476 447 477 448 m->llBandwidthGroups->remove(group); … … 484 455 } 485 456 486 STDMETHODIMP BandwidthControl::COMGETTER(NumGroups)(ULONG *aGroups) 487 { 488 CheckComArgNotNull(aGroups); 489 457 HRESULT BandwidthControl::getNumGroups(ULONG *aNumGroups) 458 { 459 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 460 461 *aNumGroups = m->llBandwidthGroups->size(); 462 463 return S_OK; 464 } 465 466 HRESULT BandwidthControl::getBandwidthGroup(const com::Utf8Str &aName, ComPtr<IBandwidthGroup> &aBandwidthGroup) 467 { 468 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 469 470 ComObjPtr<BandwidthGroup> group; 471 HRESULT rc = i_getBandwidthGroupByName(aName, group, true /* aSetError */); 472 473 if (SUCCEEDED(rc)) 474 group.queryInterfaceTo(aBandwidthGroup.asOutParam()); 475 476 return rc; 477 } 478 479 HRESULT BandwidthControl::getAllBandwidthGroups(std::vector<ComPtr<IBandwidthGroup> > &aBandwidthGroups) 480 { 481 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 482 aBandwidthGroups.resize(0); 483 BandwidthGroupList::const_iterator it; 484 for(it = m->llBandwidthGroups->begin(); 485 it != m->llBandwidthGroups->end(); 486 ++it) 487 aBandwidthGroups.push_back(*it); 488 489 return S_OK; 490 } 491 492 HRESULT BandwidthControl::i_loadSettings(const settings::IOSettings &data) 493 { 494 HRESULT rc = S_OK; 495 496 AutoCaller autoCaller(this); 497 AssertComRCReturnRC(autoCaller.rc()); 498 settings::BandwidthGroupList::const_iterator it; 499 for(it = data.llBandwidthGroups.begin(); 500 it != data.llBandwidthGroups.end(); 501 ++it) 502 { 503 const settings::BandwidthGroup &gr = *it; 504 rc = createBandwidthGroup(gr.strName, gr.enmType, gr.cMaxBytesPerSec); 505 if (FAILED(rc)) break; 506 } 507 508 return rc; 509 } 510 511 HRESULT BandwidthControl::i_saveSettings(settings::IOSettings &data) 512 { 490 513 AutoCaller autoCaller(this); 491 514 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 492 515 493 516 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 494 495 *aGroups = m->llBandwidthGroups->size(); 496 497 return S_OK; 498 } 499 500 STDMETHODIMP BandwidthControl::GetBandwidthGroup(IN_BSTR aName, IBandwidthGroup **aBandwidthGroup) 501 { 502 CheckComArgStrNotEmptyOrNull(aName); 503 504 AutoCaller autoCaller(this); 505 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 506 507 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 508 509 ComObjPtr<BandwidthGroup> group; 510 511 HRESULT rc = getBandwidthGroupByName(aName, group, true /* aSetError */); 512 if (SUCCEEDED(rc)) 513 group.queryInterfaceTo(aBandwidthGroup); 514 515 return rc; 516 } 517 518 STDMETHODIMP BandwidthControl::GetAllBandwidthGroups(ComSafeArrayOut(IBandwidthGroup *, aBandwidthGroups)) 519 { 520 CheckComArgOutSafeArrayPointerValid(aBandwidthGroups); 521 522 AutoCaller autoCaller(this); 523 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 524 525 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 526 527 SafeIfaceArray<IBandwidthGroup> collection (*m->llBandwidthGroups.data()); 528 collection.detachTo(ComSafeArrayOutArg(aBandwidthGroups)); 529 530 return S_OK; 531 } 532 533 HRESULT BandwidthControl::loadSettings(const settings::IOSettings &data) 534 { 535 HRESULT rc = S_OK; 536 537 AutoCaller autoCaller(this); 538 AssertComRCReturnRC(autoCaller.rc()); 539 540 for (settings::BandwidthGroupList::const_iterator it = data.llBandwidthGroups.begin(); 541 it != data.llBandwidthGroups.end(); 517 data.llBandwidthGroups.clear(); 518 BandwidthGroupList::const_iterator it; 519 for(it = m->llBandwidthGroups->begin(); 520 it != m->llBandwidthGroups->end(); 542 521 ++it) 543 {544 const settings::BandwidthGroup &gr = *it;545 rc = CreateBandwidthGroup(Bstr(gr.strName).raw(), gr.enmType, gr.cMaxBytesPerSec);546 if (FAILED(rc)) break;547 }548 549 return rc;550 }551 552 HRESULT BandwidthControl::saveSettings(settings::IOSettings &data)553 {554 AutoCaller autoCaller(this);555 if (FAILED(autoCaller.rc())) return autoCaller.rc();556 557 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);558 559 data.llBandwidthGroups.clear();560 561 for (BandwidthGroupList::const_iterator it = m->llBandwidthGroups->begin();562 it != m->llBandwidthGroups->end();563 ++it)564 522 { 565 523 AutoWriteLock groupLock(*it COMMA_LOCKVAL_SRC_POS); 566 524 settings::BandwidthGroup group; 567 525 568 group.strName = (*it)-> getName();569 group.enmType = (*it)-> getType();570 group.cMaxBytesPerSec = (*it)-> getMaxBytesPerSec();526 group.strName = (*it)->i_getName(); 527 group.enmType = (*it)->i_getType(); 528 group.cMaxBytesPerSec = (*it)->i_getMaxBytesPerSec(); 571 529 572 530 data.llBandwidthGroups.push_back(group); … … 576 534 } 577 535 578 Machine * BandwidthControl:: getMachine() const536 Machine * BandwidthControl::i_getMachine() const 579 537 { 580 538 return m->pParent; -
trunk/src/VBox/Main/src-server/BandwidthGroupImpl.cpp
r41882 r49644 5 5 6 6 /* 7 * Copyright (C) 2006-201 2Oracle Corporation7 * Copyright (C) 2006-2013 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 25 25 #include <iprt/cpp/utils.h> 26 26 27 ////////////////////////////////////////////////////////////////////////////////28 //29 // private member data definition30 //31 ////////////////////////////////////////////////////////////////////////////////32 33 struct BackupableBandwidthGroupData34 {35 BackupableBandwidthGroupData()36 : enmType(BandwidthGroupType_Null),37 aMaxBytesPerSec(0),38 cReferences(0)39 { }40 41 Utf8Str strName;42 BandwidthGroupType_T enmType;43 LONG64 aMaxBytesPerSec;44 ULONG cReferences;45 };46 47 struct BandwidthGroup::Data48 {49 Data(BandwidthControl * const aBandwidthControl)50 : pParent(aBandwidthControl),51 pPeer(NULL)52 { }53 54 BandwidthControl * const pParent;55 ComObjPtr<BandwidthGroup> pPeer;56 57 // use the XML settings structure in the members for simplicity58 Backupable<BackupableBandwidthGroupData> bd;59 };60 61 27 // constructor / destructor 62 28 ///////////////////////////////////////////////////////////////////////////// 29 // 30 DEFINE_EMPTY_CTOR_DTOR(BandwidthGroup) 63 31 64 32 HRESULT BandwidthGroup::FinalConstruct() … … 228 196 } 229 197 230 STDMETHODIMP BandwidthGroup::COMGETTER(Name)(BSTR *aName) 231 { 232 CheckComArgOutPointerValid(aName); 233 234 AutoCaller autoCaller(this); 235 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 236 198 HRESULT BandwidthGroup::getName(com::Utf8Str &aName) 199 { 237 200 /* mName is constant during life time, no need to lock */ 238 m->bd.data()->strName.cloneTo(aName); 239 240 return S_OK; 241 } 242 243 STDMETHODIMP BandwidthGroup::COMGETTER(Type)(BandwidthGroupType_T *aType) 244 { 245 CheckComArgOutPointerValid(aType); 246 247 AutoCaller autoCaller(this); 248 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 249 201 aName = m->bd.data()->strName; 202 203 return S_OK; 204 } 205 206 HRESULT BandwidthGroup::getType(BandwidthGroupType_T *aType) 207 { 250 208 /* type is constant during life time, no need to lock */ 251 209 *aType = m->bd->enmType; … … 254 212 } 255 213 256 STDMETHODIMP BandwidthGroup::COMGETTER(Reference)(ULONG *aReferences) 257 { 258 CheckComArgOutPointerValid(aReferences); 259 260 AutoCaller autoCaller(this); 261 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 262 214 HRESULT BandwidthGroup::getReference(ULONG *aReferences) 215 { 263 216 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 264 217 … … 268 221 } 269 222 270 STDMETHODIMP BandwidthGroup::COMGETTER(MaxBytesPerSec)(LONG64 *aMaxBytesPerSec) 271 { 272 CheckComArgOutPointerValid(aMaxBytesPerSec); 273 274 AutoCaller autoCaller(this); 275 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 276 223 HRESULT BandwidthGroup::getMaxBytesPerSec(LONG64 *aMaxBytesPerSec) 224 { 277 225 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 278 226 … … 282 230 } 283 231 284 STDMETHODIMP BandwidthGroup::COMSETTER(MaxBytesPerSec)(LONG64 aMaxBytesPerSec)232 HRESULT BandwidthGroup::setMaxBytesPerSec(LONG64 aMaxBytesPerSec) 285 233 { 286 234 if (aMaxBytesPerSec < 0) … … 288 236 tr("Bandwidth group limit cannot be negative")); 289 237 290 AutoCaller autoCaller(this);291 if (FAILED(autoCaller.rc())) return autoCaller.rc();292 293 238 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 294 239 … … 297 242 298 243 /* inform direct session if any. */ 299 ComObjPtr<Machine> pMachine = m->pParent-> getMachine();244 ComObjPtr<Machine> pMachine = m->pParent->i_getMachine(); 300 245 alock.release(); 301 246 pMachine->onBandwidthGroupChange(this); … … 308 253 309 254 /** @note Locks objects for writing! */ 310 void BandwidthGroup:: rollback()255 void BandwidthGroup::i_rollback() 311 256 { 312 257 AutoCaller autoCaller(this); … … 322 267 * for writing) if there is one. 323 268 */ 324 void BandwidthGroup:: commit()269 void BandwidthGroup::i_commit() 325 270 { 326 271 /* sanity */ … … 355 300 * represented by @a aThat (locked for reading). 356 301 */ 357 void BandwidthGroup:: unshare()302 void BandwidthGroup::i_unshare() 358 303 { 359 304 /* sanity */ … … 381 326 } 382 327 383 ComObjPtr<BandwidthGroup> BandwidthGroup::getPeer() 384 { 385 return m->pPeer; 386 } 387 388 const Utf8Str& BandwidthGroup::getName() const 389 { 390 return m->bd->strName; 391 } 392 393 BandwidthGroupType_T BandwidthGroup::getType() const 394 { 395 return m->bd->enmType; 396 } 397 398 LONG64 BandwidthGroup::getMaxBytesPerSec() const 399 { 400 return m->bd->aMaxBytesPerSec; 401 } 402 403 ULONG BandwidthGroup::getReferences() const 404 { 405 return m->bd->cReferences; 406 } 407 408 void BandwidthGroup::reference() 328 void BandwidthGroup::i_reference() 409 329 { 410 330 AutoWriteLock wl(this COMMA_LOCKVAL_SRC_POS); … … 413 333 } 414 334 415 void BandwidthGroup:: release()335 void BandwidthGroup::i_release() 416 336 { 417 337 AutoWriteLock wl(this COMMA_LOCKVAL_SRC_POS); -
trunk/src/VBox/Main/src-server/DHCPServerImpl.cpp
r49618 r49644 7 7 8 8 /* 9 * Copyright (C) 2006-201 1Oracle Corporation9 * Copyright (C) 2006-2013 Oracle Corporation 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 38 38 39 39 40 struct DHCPServer::Data41 {42 Data() : enabled(FALSE) {}43 44 Bstr IPAddress;45 Bstr lowerIP;46 Bstr upperIP;47 48 BOOL enabled;49 DHCPServerRunner dhcp;50 51 DhcpOptionMap GlobalDhcpOptions;52 VmSlot2OptionsMap VmSlot2Options;53 };54 55 56 40 DHCPServer::DHCPServer() 57 : m(NULL), mVirtualBox(NULL) 58 { 59 m = new DHCPServer::Data(); 41 : mVirtualBox(NULL) 42 { 60 43 } 61 44 … … 63 46 DHCPServer::~DHCPServer() 64 47 { 65 if (m)66 {67 delete m;68 m = NULL;69 }70 48 } 71 49 … … 107 85 108 86 unconst(mName) = aName; 109 m ->IPAddress = "0.0.0.0";110 m ->GlobalDhcpOptions.insert(DhcpOptValuePair(DhcpOpt_SubnetMask, Bstr("0.0.0.0")));111 m ->enabled = FALSE;112 113 m ->lowerIP = "0.0.0.0";114 m ->upperIP = "0.0.0.0";87 m.IPAddress = "0.0.0.0"; 88 m.GlobalDhcpOptions.insert(DhcpOptValuePair(DhcpOpt_SubnetMask, Bstr("0.0.0.0"))); 89 m.enabled = FALSE; 90 91 m.lowerIP = "0.0.0.0"; 92 m.upperIP = "0.0.0.0"; 115 93 116 94 /* Confirm a successful initialization */ … … 132 110 133 111 unconst(mName) = data.strNetworkName; 134 m ->IPAddress = data.strIPAddress;135 m ->enabled = data.fEnabled;136 m ->lowerIP = data.strIPLower;137 m ->upperIP = data.strIPUpper;138 139 m ->GlobalDhcpOptions.clear();140 m ->GlobalDhcpOptions.insert(data.GlobalDhcpOptions.begin(),112 m.IPAddress = data.strIPAddress; 113 m.enabled = data.fEnabled; 114 m.lowerIP = data.strIPLower; 115 m.upperIP = data.strIPUpper; 116 117 m.GlobalDhcpOptions.clear(); 118 m.GlobalDhcpOptions.insert(data.GlobalDhcpOptions.begin(), 141 119 data.GlobalDhcpOptions.end()); 142 120 143 m ->VmSlot2Options.clear();144 m ->VmSlot2Options.insert(data.VmSlot2OptionsM.begin(),121 m.VmSlot2Options.clear(); 122 m.VmSlot2Options.insert(data.VmSlot2OptionsM.begin(), 145 123 data.VmSlot2OptionsM.end()); 146 124 … … 151 129 152 130 153 HRESULT DHCPServer:: saveSettings(settings::DHCPServer &data)131 HRESULT DHCPServer::i_saveSettings(settings::DHCPServer &data) 154 132 { 155 133 AutoCaller autoCaller(this); … … 159 137 160 138 data.strNetworkName = mName; 161 data.strIPAddress = m ->IPAddress;162 163 data.fEnabled = !!m ->enabled;164 data.strIPLower = m ->lowerIP;165 data.strIPUpper = m ->upperIP;139 data.strIPAddress = m.IPAddress; 140 141 data.fEnabled = !!m.enabled; 142 data.strIPLower = m.lowerIP; 143 data.strIPUpper = m.upperIP; 166 144 167 145 data.GlobalDhcpOptions.clear(); 168 data.GlobalDhcpOptions.insert(m ->GlobalDhcpOptions.begin(),169 m ->GlobalDhcpOptions.end());146 data.GlobalDhcpOptions.insert(m.GlobalDhcpOptions.begin(), 147 m.GlobalDhcpOptions.end()); 170 148 171 149 data.VmSlot2OptionsM.clear(); 172 data.VmSlot2OptionsM.insert(m->VmSlot2Options.begin(), 173 m->VmSlot2Options.end()); 174 175 return S_OK; 176 } 177 178 179 STDMETHODIMP DHCPServer::COMGETTER(NetworkName) (BSTR *aName) 180 { 181 CheckComArgOutPointerValid(aName); 182 183 AutoCaller autoCaller(this); 184 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 185 186 mName.cloneTo(aName); 187 188 return S_OK; 189 } 190 191 192 STDMETHODIMP DHCPServer::COMGETTER(Enabled) (BOOL *aEnabled) 193 { 194 CheckComArgOutPointerValid(aEnabled); 195 196 AutoCaller autoCaller(this); 197 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 198 199 *aEnabled = m->enabled; 200 201 return S_OK; 202 } 203 204 205 STDMETHODIMP DHCPServer::COMSETTER(Enabled) (BOOL aEnabled) 206 { 207 AutoCaller autoCaller(this); 208 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 209 150 data.VmSlot2OptionsM.insert(m.VmSlot2Options.begin(), 151 m.VmSlot2Options.end()); 152 153 return S_OK; 154 } 155 156 157 HRESULT DHCPServer::getNetworkName(com::Utf8Str &aName) 158 { 159 aName = mName; 160 return S_OK; 161 } 162 163 164 HRESULT DHCPServer::getEnabled(BOOL *aEnabled) 165 { 166 *aEnabled = m.enabled; 167 168 return S_OK; 169 } 170 171 172 HRESULT DHCPServer::setEnabled(BOOL aEnabled) 173 { 210 174 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 211 m ->enabled = aEnabled;175 m.enabled = aEnabled; 212 176 213 177 // save the global settings; for that we should hold only the VirtualBox lock … … 220 184 221 185 222 STDMETHODIMP DHCPServer::COMGETTER(IPAddress) (BSTR *aIPAddress) 223 { 224 CheckComArgOutPointerValid(aIPAddress); 225 226 AutoCaller autoCaller(this); 227 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 228 229 m->IPAddress.cloneTo(aIPAddress); 230 231 return S_OK; 232 } 233 234 235 STDMETHODIMP DHCPServer::COMGETTER(NetworkMask) (BSTR *aNetworkMask) 236 { 237 CheckComArgOutPointerValid(aNetworkMask); 238 239 AutoCaller autoCaller(this); 240 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 241 242 m->GlobalDhcpOptions[DhcpOpt_SubnetMask].cloneTo(aNetworkMask); 243 244 return S_OK; 245 } 246 247 248 STDMETHODIMP DHCPServer::COMGETTER(LowerIP) (BSTR *aIPAddress) 249 { 250 CheckComArgOutPointerValid(aIPAddress); 251 252 AutoCaller autoCaller(this); 253 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 254 255 m->lowerIP.cloneTo(aIPAddress); 256 257 return S_OK; 258 } 259 260 261 STDMETHODIMP DHCPServer::COMGETTER(UpperIP) (BSTR *aIPAddress) 262 { 263 CheckComArgOutPointerValid(aIPAddress); 264 265 AutoCaller autoCaller(this); 266 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 267 268 m->upperIP.cloneTo(aIPAddress); 269 270 return S_OK; 271 } 272 273 274 STDMETHODIMP DHCPServer::SetConfiguration (IN_BSTR aIPAddress, IN_BSTR aNetworkMask, IN_BSTR aLowerIP, IN_BSTR aUpperIP) 275 { 276 AssertReturn(aIPAddress != NULL, E_INVALIDARG); 277 AssertReturn(aNetworkMask != NULL, E_INVALIDARG); 278 AssertReturn(aLowerIP != NULL, E_INVALIDARG); 279 AssertReturn(aUpperIP != NULL, E_INVALIDARG); 280 281 AutoCaller autoCaller(this); 282 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 186 HRESULT DHCPServer::getIPAddress(com::Utf8Str &aIPAddress) 187 { 188 aIPAddress = Utf8Str(m.IPAddress); 189 190 return S_OK; 191 } 192 193 194 HRESULT DHCPServer::getNetworkMask(com::Utf8Str &aNetworkMask) 195 { 196 aNetworkMask = m.GlobalDhcpOptions[DhcpOpt_SubnetMask]; 197 198 return S_OK; 199 } 200 201 202 HRESULT DHCPServer::getLowerIP(com::Utf8Str &aIPAddress) 203 { 204 aIPAddress = Utf8Str(m.lowerIP); 205 206 return S_OK; 207 } 208 209 210 HRESULT DHCPServer::getUpperIP(com::Utf8Str &aIPAddress) 211 { 212 aIPAddress = Utf8Str(m.upperIP); 213 214 return S_OK; 215 } 216 217 218 HRESULT DHCPServer::setConfiguration(const com::Utf8Str &aIPAddress, 219 const com::Utf8Str &aNetworkMask, 220 const com::Utf8Str &aLowerIP, 221 const com::Utf8Str &aUpperIP) 222 { 223 AssertReturn(!aIPAddress.isEmpty(), E_INVALIDARG); 224 AssertReturn(!aNetworkMask.isEmpty(), E_INVALIDARG); 225 AssertReturn(!aLowerIP.isEmpty(), E_INVALIDARG); 226 AssertReturn(!aUpperIP.isEmpty(), E_INVALIDARG); 283 227 284 228 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 285 m ->IPAddress = aIPAddress;286 m ->GlobalDhcpOptions[DhcpOpt_SubnetMask] = aNetworkMask;287 288 m ->lowerIP = aLowerIP;289 m ->upperIP = aUpperIP;229 m.IPAddress = aIPAddress; 230 m.GlobalDhcpOptions[DhcpOpt_SubnetMask] = aNetworkMask; 231 232 m.lowerIP = aLowerIP; 233 m.upperIP = aUpperIP; 290 234 291 235 // save the global settings; for that we should hold only the VirtualBox lock … … 296 240 297 241 298 STDMETHODIMP DHCPServer::AddGlobalOption(DhcpOpt_T aOption, IN_BSTR aValue) 299 { 300 CheckComArgStr(aValue); 301 /* store global option */ 302 AutoCaller autoCaller(this); 303 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 304 242 HRESULT DHCPServer::addGlobalOption(DhcpOpt_T aOption, const com::Utf8Str &aValue) 243 { 305 244 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 306 245 307 m->GlobalDhcpOptions.insert( 308 DhcpOptValuePair(aOption, Utf8Str(aValue))); 309 310 /* Indirect way to understand that we're on NAT network */ 311 if (aOption == DhcpOpt_Router) 312 m->dhcp.setOption(NetworkServiceRunner::kNsrKeyNeedMain, "on"); 313 246 m.GlobalDhcpOptions.insert(DhcpOptValuePair(aOption, aValue)); 314 247 alock.release(); 315 248 … … 319 252 320 253 321 STDMETHODIMP DHCPServer::COMGETTER(GlobalOptions)(ComSafeArrayOut(BSTR, aValue)) 322 { 323 CheckComArgOutSafeArrayPointerValid(aValue); 324 325 AutoCaller autoCaller(this); 326 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 327 254 HRESULT DHCPServer::getGlobalOptions(std::vector<com::Utf8Str> &aValue) 255 { 328 256 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 329 330 SafeArray<BSTR> sf(m->GlobalDhcpOptions.size()); 331 int i = 0; 332 333 for (DhcpOptIterator it = m->GlobalDhcpOptions.begin(); 334 it != m->GlobalDhcpOptions.end(); ++it) 257 aValue.resize(m.GlobalDhcpOptions.size()); 258 DhcpOptionMap::const_iterator it; 259 size_t i = 0; 260 for (it = m.GlobalDhcpOptions.begin(); it != m.GlobalDhcpOptions.end(); ++it, ++i) 335 261 { 336 Bstr(Utf8StrFmt("%d:%s", (*it).first, (*it).second.c_str())).detachTo(&sf[i]); 337 i++; 262 aValue[i] = Utf8StrFmt("%d:%s", (*it).first, (*it).second.c_str()); 338 263 } 339 264 340 sf.detachTo(ComSafeArrayOutArg(aValue)); 341 342 return S_OK; 343 } 344 345 346 STDMETHODIMP DHCPServer::COMGETTER(VmConfigs)(ComSafeArrayOut(BSTR, aValue)) 347 { 348 CheckComArgOutSafeArrayPointerValid(aValue); 349 350 AutoCaller autoCaller(this); 351 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 352 265 return S_OK; 266 } 267 268 HRESULT DHCPServer::getVmConfigs(std::vector<com::Utf8Str> &aValue) 269 { 353 270 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 354 355 SafeArray<BSTR> sf(m->VmSlot2Options.size()); 356 VmSlot2OptionsIterator it = m->VmSlot2Options.begin(); 357 int i = 0; 358 for (;it != m->VmSlot2Options.end(); ++it) 271 aValue.resize(m.VmSlot2Options.size()); 272 VmSlot2OptionsMap::const_iterator it; 273 size_t i = 0; 274 for (it = m.VmSlot2Options.begin(); it != m.VmSlot2Options.end(); ++it, ++i) 359 275 { 360 Bstr(Utf8StrFmt("[%s]:%d", 361 it->first.VmName.c_str(), 362 it->first.Slot)).detachTo(&sf[i]); 363 i++; 276 aValue[i] = Utf8StrFmt("[%s]:%d", it->first.VmName.c_str(), it->first.Slot); 364 277 } 365 278 366 sf.detachTo(ComSafeArrayOutArg(aValue)); 367 368 return S_OK; 369 } 370 371 372 STDMETHODIMP DHCPServer::AddVmSlotOption(IN_BSTR aVmName, LONG aSlot, DhcpOpt_T aOption, IN_BSTR aValue) 373 { 374 AutoCaller autoCaller(this); 375 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 279 return S_OK; 280 } 281 282 283 HRESULT DHCPServer::addVmSlotOption(const com::Utf8Str &aVmName, 284 LONG aSlot, 285 DhcpOpt_T aOption, 286 const com::Utf8Str &aValue) 287 { 376 288 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 377 378 m->VmSlot2Options[settings::VmNameSlotKey( 379 com::Utf8Str(aVmName), 380 aSlot)][aOption] = com::Utf8Str(aValue); 381 382 289 m.VmSlot2Options[settings::VmNameSlotKey(aVmName, aSlot)][aOption] = aValue; 383 290 alock.release(); 384 291 … … 388 295 389 296 390 STDMETHODIMP DHCPServer::RemoveVmSlotOptions(IN_BSTR aVmName, LONG aSlot) 391 { 392 AutoCaller autoCaller(this); 393 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 297 HRESULT DHCPServer::removeVmSlotOptions(const com::Utf8Str &aVmName, LONG aSlot) 298 { 394 299 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 395 396 DhcpOptionMap& map = findOptMapByVmNameSlot(com::Utf8Str(aVmName), aSlot); 397 300 DhcpOptionMap& map = i_findOptMapByVmNameSlot(aVmName, aSlot); 398 301 map.clear(); 399 302 … … 403 306 return mVirtualBox->saveSettings(); 404 307 } 405 406 308 407 309 /** 408 310 * this is mapping (vm, slot) 409 311 */ 410 STDMETHODIMP DHCPServer::GetVmSlotOptions(IN_BSTR aVmName, 411 LONG aSlot, 412 ComSafeArrayOut(BSTR, aValues)) 413 { 414 CheckComArgOutSafeArrayPointerValid(aValues); 415 AutoCaller autoCaller(this); 416 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 312 HRESULT DHCPServer::getVmSlotOptions(const com::Utf8Str &aVmName, 313 LONG aSlot, 314 std::vector<com::Utf8Str> &aValues) 315 { 417 316 418 317 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 419 420 DhcpOptionMap& map = findOptMapByVmNameSlot(com::Utf8Str(aVmName), aSlot); 421 422 SafeArray<BSTR> sf(map.size()); 423 int i = 0; 424 425 for (DhcpOptIterator it = map.begin(); 426 it != map.end(); ++it) 318 DhcpOptionMap& map = i_findOptMapByVmNameSlot(aVmName, aSlot); 319 aValues.resize(map.size()); 320 size_t i = 0; 321 DhcpOptionMap::const_iterator it; 322 for (it = map.begin(); it != map.end(); ++it, ++i) 427 323 { 428 Bstr(Utf8StrFmt("%d:%s", (*it).first, (*it).second.c_str())).detachTo(&sf[i]); 429 i++; 324 aValues[i] = com::Utf8StrFmt("%d:%s", (*it).first, (*it).second.c_str()); 430 325 } 431 326 432 sf.detachTo(ComSafeArrayOutArg(aValues)); 433 434 return S_OK; 435 } 436 437 438 STDMETHODIMP DHCPServer::GetMacOptions(IN_BSTR aMAC, ComSafeArrayOut(BSTR, aValues)) 439 { 440 CheckComArgOutSafeArrayPointerValid(aValues); 441 442 AutoCaller autoCaller(this); 443 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 444 327 return S_OK; 328 } 329 330 331 HRESULT DHCPServer::getMacOptions(const com::Utf8Str &aMAC, std::vector<com::Utf8Str> &aOption) 332 { 445 333 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 446 334 HRESULT hrc = S_OK; 447 448 335 ComPtr<IMachine> machine; 449 336 ComPtr<INetworkAdapter> nic; 450 451 337 VmSlot2OptionsIterator it; 452 for(it = m->VmSlot2Options.begin(); 453 it != m->VmSlot2Options.end(); 454 ++it) 338 for(it = m.VmSlot2Options.begin(); it != m.VmSlot2Options.end(); ++it) 455 339 { 456 457 340 alock.release(); 458 341 hrc = mVirtualBox->FindMachine(Bstr(it->first.VmName).raw(), machine.asOutParam()); … … 477 360 if (FAILED(hrc)) /* no MAC address ??? */ 478 361 break; 479 480 if (!RTStrICmp(com::Utf8Str(mac).c_str(), com::Utf8Str(aMAC).c_str())) 481 return GetVmSlotOptions(Bstr(it->first.VmName).raw(), 362 if (!RTStrICmp(com::Utf8Str(mac).c_str(), aMAC.c_str())) 363 return getVmSlotOptions(it->first.VmName, 482 364 it->first.Slot, 483 ComSafeArrayOutArg(aValues));365 aOption); 484 366 } /* end of for */ 485 367 … … 487 369 } 488 370 489 490 STDMETHODIMP DHCPServer::COMGETTER(EventSource)(IEventSource **aEventSource) 371 HRESULT DHCPServer::getEventSource(ComPtr<IEventSource> &aEventSource) 491 372 { 492 373 NOREF(aEventSource); … … 495 376 496 377 497 STDMETHODIMP DHCPServer::Start(IN_BSTR aNetworkName, IN_BSTR aTrunkName, IN_BSTR aTrunkType) 378 HRESULT DHCPServer::start(const com::Utf8Str &aNetworkName, 379 const com::Utf8Str &aTrunkName, 380 const com::Utf8Str &aTrunkType) 498 381 { 499 382 /* Silently ignore attempts to run disabled servers. */ 500 if (!m ->enabled)383 if (!m.enabled) 501 384 return S_OK; 502 385 503 386 /* Commmon Network Settings */ 504 m->dhcp.setOption(NetworkServiceRunner::kNsrKeyNetwork, Utf8Str(aNetworkName).c_str()); 505 506 Bstr tmp(aTrunkName); 507 508 if (!tmp.isEmpty()) 509 m->dhcp.setOption(NetworkServiceRunner::kNsrTrunkName, Utf8Str(tmp).c_str()); 510 m->dhcp.setOption(NetworkServiceRunner::kNsrKeyTrunkType, Utf8Str(aTrunkType).c_str()); 387 m.dhcp.setOption(NetworkServiceRunner::kNsrKeyNetwork, aNetworkName.c_str()); 388 389 if (!aTrunkName.isEmpty()) 390 m.dhcp.setOption(NetworkServiceRunner::kNsrTrunkName, aTrunkName.c_str()); 391 392 m.dhcp.setOption(NetworkServiceRunner::kNsrKeyTrunkType, aTrunkType.c_str()); 511 393 512 394 /* XXX: should this MAC default initialization moved to NetworkServiceRunner? */ … … 518 400 guid.raw()->au8[1], 519 401 guid.raw()->au8[2]); 520 m ->dhcp.setOption(NetworkServiceRunner::kNsrMacAddress, strMAC);521 m ->dhcp.setOption(NetworkServiceRunner::kNsrIpAddress, Utf8Str(m->IPAddress).c_str());522 m ->dhcp.setOption(NetworkServiceRunner::kNsrIpNetmask, Utf8Str(m->GlobalDhcpOptions[DhcpOpt_SubnetMask]).c_str());523 m ->dhcp.setOption(DHCPServerRunner::kDsrKeyLowerIp, Utf8Str(m->lowerIP).c_str());524 m ->dhcp.setOption(DHCPServerRunner::kDsrKeyUpperIp, Utf8Str(m->upperIP).c_str());402 m.dhcp.setOption(NetworkServiceRunner::kNsrMacAddress, strMAC); 403 m.dhcp.setOption(NetworkServiceRunner::kNsrIpAddress, Utf8Str(m.IPAddress).c_str()); 404 m.dhcp.setOption(NetworkServiceRunner::kNsrIpNetmask, Utf8Str(m.GlobalDhcpOptions[DhcpOpt_SubnetMask]).c_str()); 405 m.dhcp.setOption(DHCPServerRunner::kDsrKeyLowerIp, Utf8Str(m.lowerIP).c_str()); 406 m.dhcp.setOption(DHCPServerRunner::kDsrKeyUpperIp, Utf8Str(m.upperIP).c_str()); 525 407 526 408 /* XXX: This parameters Dhcp Server will fetch via API */ 527 return RT_FAILURE(m ->dhcp.start()) ? E_FAIL : S_OK;528 //m ->dhcp.detachFromServer(); /* need to do this to avoid server shutdown on runner destruction */529 } 530 531 532 STDMETHODIMP DHCPServer::Stop (void)533 { 534 return RT_FAILURE(m ->dhcp.stop()) ? E_FAIL : S_OK;535 } 536 537 538 DhcpOptionMap& DHCPServer:: findOptMapByVmNameSlot(const com::Utf8Str& aVmName,409 return RT_FAILURE(m.dhcp.start()) ? E_FAIL : S_OK; 410 //m.dhcp.detachFromServer(); /* need to do this to avoid server shutdown on runner destruction */ 411 } 412 413 414 HRESULT DHCPServer::stop (void) 415 { 416 return RT_FAILURE(m.dhcp.stop()) ? E_FAIL : S_OK; 417 } 418 419 420 DhcpOptionMap& DHCPServer::i_findOptMapByVmNameSlot(const com::Utf8Str& aVmName, 539 421 LONG aSlot) 540 422 { 541 return m->VmSlot2Options[settings::VmNameSlotKey( 542 com::Utf8Str(aVmName), 543 aSlot)]; 544 } 423 return m.VmSlot2Options[settings::VmNameSlotKey(aVmName, aSlot)]; 424 } -
trunk/src/VBox/Main/src-server/GuestOSTypeImpl.cpp
r49074 r49644 5 5 6 6 /* 7 * Copyright (C) 2006-201 2Oracle Corporation7 * Copyright (C) 2006-2013 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 147 147 ///////////////////////////////////////////////////////////////////////////// 148 148 149 STDMETHODIMP GuestOSType::COMGETTER(FamilyId)(BSTR *aFamilyId) 150 { 151 CheckComArgOutPointerValid(aFamilyId); 152 153 AutoCaller autoCaller(this); 154 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 155 149 HRESULT GuestOSType::getFamilyId(com::Utf8Str &aFamilyId) 150 { 156 151 /* mFamilyID is constant during life time, no need to lock */ 157 mFamilyID.cloneTo(aFamilyId); 158 159 return S_OK; 160 } 161 162 STDMETHODIMP GuestOSType::COMGETTER(FamilyDescription)(BSTR *aFamilyDescription) 163 { 164 CheckComArgOutPointerValid(aFamilyDescription); 165 166 AutoCaller autoCaller(this); 167 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 168 152 aFamilyId = mFamilyID; 153 return S_OK; 154 } 155 156 157 HRESULT GuestOSType::getFamilyDescription(com::Utf8Str &aFamilyDescription) 158 { 169 159 /* mFamilyDescription is constant during life time, no need to lock */ 170 mFamilyDescription.cloneTo(aFamilyDescription); 171 172 return S_OK; 173 } 174 175 STDMETHODIMP GuestOSType::COMGETTER(Id)(BSTR *aId) 176 { 177 CheckComArgOutPointerValid(aId); 178 179 AutoCaller autoCaller(this); 180 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 181 160 aFamilyDescription = mFamilyDescription; 161 162 return S_OK; 163 } 164 165 166 HRESULT GuestOSType::getId(com::Utf8Str &aId) 167 { 182 168 /* mID is constant during life time, no need to lock */ 183 mID.cloneTo(aId); 184 185 return S_OK; 186 } 187 188 STDMETHODIMP GuestOSType::COMGETTER(Description)(BSTR *aDescription) 189 { 190 CheckComArgOutPointerValid(aDescription); 191 192 AutoCaller autoCaller(this); 193 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 194 169 aId = mID; 170 171 return S_OK; 172 } 173 174 175 HRESULT GuestOSType::getDescription(com::Utf8Str &aDescription) 176 { 195 177 /* mDescription is constant during life time, no need to lock */ 196 mDescription.cloneTo(aDescription); 197 198 return S_OK; 199 } 200 201 STDMETHODIMP GuestOSType::COMGETTER(Is64Bit)(BOOL *aIs64Bit) 202 { 203 CheckComArgOutPointerValid(aIs64Bit); 204 205 AutoCaller autoCaller(this); 206 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 207 178 aDescription = mDescription; 179 180 return S_OK; 181 } 182 183 HRESULT GuestOSType::getIs64Bit(BOOL *aIs64Bit) 184 { 208 185 /* mIs64Bit is constant during life time, no need to lock */ 209 186 *aIs64Bit = !!(mOSHint & VBOXOSHINT_64BIT); … … 212 189 } 213 190 214 STDMETHODIMP GuestOSType::COMGETTER(RecommendedIOAPIC)(BOOL *aRecommendedIOAPIC) 215 { 216 CheckComArgOutPointerValid(aRecommendedIOAPIC); 217 218 AutoCaller autoCaller(this); 219 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 220 191 HRESULT GuestOSType::getRecommendedIOAPIC(BOOL *aRecommendedIOAPIC) 192 { 221 193 /* mRecommendedIOAPIC is constant during life time, no need to lock */ 222 194 *aRecommendedIOAPIC = !!(mOSHint & VBOXOSHINT_IOAPIC); … … 225 197 } 226 198 227 STDMETHODIMP GuestOSType::COMGETTER(RecommendedVirtEx)(BOOL *aRecommendedVirtEx) 228 { 229 CheckComArgOutPointerValid(aRecommendedVirtEx); 230 231 AutoCaller autoCaller(this); 232 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 233 199 200 HRESULT GuestOSType::getRecommendedVirtEx(BOOL *aRecommendedVirtEx) 201 { 234 202 /* mRecommendedVirtEx is constant during life time, no need to lock */ 235 203 *aRecommendedVirtEx = !!(mOSHint & VBOXOSHINT_HWVIRTEX); … … 238 206 } 239 207 240 STDMETHODIMP GuestOSType::COMGETTER(RecommendedRAM)(ULONG *aRAMSize) 241 { 242 CheckComArgOutPointerValid(aRAMSize); 243 244 AutoCaller autoCaller(this); 245 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 246 208 209 HRESULT GuestOSType::getRecommendedRAM(ULONG *aRAMSize) 210 { 247 211 /* mRAMSize is constant during life time, no need to lock */ 248 212 *aRAMSize = mRAMSize; … … 251 215 } 252 216 253 STDMETHODIMP GuestOSType::COMGETTER(RecommendedVRAM)(ULONG *aVRAMSize) 254 { 255 CheckComArgOutPointerValid(aVRAMSize); 256 257 AutoCaller autoCaller(this); 258 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 259 217 218 HRESULT GuestOSType::getRecommendedVRAM(ULONG *aVRAMSize) 219 { 260 220 /* mVRAMSize is constant during life time, no need to lock */ 261 221 *aVRAMSize = mVRAMSize; … … 264 224 } 265 225 266 STDMETHODIMP GuestOSType::COMGETTER(Recommended2DVideoAcceleration)(BOOL *aRecommended2DVideoAcceleration) 267 { 268 CheckComArgOutPointerValid(aRecommended2DVideoAcceleration); 269 270 AutoCaller autoCaller(this); 271 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 272 226 227 HRESULT GuestOSType::getRecommended2DVideoAcceleration(BOOL *aRecommended2DVideoAcceleration) 228 { 273 229 /* Constant during life time, no need to lock */ 274 230 *aRecommended2DVideoAcceleration = !!(mOSHint & VBOXOSHINT_ACCEL2D); … … 277 233 } 278 234 279 STDMETHODIMP GuestOSType::COMGETTER(Recommended3DAcceleration)(BOOL *aRecommended3DAcceleration) 280 { 281 CheckComArgOutPointerValid(aRecommended3DAcceleration); 282 283 AutoCaller autoCaller(this); 284 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 285 235 236 HRESULT GuestOSType::getRecommended3DAcceleration(BOOL *aRecommended3DAcceleration) 237 { 286 238 /* Constant during life time, no need to lock */ 287 239 *aRecommended3DAcceleration = !!(mOSHint & VBOXOSHINT_ACCEL3D); … … 290 242 } 291 243 292 STDMETHODIMP GuestOSType::COMGETTER(RecommendedHDD)(LONG64 *aHDDSize) 293 { 294 CheckComArgOutPointerValid(aHDDSize); 295 296 AutoCaller autoCaller(this); 297 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 298 244 245 HRESULT GuestOSType::getRecommendedHDD(LONG64 *aHDDSize) 246 { 299 247 /* mHDDSize is constant during life time, no need to lock */ 300 248 *aHDDSize = mHDDSize; … … 303 251 } 304 252 305 STDMETHODIMP GuestOSType::COMGETTER(AdapterType)(NetworkAdapterType_T *aNetworkAdapterType) 306 { 307 CheckComArgOutPointerValid(aNetworkAdapterType); 308 309 AutoCaller autoCaller(this); 310 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 311 253 254 HRESULT GuestOSType::getAdapterType(NetworkAdapterType_T *aNetworkAdapterType) 255 { 312 256 /* mNetworkAdapterType is constant during life time, no need to lock */ 313 257 *aNetworkAdapterType = mNetworkAdapterType; … … 316 260 } 317 261 318 STDMETHODIMP GuestOSType::COMGETTER(RecommendedPAE)(BOOL *aRecommendedPAE) 319 { 320 CheckComArgOutPointerValid(aRecommendedPAE); 321 322 AutoCaller autoCaller(this); 323 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 324 262 HRESULT GuestOSType::getRecommendedPAE(BOOL *aRecommendedPAE) 263 { 325 264 /* recommended PAE is constant during life time, no need to lock */ 326 265 *aRecommendedPAE = !!(mOSHint & VBOXOSHINT_PAE); … … 329 268 } 330 269 331 STDMETHODIMP GuestOSType::COMGETTER(RecommendedFirmware)(FirmwareType_T *aFirmwareType) 332 { 333 CheckComArgOutPointerValid(aFirmwareType); 334 335 AutoCaller autoCaller(this); 336 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 337 270 271 HRESULT GuestOSType::getRecommendedFirmware(FirmwareType_T *aFirmwareType) 272 { 338 273 /* firmware type is constant during life time, no need to lock */ 339 274 if (mOSHint & VBOXOSHINT_EFI) … … 345 280 } 346 281 347 STDMETHODIMP GuestOSType::COMGETTER(RecommendedDVDStorageController)(StorageControllerType_T * aStorageControllerType) 348 { 349 CheckComArgOutPointerValid(aStorageControllerType); 350 351 AutoCaller autoCaller(this); 352 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 353 282 283 HRESULT GuestOSType::getRecommendedDVDStorageController(StorageControllerType_T *aStorageControllerType) 284 { 354 285 /* storage controller type is constant during life time, no need to lock */ 355 286 *aStorageControllerType = mDVDStorageControllerType; … … 358 289 } 359 290 360 STDMETHODIMP GuestOSType::COMGETTER(RecommendedDVDStorageBus)(StorageBus_T * aStorageBusType) 361 { 362 CheckComArgOutPointerValid(aStorageBusType); 363 364 AutoCaller autoCaller(this); 365 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 366 291 292 HRESULT GuestOSType::getRecommendedDVDStorageBus(StorageBus_T *aStorageBusType) 293 { 367 294 /* storage controller type is constant during life time, no need to lock */ 368 295 *aStorageBusType = mDVDStorageBusType; … … 371 298 } 372 299 373 STDMETHODIMP GuestOSType::COMGETTER(RecommendedHDStorageController)(StorageControllerType_T * aStorageControllerType) 374 { 375 CheckComArgOutPointerValid(aStorageControllerType); 376 377 AutoCaller autoCaller(this); 378 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 379 300 301 HRESULT GuestOSType::getRecommendedHDStorageController(StorageControllerType_T *aStorageControllerType) 302 { 380 303 /* storage controller type is constant during life time, no need to lock */ 381 304 *aStorageControllerType = mHDStorageControllerType; … … 384 307 } 385 308 386 STDMETHODIMP GuestOSType::COMGETTER(RecommendedHDStorageBus)(StorageBus_T * aStorageBusType) 387 { 388 CheckComArgOutPointerValid(aStorageBusType); 389 390 AutoCaller autoCaller(this); 391 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 392 309 310 HRESULT GuestOSType::getRecommendedHDStorageBus(StorageBus_T *aStorageBusType) 311 { 393 312 /* storage controller type is constant during life time, no need to lock */ 394 313 *aStorageBusType = mHDStorageBusType; … … 397 316 } 398 317 399 STDMETHODIMP GuestOSType::COMGETTER(RecommendedUSBHID)(BOOL *aRecommendedUSBHID) 400 { 401 CheckComArgOutPointerValid(aRecommendedUSBHID); 402 403 AutoCaller autoCaller(this); 404 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 405 318 319 HRESULT GuestOSType::getRecommendedUSBHID(BOOL *aRecommendedUSBHID) 320 { 406 321 /* HID type is constant during life time, no need to lock */ 407 322 *aRecommendedUSBHID = !!(mOSHint & VBOXOSHINT_USBHID); … … 410 325 } 411 326 412 STDMETHODIMP GuestOSType::COMGETTER(RecommendedHPET)(BOOL *aRecommendedHPET) 413 { 414 CheckComArgOutPointerValid(aRecommendedHPET); 415 416 AutoCaller autoCaller(this); 417 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 418 327 328 HRESULT GuestOSType::getRecommendedHPET(BOOL *aRecommendedHPET) 329 { 419 330 /* HPET recommendation is constant during life time, no need to lock */ 420 331 *aRecommendedHPET = !!(mOSHint & VBOXOSHINT_HPET); … … 423 334 } 424 335 425 STDMETHODIMP GuestOSType::COMGETTER(RecommendedUSBTablet)(BOOL *aRecommendedUSBTablet) 426 { 427 CheckComArgOutPointerValid(aRecommendedUSBTablet); 428 429 AutoCaller autoCaller(this); 430 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 431 336 337 HRESULT GuestOSType::getRecommendedUSBTablet(BOOL *aRecommendedUSBTablet) 338 { 432 339 /* HID type is constant during life time, no need to lock */ 433 340 *aRecommendedUSBTablet = !!(mOSHint & VBOXOSHINT_USBTABLET); … … 436 343 } 437 344 438 STDMETHODIMP GuestOSType::COMGETTER(RecommendedRTCUseUTC)(BOOL *aRecommendedRTCUseUTC) 439 { 440 CheckComArgOutPointerValid(aRecommendedRTCUseUTC); 441 442 AutoCaller autoCaller(this); 443 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 444 345 346 HRESULT GuestOSType::getRecommendedRTCUseUTC(BOOL *aRecommendedRTCUseUTC) 347 { 445 348 /* Value is constant during life time, no need to lock */ 446 349 *aRecommendedRTCUseUTC = !!(mOSHint & VBOXOSHINT_RTCUTC); … … 449 352 } 450 353 451 STDMETHODIMP GuestOSType::COMGETTER(RecommendedChipset) (ChipsetType_T *aChipsetType) 452 { 453 CheckComArgOutPointerValid(aChipsetType); 454 455 AutoCaller autoCaller(this); 456 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 457 354 355 HRESULT GuestOSType::getRecommendedChipset(ChipsetType_T *aChipsetType) 356 { 458 357 /* chipset type is constant during life time, no need to lock */ 459 358 *aChipsetType = mChipsetType; … … 462 361 } 463 362 464 STDMETHODIMP GuestOSType::COMGETTER(RecommendedAudioController) (AudioControllerType_T *aAudioController) 465 { 466 CheckComArgOutPointerValid(aAudioController); 467 468 AutoCaller autoCaller(this); 469 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 470 363 364 HRESULT GuestOSType::getRecommendedAudioController(AudioControllerType_T *aAudioController) 365 { 471 366 *aAudioController = mAudioControllerType; 472 367 … … 474 369 } 475 370 476 STDMETHODIMP GuestOSType::COMGETTER(RecommendedFloppy)(BOOL *aRecommendedFloppy) 477 { 478 CheckComArgOutPointerValid(aRecommendedFloppy); 479 480 AutoCaller autoCaller(this); 481 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 482 371 372 HRESULT GuestOSType::getRecommendedFloppy(BOOL *aRecommendedFloppy) 373 { 483 374 /* Value is constant during life time, no need to lock */ 484 375 *aRecommendedFloppy = !!(mOSHint & VBOXOSHINT_FLOPPY); … … 487 378 } 488 379 489 STDMETHODIMP GuestOSType::COMGETTER(RecommendedUSB)(BOOL *aRecommendedUSB) 490 { 491 CheckComArgOutPointerValid(aRecommendedUSB); 492 493 AutoCaller autoCaller(this); 494 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 495 380 381 HRESULT GuestOSType::getRecommendedUSB(BOOL *aRecommendedUSB) 382 { 496 383 /* Value is constant during life time, no need to lock */ 497 384 *aRecommendedUSB = !(mOSHint & VBOXOSHINT_NOUSB); … … 500 387 } 501 388 502 STDMETHODIMP GuestOSType::COMGETTER(RecommendedTFReset)(BOOL *aRecommendedTFReset) 503 { 504 CheckComArgOutPointerValid(aRecommendedTFReset); 505 506 AutoCaller autoCaller(this); 507 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 508 389 HRESULT GuestOSType::getRecommendedTFReset(BOOL *aRecommendedTFReset) 390 { 509 391 /* recommended triple fault behavior is constant during life time, no need to lock */ 510 392 *aRecommendedTFReset = !!(mOSHint & VBOXOSHINT_TFRESET); … … 512 394 return S_OK; 513 395 } 514 515 396 /* vi: set tabstop=4 shiftwidth=4 expandtab: */ -
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r49552 r49644 337 337 { 338 338 /* Store OS type */ 339 mUserData->s.strOsType = aOsType->i d();339 mUserData->s.strOsType = aOsType->i_id(); 340 340 341 341 /* Apply BIOS defaults */ … … 348 348 /* Apply serial port defaults */ 349 349 for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); ++slot) 350 mSerialPorts[slot]-> applyDefaults(aOsType);350 mSerialPorts[slot]->i_applyDefaults(aOsType); 351 351 352 352 /* Let the OS type select 64-bit ness. */ 353 mHWData->mLongMode = aOsType->i s64Bit()353 mHWData->mLongMode = aOsType->i_is64Bit() 354 354 ? settings::Hardware::LongMode_Enabled : settings::Hardware::LongMode_Disabled; 355 355 } … … 4070 4070 4071 4071 // check that the port and device are not out of range 4072 rc = ctl-> checkPortAndDeviceValid(aControllerPort, aDevice);4072 rc = ctl->i_checkPortAndDeviceValid(aControllerPort, aDevice); 4073 4073 if (FAILED(rc)) return rc; 4074 4074 … … 4974 4974 Assert(SUCCEEDED(rc)); 4975 4975 4976 pBandwidthGroupOld-> release();4976 pBandwidthGroupOld->i_release(); 4977 4977 pAttach->updateBandwidthGroup(Utf8Str::Empty); 4978 4978 } … … 4980 4980 if (!group.isNull()) 4981 4981 { 4982 group-> reference();4983 pAttach->updateBandwidthGroup(group-> getName());4982 group->i_reference(); 4983 pAttach->updateBandwidthGroup(group->i_getName()); 4984 4984 } 4985 4985 … … 6448 6448 ++it) 6449 6449 { 6450 if ((*it)-> getStorageBus() == aConnectionType)6451 { 6452 ULONG ulCurInst = (*it)-> getInstance();6450 if ((*it)->i_getStorageBus() == aConnectionType) 6451 { 6452 ULONG ulCurInst = (*it)->i_getInstance(); 6453 6453 6454 6454 if (ulCurInst >= ulInstance) … … 6456 6456 6457 6457 /* Only one controller of each type can be marked as bootable. */ 6458 if ((*it)-> getBootable())6458 if ((*it)->i_getBootable()) 6459 6459 fBootable = false; 6460 6460 } … … 6508 6508 ++it) 6509 6509 { 6510 if ((*it)-> getInstance() == aInstance)6510 if ((*it)->i_getInstance() == aInstance) 6511 6511 { 6512 6512 (*it).queryInterfaceTo(aStorageController); … … 6544 6544 ComObjPtr<StorageController> aCtrl = (*it); 6545 6545 6546 if ( (aCtrl-> getName() != Utf8Str(aName))6547 && aCtrl-> getBootable() == TRUE6548 && aCtrl-> getStorageBus() == ctrl->getStorageBus()6549 && aCtrl-> getControllerType() == ctrl->getControllerType())6546 if ( (aCtrl->i_getName() != Utf8Str(aName)) 6547 && aCtrl->i_getBootable() == TRUE 6548 && aCtrl->i_getStorageBus() == ctrl->i_getStorageBus() 6549 && aCtrl->i_getControllerType() == ctrl->i_getControllerType()) 6550 6550 { 6551 aCtrl-> setBootable(FALSE);6551 aCtrl->i_setBootable(FALSE); 6552 6552 break; 6553 6553 } … … 6557 6557 if (SUCCEEDED(rc)) 6558 6558 { 6559 ctrl-> setBootable(fBootable);6559 ctrl->i_setBootable(fBootable); 6560 6560 setModified(IsModified_Storage); 6561 6561 } … … 6617 6617 mStorageControllers.backup(); 6618 6618 6619 ctrl-> unshare();6619 ctrl->i_unshare(); 6620 6620 6621 6621 mStorageControllers->remove(ctrl); … … 8683 8683 8684 8684 /* initialize mOSTypeId */ 8685 mUserData->s.strOsType = mParent->getUnknownOSType()->i d();8685 mUserData->s.strOsType = mParent->getUnknownOSType()->i_id(); 8686 8686 8687 8687 /* create associated BIOS settings object */ … … 9351 9351 9352 9352 /* VRDEServer */ 9353 rc = mVRDEServer-> loadSettings(data.vrdeSettings);9353 rc = mVRDEServer->i_loadSettings(data.vrdeSettings); 9354 9354 if (FAILED(rc)) return rc; 9355 9355 … … 9359 9359 9360 9360 // Bandwidth control (must come before network adapters) 9361 rc = mBandwidthControl-> loadSettings(data.ioSettings);9361 rc = mBandwidthControl->i_loadSettings(data.ioSettings); 9362 9362 if (FAILED(rc)) return rc; 9363 9363 … … 9413 9413 9414 9414 AssertBreak(s.ulSlot < RT_ELEMENTS(mSerialPorts)); 9415 rc = mSerialPorts[s.ulSlot]-> loadSettings(s);9415 rc = mSerialPorts[s.ulSlot]->i_loadSettings(s); 9416 9416 if (FAILED(rc)) return rc; 9417 9417 } … … 9591 9591 if (ctlData.controllerType == StorageControllerType_IntelAhci) 9592 9592 { 9593 if ( (FAILED(rc = pCtl-> setIDEEmulationPort(0, ctlData.lIDE0MasterEmulationPort)))9594 || (FAILED(rc = pCtl-> setIDEEmulationPort(1, ctlData.lIDE0SlaveEmulationPort)))9595 || (FAILED(rc = pCtl-> setIDEEmulationPort(2, ctlData.lIDE1MasterEmulationPort)))9596 || (FAILED(rc = pCtl-> setIDEEmulationPort(3, ctlData.lIDE1SlaveEmulationPort)))9593 if ( (FAILED(rc = pCtl->i_setIDEEmulationPort(0, ctlData.lIDE0MasterEmulationPort))) 9594 || (FAILED(rc = pCtl->i_setIDEEmulationPort(1, ctlData.lIDE0SlaveEmulationPort))) 9595 || (FAILED(rc = pCtl->i_setIDEEmulationPort(2, ctlData.lIDE1MasterEmulationPort))) 9596 || (FAILED(rc = pCtl->i_setIDEEmulationPort(3, ctlData.lIDE1SlaveEmulationPort))) 9597 9597 ) 9598 9598 return rc; … … 9647 9647 return setError(E_FAIL, 9648 9648 tr("Duplicate attachments for storage controller '%s', port %d, device %d of the virtual machine '%s'"), 9649 aStorageController-> getName().c_str(),9649 aStorageController->i_getName().c_str(), 9650 9650 ad.lPort, 9651 9651 ad.lDevice, … … 9781 9781 if (!dev.strBwGroup.isEmpty()) 9782 9782 { 9783 rc = mBandwidthControl-> getBandwidthGroupByName(dev.strBwGroup, pBwGroup, false /* aSetError */);9783 rc = mBandwidthControl->i_getBandwidthGroupByName(dev.strBwGroup, pBwGroup, false /* aSetError */); 9784 9784 if (FAILED(rc)) 9785 9785 return setError(E_FAIL, … … 9789 9789 mUserData->s.strName.c_str(), 9790 9790 mData->m_strConfigFileFull.c_str()); 9791 pBwGroup-> reference();9792 } 9793 9794 const Bstr controllerName = aStorageController-> getName();9791 pBwGroup->i_reference(); 9792 } 9793 9794 const Bstr controllerName = aStorageController->i_getName(); 9795 9795 ComObjPtr<MediumAttachment> pAttachment; 9796 9796 pAttachment.createObject(); … … 9807 9807 dev.fDiscard, 9808 9808 dev.fHotPluggable, 9809 pBwGroup.isNull() ? Utf8Str::Empty : pBwGroup-> getName());9809 pBwGroup.isNull() ? Utf8Str::Empty : pBwGroup->i_getName()); 9810 9810 if (FAILED(rc)) break; 9811 9811 … … 9932 9932 ++it) 9933 9933 { 9934 if ((*it)-> getName() == aName)9934 if ((*it)->i_getName() == aName) 9935 9935 { 9936 9936 aStorageController = (*it); … … 10656 10656 10657 10657 /* VRDEServer settings (optional) */ 10658 rc = mVRDEServer-> saveSettings(data.vrdeSettings);10658 rc = mVRDEServer->i_saveSettings(data.vrdeSettings); 10659 10659 if (FAILED(rc)) throw rc; 10660 10660 … … 10709 10709 settings::SerialPort s; 10710 10710 s.ulSlot = slot; 10711 rc = mSerialPorts[slot]-> saveSettings(s);10711 rc = mSerialPorts[slot]->i_saveSettings(s); 10712 10712 if (FAILED(rc)) return rc; 10713 10713 … … 10765 10765 10766 10766 /* BandwidthControl (required) */ 10767 rc = mBandwidthControl-> saveSettings(data.ioSettings);10767 rc = mBandwidthControl->i_saveSettings(data.ioSettings); 10768 10768 if (FAILED(rc)) throw rc; 10769 10769 … … 10847 10847 10848 10848 settings::StorageController ctl; 10849 ctl.strName = pCtl-> getName();10850 ctl.controllerType = pCtl-> getControllerType();10851 ctl.storageBus = pCtl-> getStorageBus();10852 ctl.ulInstance = pCtl-> getInstance();10853 ctl.fBootable = pCtl-> getBootable();10849 ctl.strName = pCtl->i_getName(); 10850 ctl.controllerType = pCtl->i_getControllerType(); 10851 ctl.storageBus = pCtl->i_getStorageBus(); 10852 ctl.ulInstance = pCtl->i_getInstance(); 10853 ctl.fBootable = pCtl->i_getBootable(); 10854 10854 10855 10855 /* Save the port count. */ … … 10868 10868 if (ctl.controllerType == StorageControllerType_IntelAhci) 10869 10869 { 10870 if ( (FAILED(rc = pCtl-> getIDEEmulationPort(0, (LONG*)&ctl.lIDE0MasterEmulationPort)))10871 || (FAILED(rc = pCtl-> getIDEEmulationPort(1, (LONG*)&ctl.lIDE0SlaveEmulationPort)))10872 || (FAILED(rc = pCtl-> getIDEEmulationPort(2, (LONG*)&ctl.lIDE1MasterEmulationPort)))10873 || (FAILED(rc = pCtl-> getIDEEmulationPort(3, (LONG*)&ctl.lIDE1SlaveEmulationPort)))10870 if ( (FAILED(rc = pCtl->i_getIDEEmulationPort(0, (LONG*)&ctl.lIDE0MasterEmulationPort))) 10871 || (FAILED(rc = pCtl->i_getIDEEmulationPort(1, (LONG*)&ctl.lIDE0SlaveEmulationPort))) 10872 || (FAILED(rc = pCtl->i_getIDEEmulationPort(2, (LONG*)&ctl.lIDE1MasterEmulationPort))) 10873 || (FAILED(rc = pCtl->i_getIDEEmulationPort(3, (LONG*)&ctl.lIDE1SlaveEmulationPort))) 10874 10874 ) 10875 10875 ComAssertComRCRet(rc, rc); … … 10894 10894 MediaData::AttachmentList atts; 10895 10895 10896 HRESULT rc = getMediumAttachmentsOfController(Bstr(aStorageController-> getName()).raw(), atts);10896 HRESULT rc = getMediumAttachmentsOfController(Bstr(aStorageController->i_getName()).raw(), atts); 10897 10897 if (FAILED(rc)) return rc; 10898 10898 … … 12063 12063 while (it != mStorageControllers->end()) 12064 12064 { 12065 (*it)-> rollback();12065 (*it)->i_rollback(); 12066 12066 ++it; 12067 12067 } … … 12114 12114 12115 12115 if (mVRDEServer && (mData->flModifications & IsModified_VRDEServer)) 12116 mVRDEServer-> rollback();12116 mVRDEServer->i_rollback(); 12117 12117 12118 12118 if (mAudioAdapter) … … 12123 12123 12124 12124 if (mBandwidthControl && (mData->flModifications & IsModified_BandwidthControl)) 12125 mBandwidthControl-> rollback();12125 mBandwidthControl->i_rollback(); 12126 12126 12127 12127 if (!mHWData.isNull()) … … 12143 12143 for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); slot++) 12144 12144 if ( mSerialPorts[slot] 12145 && mSerialPorts[slot]->i sModified())12145 && mSerialPorts[slot]->i_isModified()) 12146 12146 { 12147 mSerialPorts[slot]-> rollback();12147 mSerialPorts[slot]->i_rollback(); 12148 12148 serialPorts[slot] = mSerialPorts[slot]; 12149 12149 } … … 12223 12223 12224 12224 mBIOSSettings->commit(); 12225 mVRDEServer-> commit();12225 mVRDEServer->i_commit(); 12226 12226 mAudioAdapter->commit(); 12227 12227 mUSBDeviceFilters->commit(); 12228 mBandwidthControl-> commit();12228 mBandwidthControl->i_commit(); 12229 12229 12230 12230 /* Since mNetworkAdapters is a list which might have been changed (resized) … … 12280 12280 12281 12281 for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); slot++) 12282 mSerialPorts[slot]-> commit();12282 mSerialPorts[slot]->i_commit(); 12283 12283 for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); slot++) 12284 12284 mParallelPorts[slot]->commit(); … … 12298 12298 while (it != mStorageControllers->end()) 12299 12299 { 12300 (*it)-> commit();12300 (*it)->i_commit(); 12301 12301 12302 12302 /* look if this controller has a peer device */ 12303 ComObjPtr<StorageController> peer = (*it)-> getPeer();12303 ComObjPtr<StorageController> peer = (*it)->i_getPeer(); 12304 12304 if (!peer) 12305 12305 { … … 12350 12350 while (it != mStorageControllers->end()) 12351 12351 { 12352 (*it)-> commit();12352 (*it)->i_commit(); 12353 12353 ++it; 12354 12354 } … … 12472 12472 12473 12473 mBIOSSettings->copyFrom(aThat->mBIOSSettings); 12474 mVRDEServer-> copyFrom(aThat->mVRDEServer);12474 mVRDEServer->i_copyFrom(aThat->mVRDEServer); 12475 12475 mAudioAdapter->copyFrom(aThat->mAudioAdapter); 12476 12476 mUSBDeviceFilters->copyFrom(aThat->mUSBDeviceFilters); 12477 mBandwidthControl-> copyFrom(aThat->mBandwidthControl);12477 mBandwidthControl->i_copyFrom(aThat->mBandwidthControl); 12478 12478 12479 12479 /* create private copies of all controllers */ … … 12507 12507 mNetworkAdapters[slot]->copyFrom(aThat->mNetworkAdapters[slot]); 12508 12508 for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); slot++) 12509 mSerialPorts[slot]-> copyFrom(aThat->mSerialPorts[slot]);12509 mSerialPorts[slot]->i_copyFrom(aThat->mSerialPorts[slot]); 12510 12510 for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); slot++) 12511 12511 mParallelPorts[slot]->copyFrom(aThat->mParallelPorts[slot]); -
trunk/src/VBox/Main/src-server/NetworkAdapterImpl.cpp
r49590 r49644 1246 1246 { 1247 1247 ComObjPtr<BandwidthGroup> group; 1248 rc = bwctl-> getBandwidthGroupByName(data.strBandwidthGroup, group, true);1248 rc = bwctl->i_getBandwidthGroupByName(data.strBandwidthGroup, group, true); 1249 1249 if (FAILED(rc)) return rc; 1250 group-> reference();1250 group->i_reference(); 1251 1251 } 1252 1252 … … 1420 1420 #endif // VBOX_WITH_E1000 1421 1421 1422 NetworkAdapterType_T defaultType = aOsType-> networkAdapterType();1422 NetworkAdapterType_T defaultType = aOsType->i_networkAdapterType(); 1423 1423 1424 1424 /* Set default network adapter for this OS type */ … … 1506 1506 Utf8Str strBwGroup; 1507 1507 if (aBwGroup) 1508 strBwGroup = static_cast<BandwidthGroup*>(aBwGroup)-> getName();1508 strBwGroup = static_cast<BandwidthGroup*>(aBwGroup)->i_getName(); 1509 1509 if (mData->mBandwidthGroup != strBwGroup) 1510 1510 { … … 1551 1551 if (!pOldBwGroup.isNull()) 1552 1552 { 1553 pOldBwGroup-> release();1553 pOldBwGroup->i_release(); 1554 1554 mData->mBandwidthGroup = Utf8Str::Empty; 1555 1555 } … … 1557 1557 if (aBwGroup) 1558 1558 { 1559 mData->mBandwidthGroup = aBwGroup-> getName();1560 aBwGroup-> reference();1559 mData->mBandwidthGroup = aBwGroup->i_getName(); 1560 aBwGroup->i_reference(); 1561 1561 } 1562 1562 -
trunk/src/VBox/Main/src-server/SerialPortImpl.cpp
r44528 r49644 5 5 6 6 /* 7 * Copyright (C) 2006-201 1Oracle Corporation7 * Copyright (C) 2006-2013 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 30 30 #include "Logging.h" 31 31 32 ////////////////////////////////////////////////////////////////////////////////33 //34 // SerialPort private data definition35 //36 ////////////////////////////////////////////////////////////////////////////////37 38 struct SerialPort::Data39 {40 Data()41 : fModified(false),42 pMachine(NULL)43 { }44 45 bool fModified;46 47 Machine * const pMachine;48 const ComObjPtr<SerialPort> pPeer;49 50 Backupable<settings::SerialPort> bd;51 };52 53 32 // constructor / destructor 54 33 ///////////////////////////////////////////////////////////////////////////// … … 197 176 ///////////////////////////////////////////////////////////////////////////// 198 177 199 STDMETHODIMP SerialPort::COMGETTER(Enabled) (BOOL *aEnabled) 200 { 201 CheckComArgOutPointerValid(aEnabled); 202 203 AutoCaller autoCaller(this); 204 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 205 178 HRESULT SerialPort::getEnabled(BOOL *aEnabled) 179 { 206 180 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 207 181 … … 211 185 } 212 186 213 STDMETHODIMP SerialPort::COMSETTER(Enabled) (BOOL aEnabled) 187 188 HRESULT SerialPort::setEnabled(BOOL aEnabled) 214 189 { 215 190 LogFlowThisFunc(("aEnabled=%RTbool\n", aEnabled)); 216 217 AutoCaller autoCaller(this);218 if (FAILED(autoCaller.rc())) return autoCaller.rc();219 191 220 192 /* the machine needs to be mutable */ … … 243 215 } 244 216 245 STDMETHODIMP SerialPort::COMGETTER(HostMode) (PortMode_T *aHostMode) 246 { 247 CheckComArgOutPointerValid(aHostMode); 248 249 AutoCaller autoCaller(this); 250 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 251 217 218 HRESULT SerialPort::getHostMode(PortMode_T *aHostMode) 219 { 252 220 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 253 221 … … 257 225 } 258 226 259 STDMETHODIMP SerialPort::COMSETTER(HostMode) (PortMode_T aHostMode) 260 { 261 AutoCaller autoCaller(this); 262 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 263 227 HRESULT SerialPort::setHostMode(PortMode_T aHostMode) 228 { 264 229 /* the machine needs to be mutable */ 265 230 AutoMutableStateDependency adep(m->pMachine); … … 314 279 } 315 280 316 STDMETHODIMP SerialPort::COMGETTER(Slot) (ULONG *aSlot) 317 { 318 CheckComArgOutPointerValid(aSlot); 319 320 AutoCaller autoCaller(this); 321 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 322 281 HRESULT SerialPort::getSlot(ULONG *aSlot) 282 { 323 283 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 324 284 … … 328 288 } 329 289 330 STDMETHODIMP SerialPort::COMGETTER(IRQ) (ULONG *aIRQ) 331 { 332 CheckComArgOutPointerValid(aIRQ); 333 334 AutoCaller autoCaller(this); 335 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 336 290 291 HRESULT SerialPort::getIRQ(ULONG *aIRQ) 292 { 337 293 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 338 294 … … 342 298 } 343 299 344 STDMETHODIMP SerialPort::COMSETTER(IRQ)(ULONG aIRQ) 300 301 HRESULT SerialPort::setIRQ(ULONG aIRQ) 345 302 { 346 303 /* check IRQ limits … … 351 308 m->bd->ulSlot, aIRQ, 255); 352 309 353 AutoCaller autoCaller(this);354 if (FAILED(autoCaller.rc())) return autoCaller.rc();355 356 310 /* the machine needs to be mutable */ 357 311 AutoMutableStateDependency adep(m->pMachine); … … 379 333 } 380 334 381 STDMETHODIMP SerialPort::COMGETTER(IOBase) (ULONG *aIOBase) 382 { 383 CheckComArgOutPointerValid(aIOBase); 384 385 AutoCaller autoCaller(this); 386 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 387 335 336 HRESULT SerialPort::getIOBase(ULONG *aIOBase) 337 { 388 338 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 389 339 … … 393 343 } 394 344 395 STDMETHODIMP SerialPort::COMSETTER(IOBase)(ULONG aIOBase)345 HRESULT SerialPort::setIOBase(ULONG aIOBase) 396 346 { 397 347 /* check IOBase limits … … 432 382 } 433 383 434 STDMETHODIMP SerialPort::COMGETTER(Path) (BSTR *aPath) 435 { 436 CheckComArgOutPointerValid(aPath); 437 438 AutoCaller autoCaller(this); 439 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 440 441 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 442 443 m->bd->strPath.cloneTo(aPath); 444 445 return S_OK; 446 } 447 448 STDMETHODIMP SerialPort::COMSETTER(Path) (IN_BSTR aPath) 449 { 450 AutoCaller autoCaller(this); 451 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 452 384 HRESULT SerialPort::getPath(com::Utf8Str &aPath) 385 { 386 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 387 388 aPath = m->bd->strPath; 389 390 return S_OK; 391 } 392 393 394 HRESULT SerialPort::setPath(const com::Utf8Str &aPath) 395 { 453 396 /* the machine needs to be mutable */ 454 397 AutoMutableStateDependency adep(m->pMachine); … … 457 400 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 458 401 402 com::Utf8Str strPath = aPath; 403 459 404 /* we treat empty as null when e.g. saving to XML, do the same here */ 460 if (aPath && *aPath == '\0') 461 aPath = NULL; 462 463 Utf8Str str(aPath); 464 if (str != m->bd->strPath) 465 { 466 HRESULT rc = checkSetPath(str); 405 if (!strPath.isEmpty()) 406 strPath = ""; 407 408 if (strPath != m->bd->strPath) 409 { 410 HRESULT rc = i_checkSetPath(strPath); 467 411 if (FAILED(rc)) return rc; 468 412 469 413 m->bd.backup(); 470 m->bd->strPath = str ;414 m->bd->strPath = strPath; 471 415 472 416 m->fModified = true; … … 484 428 } 485 429 486 STDMETHODIMP SerialPort::COMGETTER(Server) (BOOL *aServer) 487 { 488 CheckComArgOutPointerValid(aServer); 489 490 AutoCaller autoCaller(this); 491 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 492 430 HRESULT SerialPort::getServer(BOOL *aServer) 431 { 493 432 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 494 433 … … 498 437 } 499 438 500 STDMETHODIMP SerialPort::COMSETTER(Server) (BOOL aServer) 501 { 502 AutoCaller autoCaller(this); 503 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 504 439 HRESULT SerialPort::setServer(BOOL aServer) 440 { 505 441 /* the machine needs to be mutable */ 506 442 AutoMutableStateDependency adep(m->pMachine); … … 539 475 * @note Locks this object for writing. 540 476 */ 541 HRESULT SerialPort::loadSettings(const settings::SerialPort &data) 542 { 477 HRESULT SerialPort::i_loadSettings(const settings::SerialPort &data) 478 { 479 543 480 AutoCaller autoCaller(this); 544 481 AssertComRCReturnRC(autoCaller.rc()); … … 561 498 * @note Locks this object for reading. 562 499 */ 563 HRESULT SerialPort:: saveSettings(settings::SerialPort &data)500 HRESULT SerialPort::i_saveSettings(settings::SerialPort &data) 564 501 { 565 502 AutoCaller autoCaller(this); … … 578 515 * @return 579 516 */ 580 bool SerialPort::i sModified()517 bool SerialPort::i_isModified() 581 518 { 582 519 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 587 524 * @note Locks this object for writing. 588 525 */ 589 void SerialPort:: rollback()526 void SerialPort::i_rollback() 590 527 { 591 528 /* sanity */ … … 602 539 * for writing) if there is one. 603 540 */ 604 void SerialPort:: commit()541 void SerialPort::i_commit() 605 542 { 606 543 /* sanity */ … … 631 568 * represented by @a aThat (locked for reading). 632 569 */ 633 void SerialPort:: copyFrom (SerialPort *aThat)570 void SerialPort::i_copyFrom (SerialPort *aThat) 634 571 { 635 572 AssertReturnVoid (aThat != NULL); … … 652 589 } 653 590 654 void SerialPort:: applyDefaults (GuestOSType *aOsType)591 void SerialPort::i_applyDefaults (GuestOSType *aOsType) 655 592 { 656 593 AssertReturnVoid (aOsType != NULL); … … 688 625 } 689 626 690 uint32_t numSerialEnabled = aOsType-> numSerialEnabled();627 uint32_t numSerialEnabled = aOsType->i_numSerialEnabled(); 691 628 692 629 /* Enable port if requested */ … … 700 637 * Validates COMSETTER(Path) arguments. 701 638 */ 702 HRESULT SerialPort:: checkSetPath(const Utf8Str &str)639 HRESULT SerialPort::i_checkSetPath(const Utf8Str &str) 703 640 { 704 641 AssertReturn(isWriteLockOnCurrentThread(), E_FAIL); -
trunk/src/VBox/Main/src-server/StorageControllerImpl.cpp
r48985 r49644 7 7 8 8 /* 9 * Copyright (C) 2008-201 2Oracle Corporation9 * Copyright (C) 2008-2013 Oracle Corporation 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 37 37 // defines 38 38 ///////////////////////////////////////////////////////////////////////////// 39 // 40 // 41 DEFINE_EMPTY_CTOR_DTOR(StorageController) 39 42 40 43 struct BackupableStorageControllerData … … 93 96 VirtualBox * const pVirtualBox; 94 97 SystemProperties * const pSystemProperties; 95 96 98 Machine * const pParent; 97 99 const ComObjPtr<StorageController> pPeer; … … 99 101 Backupable<BackupableStorageControllerData> bd; 100 102 }; 103 101 104 102 105 // constructor / destructor … … 315 318 316 319 // IStorageController properties 317 ///////////////////////////////////////////////////////////////////////////// 318 STDMETHODIMP StorageController::COMGETTER(Name) (BSTR *aName) 319 { 320 CheckComArgOutPointerValid(aName); 321 322 AutoCaller autoCaller(this); 323 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 320 HRESULT StorageController::getName(com::Utf8Str &aName) 321 { 322 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 324 323 325 324 /* mName is constant during life time, no need to lock */ 326 m->bd.data()->strName.cloneTo(aName);327 328 return S_OK; 329 } 330 331 STDMETHODIMP StorageController::COMGETTER(Bus)(StorageBus_T *aBus)325 aName = m->bd.data()->strName; 326 327 return S_OK; 328 } 329 330 HRESULT StorageController::getBus(StorageBus_T *aBus) 332 331 { 333 332 CheckComArgOutPointerValid(aBus); 334 333 335 AutoCaller autoCaller(this);336 if (FAILED(autoCaller.rc())) return autoCaller.rc();337 338 334 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 339 335 … … 343 339 } 344 340 345 STDMETHODIMP StorageController::COMGETTER(ControllerType)(StorageControllerType_T *aControllerType)341 HRESULT StorageController::getControllerType(StorageControllerType_T *aControllerType) 346 342 { 347 343 CheckComArgOutPointerValid(aControllerType); 348 344 349 AutoCaller autoCaller(this);350 if (FAILED(autoCaller.rc())) return autoCaller.rc();351 352 345 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 353 346 … … 357 350 } 358 351 359 STDMETHODIMP StorageController::COMSETTER(ControllerType) (StorageControllerType_T aControllerType) 360 { 361 AutoCaller autoCaller(this); 362 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 363 352 HRESULT StorageController::setControllerType(StorageControllerType_T aControllerType) 353 { 364 354 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 365 355 … … 421 411 } 422 412 423 STDMETHODIMP StorageController::COMGETTER(MaxDevicesPerPortCount) (ULONG *aMaxDevices) 424 { 425 CheckComArgOutPointerValid(aMaxDevices); 426 427 AutoCaller autoCaller(this); 428 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 429 430 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 431 HRESULT rc = m->pSystemProperties->GetMaxDevicesPerPortForStorageBus(m->bd->mStorageBus, aMaxDevices); 413 HRESULT StorageController::getMaxDevicesPerPortCount(ULONG *aMaxDevicesPerPortCount) 414 { 415 CheckComArgOutPointerValid(aMaxDevicesPerPortCount); 416 417 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 418 419 HRESULT rc = m->pSystemProperties->GetMaxDevicesPerPortForStorageBus(m->bd->mStorageBus, aMaxDevicesPerPortCount); 432 420 433 421 return rc; 434 422 } 435 423 436 STDMETHODIMP StorageController::COMGETTER(MinPortCount)(ULONG *aMinPortCount)424 HRESULT StorageController::getMinPortCount(ULONG *aMinPortCount) 437 425 { 438 426 CheckComArgOutPointerValid(aMinPortCount); 439 427 440 AutoCaller autoCaller(this); 441 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 442 443 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 428 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 429 444 430 HRESULT rc = m->pSystemProperties->GetMinPortCountForStorageBus(m->bd->mStorageBus, aMinPortCount); 445 446 431 return rc; 447 432 } 448 433 449 STDMETHODIMP StorageController::COMGETTER(MaxPortCount)(ULONG *aMaxPortCount)434 HRESULT StorageController::getMaxPortCount(ULONG *aMaxPortCount) 450 435 { 451 436 CheckComArgOutPointerValid(aMaxPortCount); 452 437 453 AutoCaller autoCaller(this);454 if (FAILED(autoCaller.rc())) return autoCaller.rc();455 456 438 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 457 439 HRESULT rc = m->pSystemProperties->GetMaxPortCountForStorageBus(m->bd->mStorageBus, aMaxPortCount); … … 460 442 } 461 443 462 463 STDMETHODIMP StorageController::COMGETTER(PortCount) (ULONG *aPortCount) 444 HRESULT StorageController::getPortCount(ULONG *aPortCount) 464 445 { 465 446 CheckComArgOutPointerValid(aPortCount); 466 447 467 AutoCaller autoCaller(this);468 if (FAILED(autoCaller.rc())) return autoCaller.rc();469 470 448 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 471 449 … … 475 453 } 476 454 477 478 STDMETHODIMP StorageController::COMSETTER(PortCount) (ULONG aPortCount) 455 HRESULT StorageController::setPortCount(ULONG aPortCount) 479 456 { 480 457 LogFlowThisFunc(("aPortCount=%u\n", aPortCount)); … … 576 553 } 577 554 578 STDMETHODIMP StorageController::COMGETTER(Instance) (ULONG *aInstance) 579 { 580 AutoCaller autoCaller(this); 581 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 582 555 HRESULT StorageController::getInstance(ULONG *aInstance) 556 { 583 557 /* The machine doesn't need to be mutable. */ 584 558 … … 590 564 } 591 565 592 STDMETHODIMP StorageController::COMSETTER(Instance) (ULONG aInstance) 593 { 594 AutoCaller autoCaller(this); 595 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 596 566 HRESULT StorageController::setInstance(ULONG aInstance) 567 { 597 568 /* The machine doesn't need to be mutable. */ 598 569 … … 604 575 } 605 576 606 STDMETHODIMP StorageController::COMGETTER(UseHostIOCache) (BOOL *fUseHostIOCache) 607 { 608 AutoCaller autoCaller(this); 609 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 610 577 HRESULT StorageController::getUseHostIOCache(BOOL *fUseHostIOCache) 578 { 611 579 /* The machine doesn't need to be mutable. */ 612 580 … … 618 586 } 619 587 620 STDMETHODIMP StorageController::COMSETTER(UseHostIOCache) (BOOL fUseHostIOCache) 621 { 622 AutoCaller autoCaller(this); 623 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 624 588 HRESULT StorageController::setUseHostIOCache(BOOL fUseHostIOCache) 589 { 625 590 /* the machine needs to be mutable */ 626 591 AutoMutableStateDependency adep(m->pParent); … … 645 610 } 646 611 647 STDMETHODIMP StorageController::COMGETTER(Bootable) (BOOL *fBootable) 648 { 649 AutoCaller autoCaller(this); 650 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 612 HRESULT StorageController::getBootable(BOOL *fBootable) 613 { 651 614 652 615 /* The machine doesn't need to be mutable. */ … … 662 625 ///////////////////////////////////////////////////////////////////////////// 663 626 664 HRESULT StorageController:: getIDEEmulationPort(LONG DevicePosition, LONG *aPortNumber)627 HRESULT StorageController::i_getIDEEmulationPort(LONG DevicePosition, LONG *aPortNumber) 665 628 { 666 629 CheckComArgOutPointerValid(aPortNumber); … … 696 659 } 697 660 698 HRESULT StorageController:: setIDEEmulationPort(LONG DevicePosition, LONG aPortNumber)661 HRESULT StorageController::i_setIDEEmulationPort(LONG DevicePosition, LONG aPortNumber) 699 662 { 700 663 AutoCaller autoCaller(this); … … 736 699 } 737 700 738 const Utf8Str& StorageController:: getName() const701 const Utf8Str& StorageController::i_getName() const 739 702 { 740 703 return m->bd->strName; 741 704 } 742 705 743 StorageControllerType_T StorageController:: getControllerType() const706 StorageControllerType_T StorageController::i_getControllerType() const 744 707 { 745 708 return m->bd->mStorageControllerType; 746 709 } 747 710 748 StorageBus_T StorageController:: getStorageBus() const711 StorageBus_T StorageController::i_getStorageBus() const 749 712 { 750 713 return m->bd->mStorageBus; 751 714 } 752 715 753 ULONG StorageController:: getInstance() const716 ULONG StorageController::i_getInstance() const 754 717 { 755 718 return m->bd->mInstance; 756 719 } 757 720 758 bool StorageController:: getBootable() const721 bool StorageController::i_getBootable() const 759 722 { 760 723 return !!m->bd->fBootable; … … 768 731 * @return 769 732 */ 770 HRESULT StorageController:: checkPortAndDeviceValid(LONG aControllerPort,771 LONG aDevice)733 HRESULT StorageController::i_checkPortAndDeviceValid(LONG aControllerPort, 734 LONG aDevice) 772 735 { 773 736 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 791 754 792 755 /** @note Locks objects for writing! */ 793 void StorageController:: setBootable(BOOL fBootable)756 void StorageController::i_setBootable(BOOL fBootable) 794 757 { 795 758 AutoCaller autoCaller(this); … … 803 766 804 767 /** @note Locks objects for writing! */ 805 void StorageController:: rollback()768 void StorageController::i_rollback() 806 769 { 807 770 AutoCaller autoCaller(this); … … 817 780 * for writing) if there is one. 818 781 */ 819 void StorageController:: commit()782 void StorageController::i_commit() 820 783 { 821 784 /* sanity */ … … 849 812 * represented by @a aThat (locked for reading). 850 813 */ 851 void StorageController:: unshare()814 void StorageController::i_unshare() 852 815 { 853 816 /* sanity */ … … 875 838 } 876 839 877 Machine* StorageController:: getMachine()840 Machine* StorageController::i_getMachine() 878 841 { 879 842 return m->pParent; 880 843 } 881 844 882 ComObjPtr<StorageController> StorageController:: getPeer()845 ComObjPtr<StorageController> StorageController::i_getPeer() 883 846 { 884 847 return m->pPeer; -
trunk/src/VBox/Main/src-server/VFSExplorerImpl.cpp
r49586 r49644 6 6 7 7 /* 8 * Copyright (C) 2009-201 1Oracle Corporation8 * Copyright (C) 2009-2013 Oracle Corporation 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 37 37 #include <memory> 38 38 39 ////////////////////////////////////////////////////////////////////////////////40 //41 // VFSExplorer definitions42 //43 ////////////////////////////////////////////////////////////////////////////////44 45 /* opaque private instance data of VFSExplorer class */46 struct VFSExplorer::Data47 {48 struct DirEntry49 {50 DirEntry(Utf8Str strName, VFSFileType_T fileType, uint64_t cbSize, uint32_t fMode)51 : name(strName)52 , type(fileType)53 , size(cbSize)54 , mode(fMode) {}55 56 Utf8Str name;57 VFSFileType_T type;58 uint64_t size;59 uint32_t mode;60 };61 62 VFSType_T storageType;63 Utf8Str strUsername;64 Utf8Str strPassword;65 Utf8Str strHostname;66 Utf8Str strPath;67 Utf8Str strBucket;68 69 std::list<DirEntry> entryList;70 };71 72 39 VFSExplorer::VFSExplorer() 73 40 : mVirtualBox(NULL) … … 134 101 * @return 135 102 */ 136 STDMETHODIMP VFSExplorer::COMGETTER(Path)(BSTR *aPath) 137 { 138 if (!aPath) 139 return E_POINTER; 140 141 AutoCaller autoCaller(this); 142 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 143 103 HRESULT VFSExplorer::getPath(com::Utf8Str &aPath) 104 { 144 105 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 145 106 146 Bstr bstrPath(m->strPath); 147 bstrPath.cloneTo(aPath); 107 aPath = m->strPath; 148 108 149 109 return S_OK; 150 110 } 151 111 152 STDMETHODIMP VFSExplorer::COMGETTER(Type)(VFSType_T *aType) 112 113 HRESULT VFSExplorer::getType(VFSType_T *aType) 153 114 { 154 115 if (!aType) 155 116 return E_POINTER; 156 157 AutoCaller autoCaller(this);158 if (FAILED(autoCaller.rc())) return autoCaller.rc();159 117 160 118 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 224 182 { 225 183 if (pVFSExplorer->m->storageType == VFSType_File) 226 rc = pVFSExplorer-> updateFS(task.get());184 rc = pVFSExplorer->i_updateFS(task.get()); 227 185 else if (pVFSExplorer->m->storageType == VFSType_S3) 228 186 #ifdef VBOX_WITH_S3 229 rc = pVFSExplorer-> updateS3(task.get());187 rc = pVFSExplorer->i_updateS3(task.get()); 230 188 #else 231 189 rc = VERR_NOT_IMPLEMENTED; … … 236 194 { 237 195 if (pVFSExplorer->m->storageType == VFSType_File) 238 rc = pVFSExplorer-> deleteFS(task.get());196 rc = pVFSExplorer->i_deleteFS(task.get()); 239 197 else if (pVFSExplorer->m->storageType == VFSType_S3) 240 198 #ifdef VBOX_WITH_S3 241 rc = pVFSExplorer-> deleteS3(task.get());199 rc = pVFSExplorer->i_deleteS3(task.get()); 242 200 #else 243 201 rc = VERR_NOT_IMPLEMENTED; … … 273 231 } 274 232 275 VFSFileType_T VFSExplorer:: RTToVFSFileType(int aType) const233 VFSFileType_T VFSExplorer::i_RTToVFSFileType(int aType) const 276 234 { 277 235 int a = aType & RTFS_TYPE_MASK; … … 297 255 } 298 256 299 HRESULT VFSExplorer:: updateFS(TaskVFSExplorer *aTask)257 HRESULT VFSExplorer::i_updateFS(TaskVFSExplorer *aTask) 300 258 { 301 259 LogFlowFuncEnter(); … … 328 286 if ( name != "." 329 287 && name != "..") 330 fileList.push_back(VFSExplorer::Data::DirEntry(name, RTToVFSFileType(entry.Info.Attr.fMode), entry.Info.cbObject, entry.Info.Attr.fMode & (RTFS_UNIX_IRWXU | RTFS_UNIX_IRWXG | RTFS_UNIX_IRWXO)));288 fileList.push_back(VFSExplorer::Data::DirEntry(name, i_RTToVFSFileType(entry.Info.Attr.fMode), entry.Info.cbObject, entry.Info.Attr.fMode & (RTFS_UNIX_IRWXU | RTFS_UNIX_IRWXG | RTFS_UNIX_IRWXO))); 331 289 } 332 290 } … … 363 321 } 364 322 365 HRESULT VFSExplorer:: deleteFS(TaskVFSExplorer *aTask)323 HRESULT VFSExplorer::i_deleteFS(TaskVFSExplorer *aTask) 366 324 { 367 325 LogFlowFuncEnter(); … … 411 369 412 370 #ifdef VBOX_WITH_S3 413 HRESULT VFSExplorer:: updateS3(TaskVFSExplorer *aTask)371 HRESULT VFSExplorer::i_updateS3(TaskVFSExplorer *aTask) 414 372 { 415 373 LogFlowFuncEnter(); … … 490 448 } 491 449 492 HRESULT VFSExplorer:: deleteS3(TaskVFSExplorer *aTask)450 HRESULT VFSExplorer::i_deleteS3(TaskVFSExplorer *aTask) 493 451 { 494 452 LogFlowFuncEnter(); … … 545 503 #endif /* VBOX_WITH_S3 */ 546 504 547 STDMETHODIMP VFSExplorer::Update(IProgress **aProgress) 548 { 549 CheckComArgOutPointerValid(aProgress); 550 551 AutoCaller autoCaller(this); 552 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 553 505 HRESULT VFSExplorer::update(ComPtr<IProgress> &aProgress) 506 { 554 507 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 555 508 … … 584 537 } 585 538 586 if (SUCCEEDED(rc))539 if (SUCCEEDED(rc)) 587 540 /* Return progress to the caller */ 588 progress.queryInterfaceTo(aProgress );541 progress.queryInterfaceTo(aProgress.asOutParam()); 589 542 590 543 return rc; 591 544 } 592 545 593 STDMETHODIMP VFSExplorer::Cd(IN_BSTR aDir, IProgress **aProgress) 594 { 595 CheckComArgStrNotEmptyOrNull(aDir); 596 597 AutoCaller autoCaller(this); 598 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 599 600 { 601 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 602 m->strPath = aDir; 603 } 604 605 return Update(aProgress); 606 } 607 608 STDMETHODIMP VFSExplorer::CdUp(IProgress **aProgress) 609 { 610 AutoCaller autoCaller(this); 611 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 612 546 HRESULT VFSExplorer::cd(const com::Utf8Str &aDir, ComPtr<IProgress> &aProgress) 547 { 548 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 549 m->strPath = aDir; 550 return update(aProgress); 551 } 552 553 HRESULT VFSExplorer::cdUp(ComPtr<IProgress> &aProgress) 554 { 613 555 Utf8Str strUpPath; 614 556 { … … 622 564 } 623 565 624 return Cd(Bstr(strUpPath).raw(), aProgress); 625 } 626 627 STDMETHODIMP VFSExplorer::EntryList(ComSafeArrayOut(BSTR, aNames), ComSafeArrayOut(VFSFileType_T, aTypes), ComSafeArrayOut(LONG64, aSizes), ComSafeArrayOut(ULONG, aModes)) 628 { 629 if (ComSafeArrayOutIsNull(aNames) || 630 ComSafeArrayOutIsNull(aTypes)) 631 return E_POINTER; 632 633 AutoCaller autoCaller(this); 634 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 635 566 return cd(strUpPath, aProgress); 567 } 568 569 HRESULT VFSExplorer::entryList(std::vector<com::Utf8Str> &aNames, 570 std::vector<ULONG> &aTypes, 571 std::vector<LONG64> &aSizes, 572 std::vector<ULONG> &aModes) 573 { 636 574 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 637 638 com::SafeArray<BSTR> sfaNames(m->entryList.size()); 639 com::SafeArray<ULONG> sfaTypes(m->entryList.size()); 640 com::SafeArray<LONG64> sfaSizes(m->entryList.size()); 641 com::SafeArray<ULONG> sfaModes(m->entryList.size()); 575 aNames.resize(m->entryList.size()); 576 aTypes.resize(m->entryList.size()); 577 aSizes.resize(m->entryList.size()); 578 aModes.resize(m->entryList.size()); 642 579 643 580 std::list<VFSExplorer::Data::DirEntry>::const_iterator it; … … 648 585 { 649 586 const VFSExplorer::Data::DirEntry &entry = (*it); 650 Bstr bstr(entry.name); 651 bstr.cloneTo(&sfaNames[i]); 652 sfaTypes[i] = entry.type; 653 sfaSizes[i] = entry.size; 654 sfaModes[i] = entry.mode; 655 } 656 657 sfaNames.detachTo(ComSafeArrayOutArg(aNames)); 658 sfaTypes.detachTo(ComSafeArrayOutArg(aTypes)); 659 sfaSizes.detachTo(ComSafeArrayOutArg(aSizes)); 660 sfaModes.detachTo(ComSafeArrayOutArg(aModes)); 587 aNames[i] = entry.name; 588 aTypes[i] = entry.type; 589 aSizes[i] = entry.type; 590 aModes[i] = entry.mode; 591 } 661 592 662 593 return S_OK; 663 594 } 664 595 665 STDMETHODIMP VFSExplorer::Exists(ComSafeArrayIn(IN_BSTR, aNames), ComSafeArrayOut(BSTR, aExists)) 666 { 667 CheckComArgSafeArrayNotNull(aNames); 596 HRESULT VFSExplorer::exists(const std::vector<com::Utf8Str> &aNames, 597 std::vector<com::Utf8Str> &aExists) 598 { 668 599 669 600 AutoCaller autoCaller(this); … … 671 602 672 603 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 673 674 com::SafeArray<IN_BSTR> sfaNames(ComSafeArrayInArg(aNames)); 675 std::list<BSTR> listExists; 676 677 for (size_t a=0; a < sfaNames.size(); ++a) 604 aExists.resize(0); 605 for (size_t i=0; i < aNames.size(); ++i) 678 606 { 679 607 std::list<VFSExplorer::Data::DirEntry>::const_iterator it; … … 683 611 { 684 612 const VFSExplorer::Data::DirEntry &entry = (*it); 685 if (entry.name == RTPathFilename(Utf8Str(sfaNames[a]).c_str())) 686 { 687 BSTR name; 688 Bstr tmp(sfaNames[a]); /* gcc-3.3 cruft */ 689 tmp.cloneTo(&name); 690 listExists.push_back(name); 691 } 692 } 693 } 694 695 com::SafeArray<BSTR> sfaExists(listExists); 696 sfaExists.detachTo(ComSafeArrayOutArg(aExists)); 613 if (entry.name == RTPathFilename(aNames[i].c_str())) 614 aExists.push_back(aNames[i]); 615 } 616 } 697 617 698 618 return S_OK; 699 619 } 700 620 701 STDMETHODIMP VFSExplorer::Remove(ComSafeArrayIn(IN_BSTR, aNames), IProgress **aProgress) 702 { 703 CheckComArgSafeArrayNotNull(aNames); 704 CheckComArgOutPointerValid(aProgress); 705 621 HRESULT VFSExplorer::remove(const std::vector<com::Utf8Str> &aNames, 622 ComPtr<IProgress> &aProgress) 623 { 706 624 AutoCaller autoCaller(this); 707 625 if (FAILED(autoCaller.rc())) return autoCaller.rc(); … … 710 628 711 629 HRESULT rc = S_OK; 712 713 com::SafeArray<IN_BSTR> sfaNames(ComSafeArrayInArg(aNames));714 630 715 631 ComObjPtr<Progress> progress; … … 728 644 729 645 /* Add all filenames to delete as task data */ 730 for (size_t a=0; a < sfaNames.size(); ++a)731 task->filenames.push_back( Utf8Str(sfaNames[a]));646 for (size_t i = 0; i < aNames.size(); ++i) 647 task->filenames.push_back(aNames[i]); 732 648 733 649 rc = task->startThread(); … … 744 660 if (SUCCEEDED(rc)) 745 661 /* Return progress to the caller */ 746 progress.queryInterfaceTo(aProgress );662 progress.queryInterfaceTo(aProgress.asOutParam()); 747 663 748 664 return rc; -
trunk/src/VBox/Main/src-server/VRDEServerImpl.cpp
r46820 r49644 197 197 * @note Locks this object for writing. 198 198 */ 199 HRESULT VRDEServer:: loadSettings(const settings::VRDESettings &data)199 HRESULT VRDEServer::i_loadSettings(const settings::VRDESettings &data) 200 200 { 201 201 using namespace settings; … … 205 205 206 206 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 207 208 207 mData->mEnabled = data.fEnabled; 209 208 mData->mAuthType = data.authType; … … 225 224 * @note Locks this object for reading. 226 225 */ 227 HRESULT VRDEServer:: saveSettings(settings::VRDESettings &data)226 HRESULT VRDEServer::i_saveSettings(settings::VRDESettings &data) 228 227 { 229 228 AutoCaller autoCaller(this); … … 247 246 ///////////////////////////////////////////////////////////////////////////// 248 247 249 STDMETHODIMP VRDEServer::COMGETTER(Enabled)(BOOL *aEnabled) 250 { 251 CheckComArgOutPointerValid(aEnabled); 252 253 AutoCaller autoCaller(this); 254 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 248 HRESULT VRDEServer::getEnabled(BOOL *aEnabled) 249 { 250 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 255 251 256 252 *aEnabled = mData->mEnabled; … … 259 255 } 260 256 261 STDMETHODIMP VRDEServer::COMSETTER(Enabled)(BOOL aEnabled) 262 { 263 AutoCaller autoCaller(this); 264 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 265 257 HRESULT VRDEServer::setEnabled(BOOL aEnabled) 258 { 266 259 /* the machine can also be in saved state for this property to change */ 267 260 AutoMutableOrSavedStateDependency adep(mParent); … … 293 286 } 294 287 295 static int portParseNumber(uint16_t *pu16Port, const char *pszStart, const char *pszEnd)288 static int i_portParseNumber(uint16_t *pu16Port, const char *pszStart, const char *pszEnd) 296 289 { 297 290 /* Gets a string of digits, converts to 16 bit port number. … … 321 314 } 322 315 323 static int vrdpServerVerifyPortsString(Bstr ports) 324 { 325 com::Utf8Str portRange = ports; 326 316 static int i_vrdpServerVerifyPortsString(com::Utf8Str portRange) 317 { 327 318 const char *pszPortRange = portRange.c_str(); 328 319 … … 363 354 if (pszDash) 364 355 { 365 rc = portParseNumber(NULL, pszStart, pszDash);356 rc = i_portParseNumber(NULL, pszStart, pszDash); 366 357 if (RT_SUCCESS(rc)) 367 rc = portParseNumber(NULL, pszDash + 1, pszEnd);358 rc = i_portParseNumber(NULL, pszDash + 1, pszEnd); 368 359 } 369 360 else 370 rc = portParseNumber(NULL, pszStart, pszEnd);361 rc = i_portParseNumber(NULL, pszStart, pszEnd); 371 362 372 363 if (RT_FAILURE(rc)) … … 377 368 } 378 369 379 STDMETHODIMP VRDEServer::SetVRDEProperty(IN_BSTR aKey, IN_BSTRaValue)370 HRESULT VRDEServer::setVRDEProperty(const com::Utf8Str &aKey, const com::Utf8Str &aValue) 380 371 { 381 372 LogFlowThisFunc(("\n")); 382 383 AutoCaller autoCaller(this);384 if (FAILED(autoCaller.rc())) return autoCaller.rc();385 373 386 374 /* the machine can also be in saved state for this property to change */ … … 395 383 if (key == Bstr("TCP/Ports")) 396 384 { 397 Bstr ports = aValue;398 399 385 /* Verify the string. */ 400 int vrc = vrdpServerVerifyPortsString(ports);386 int vrc = i_vrdpServerVerifyPortsString(aValue); 401 387 if (RT_FAILURE(vrc)) 402 388 return E_INVALIDARG; 403 389 404 if ( ports!= mData->mProperties["TCP/Ports"])390 if (aValue != mData->mProperties["TCP/Ports"]) 405 391 { 406 392 /* Port value is not verified here because it is up to VRDP transport to … … 409 395 */ 410 396 mData.backup(); 411 if ( ports == Bstr("0"))397 if (aValue == Utf8Str("0")) 412 398 mData->mProperties["TCP/Ports"] = VRDP_DEFAULT_PORT_STR; 413 399 else 414 mData->mProperties["TCP/Ports"] = ports;400 mData->mProperties["TCP/Ports"] = aValue; 415 401 416 402 /* leave the lock before informing callbacks */ … … 432 418 * Look up the old value first; if nothing's changed then do nothing. 433 419 */ 434 Utf8Str strValue(aValue);435 Utf8Str strKey(aKey);436 420 Utf8Str strOldValue; 437 421 438 settings::StringsMap::const_iterator it = mData->mProperties.find( strKey);422 settings::StringsMap::const_iterator it = mData->mProperties.find(aKey); 439 423 if (it != mData->mProperties.end()) 440 424 strOldValue = it->second; 441 425 442 if (strOldValue != strValue)443 { 444 if ( strValue.isEmpty())445 mData->mProperties.erase( strKey);426 if (strOldValue != aValue) 427 { 428 if (aValue.isEmpty()) 429 mData->mProperties.erase(aKey); 446 430 else 447 mData->mProperties[ strKey] = strValue;431 mData->mProperties[aKey] = aValue; 448 432 449 433 /* leave the lock before informing callbacks */ … … 464 448 } 465 449 466 STDMETHODIMP VRDEServer::GetVRDEProperty(IN_BSTR aKey, BSTR *aValue) 467 { 468 CheckComArgOutPointerValid(aValue); 469 470 AutoCaller autoCaller(this); 471 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 472 473 Bstr key = aKey; 474 Bstr value; 475 450 HRESULT VRDEServer::getVRDEProperty(const com::Utf8Str &aKey, com::Utf8Str &aValue) 451 { 476 452 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 477 478 Utf8Str strKey(key); 479 settings::StringsMap::const_iterator it = mData->mProperties.find(strKey); 453 settings::StringsMap::const_iterator it = mData->mProperties.find(aKey); 480 454 if (it != mData->mProperties.end()) 481 value = it->second; // source is a Utf8Str 482 else if (strKey == "TCP/Ports") 483 value = VRDP_DEFAULT_PORT_STR; 484 value.cloneTo(aValue); 455 aValue = it->second; // source is a Utf8Str 456 else if (aKey == "TCP/Ports") 457 aValue = VRDP_DEFAULT_PORT_STR; 485 458 486 459 return S_OK; … … 532 505 } 533 506 534 STDMETHODIMP VRDEServer::COMGETTER(VRDEProperties)(ComSafeArrayOut(BSTR, aProperties)) 535 { 536 if (ComSafeArrayOutIsNull(aProperties)) 537 return E_POINTER; 538 539 AutoCaller autoCaller(this); 540 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 541 507 HRESULT VRDEServer::getVRDEProperties(std::vector<com::Utf8Str> &aProperties) 508 { 542 509 size_t cProperties = 0; 543 510 aProperties.resize(0); 544 511 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 545 512 if (!mData->mEnabled) 546 513 { 547 com::SafeArray<BSTR> properties(cProperties); 548 properties.detachTo(ComSafeArrayOutArg(aProperties)); 514 aProperties.resize(cProperties); 549 515 return S_OK; 550 516 } … … 603 569 Log(("VRDEPROP: %d properties\n", cProperties)); 604 570 605 com::SafeArray<BSTR> properties(cProperties);606 607 571 if (cProperties > 0) 608 572 { 609 size_t i;610 for ( i = 0; papszNames[i] != NULL && i < cProperties; ++i)573 aProperties.resize(cProperties); 574 for (size_t i = 0; papszNames[i] != NULL && i < cProperties; ++i) 611 575 { 612 Bstr tmp(papszNames[i]); 613 tmp.cloneTo(&properties[i]); 576 aProperties[i] = papszNames[i]; 614 577 } 615 578 } … … 618 581 RTLdrClose(hmod); 619 582 hmod = NIL_RTLDRMOD; 620 621 properties.detachTo(ComSafeArrayOutArg(aProperties));622 583 } 623 584 } … … 631 592 } 632 593 633 STDMETHODIMP VRDEServer::COMGETTER(AuthType)(AuthType_T *aType) 634 { 635 CheckComArgOutPointerValid(aType); 636 637 AutoCaller autoCaller(this); 638 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 639 594 595 HRESULT VRDEServer::getAuthType(AuthType_T *aType) 596 { 640 597 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 641 598 … … 645 602 } 646 603 647 STDMETHODIMP VRDEServer::COMSETTER(AuthType)(AuthType_T aType) 648 { 649 AutoCaller autoCaller(this); 650 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 651 604 HRESULT VRDEServer::setAuthType(AuthType_T aType) 605 { 652 606 /* the machine can also be in saved state for this property to change */ 653 607 AutoMutableOrSavedStateDependency adep(mParent); … … 674 628 } 675 629 676 STDMETHODIMP VRDEServer::COMGETTER(AuthTimeout)(ULONG *aTimeout) 677 { 678 CheckComArgOutPointerValid(aTimeout); 679 680 AutoCaller autoCaller(this); 681 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 682 630 HRESULT VRDEServer::getAuthTimeout(ULONG *aTimeout) 631 { 683 632 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 684 633 … … 688 637 } 689 638 690 STDMETHODIMP VRDEServer::COMSETTER(AuthTimeout)(ULONG aTimeout) 691 { 692 AutoCaller autoCaller(this); 693 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 694 639 640 HRESULT VRDEServer::setAuthTimeout(ULONG aTimeout) 641 { 695 642 /* the machine can also be in saved state for this property to change */ 696 643 AutoMutableOrSavedStateDependency adep(mParent); … … 721 668 } 722 669 723 STDMETHODIMP VRDEServer::COMGETTER(AuthLibrary)(BSTR *aLibrary) 724 { 725 CheckComArgOutPointerValid(aLibrary); 726 727 AutoCaller autoCaller(this); 728 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 729 730 Bstr bstrLibrary; 731 670 HRESULT VRDEServer::getAuthLibrary(com::Utf8Str &aLibrary) 671 { 732 672 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 733 bstrLibrary = mData->mAuthLibrary;673 aLibrary = mData->mAuthLibrary; 734 674 alock.release(); 735 675 736 if ( bstrLibrary.isEmpty())676 if (aLibrary.isEmpty()) 737 677 { 738 678 /* Get the global setting. */ 739 679 ComPtr<ISystemProperties> systemProperties; 740 680 HRESULT hrc = mParent->getVirtualBox()->COMGETTER(SystemProperties)(systemProperties.asOutParam()); 741 681 Bstr strlib; 742 682 if (SUCCEEDED(hrc)) 743 hrc = systemProperties->COMGETTER(VRDEAuthLibrary)(bstrLibrary.asOutParam()); 683 { 684 hrc = systemProperties->COMGETTER(VRDEAuthLibrary)(strlib.asOutParam()); 685 aLibrary = Utf8Str(strlib).c_str(); 686 } 744 687 745 688 if (FAILED(hrc)) … … 747 690 } 748 691 749 bstrLibrary.cloneTo(aLibrary); 750 751 return S_OK; 752 } 753 754 STDMETHODIMP VRDEServer::COMSETTER(AuthLibrary)(IN_BSTR aLibrary) 755 { 756 AutoCaller autoCaller(this); 757 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 758 692 return S_OK; 693 } 694 695 696 HRESULT VRDEServer::setAuthLibrary(const com::Utf8Str &aLibrary) 697 { 759 698 /* the machine can also be in saved state for this property to change */ 760 699 AutoMutableOrSavedStateDependency adep(mParent); 761 700 if (FAILED(adep.rc())) return adep.rc(); 762 701 763 Bstr bstrLibrary(aLibrary);764 765 702 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 766 703 767 if (mData->mAuthLibrary != bstrLibrary)704 if (mData->mAuthLibrary != aLibrary) 768 705 { 769 706 mData.backup(); 770 mData->mAuthLibrary = bstrLibrary;707 mData->mAuthLibrary = aLibrary; 771 708 772 709 /* leave the lock before informing callbacks */ … … 783 720 } 784 721 785 STDMETHODIMP VRDEServer::COMGETTER(AllowMultiConnection)(BOOL *aAllowMultiConnection) 786 { 787 CheckComArgOutPointerValid(aAllowMultiConnection); 788 789 AutoCaller autoCaller(this); 790 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 791 722 723 HRESULT VRDEServer::getAllowMultiConnection(BOOL *aAllowMultiConnection) 724 { 792 725 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 793 726 … … 797 730 } 798 731 799 STDMETHODIMP VRDEServer::COMSETTER(AllowMultiConnection)(BOOL aAllowMultiConnection) 800 { 801 AutoCaller autoCaller(this); 802 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 803 732 733 HRESULT VRDEServer::setAllowMultiConnection(BOOL aAllowMultiConnection) 734 { 804 735 /* the machine can also be in saved state for this property to change */ 805 736 AutoMutableOrSavedStateDependency adep(mParent); … … 826 757 } 827 758 828 STDMETHODIMP VRDEServer::COMGETTER(ReuseSingleConnection)(BOOL *aReuseSingleConnection) 829 { 830 CheckComArgOutPointerValid(aReuseSingleConnection); 831 832 AutoCaller autoCaller(this); 833 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 834 759 HRESULT VRDEServer::getReuseSingleConnection(BOOL *aReuseSingleConnection) 760 { 835 761 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 836 762 … … 840 766 } 841 767 842 STDMETHODIMP VRDEServer::COMSETTER(ReuseSingleConnection)(BOOL aReuseSingleConnection) 843 { 844 AutoCaller autoCaller(this); 845 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 846 847 /* the machine can also be in saved state for this property to change */ 768 769 HRESULT VRDEServer::setReuseSingleConnection(BOOL aReuseSingleConnection) 770 { 848 771 AutoMutableOrSavedStateDependency adep(mParent); 849 772 if (FAILED(adep.rc())) return adep.rc(); … … 869 792 } 870 793 871 STDMETHODIMP VRDEServer::COMGETTER(VRDEExtPack)(BSTR *aExtPack) 872 { 873 CheckComArgOutPointerValid(aExtPack); 874 875 AutoCaller autoCaller(this); 876 HRESULT hrc = autoCaller.rc(); 794 HRESULT VRDEServer::getVRDEExtPack(com::Utf8Str &aExtPack) 795 { 796 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 797 Utf8Str strExtPack = mData->mVrdeExtPack; 798 alock.release(); 799 HRESULT hrc = S_OK; 800 801 if (strExtPack.isNotEmpty()) 802 { 803 if (strExtPack.equals(VBOXVRDP_KLUDGE_EXTPACK_NAME)) 804 hrc = S_OK; 805 else 806 { 807 #ifdef VBOX_WITH_EXTPACK 808 ExtPackManager *pExtPackMgr = mParent->getVirtualBox()->getExtPackManager(); 809 hrc = pExtPackMgr->checkVrdeExtPack(&strExtPack); 810 #else 811 hrc = setError(E_FAIL, tr("Extension pack '%s' does not exist"), strExtPack.c_str()); 812 #endif 813 } 814 if (SUCCEEDED(hrc)) 815 aExtPack = strExtPack; 816 } 817 else 818 { 819 /* Get the global setting. */ 820 BSTR bstr; 821 ComPtr<ISystemProperties> systemProperties; 822 hrc = mParent->getVirtualBox()->COMGETTER(SystemProperties)(systemProperties.asOutParam()); 823 if (SUCCEEDED(hrc)) 824 hrc = systemProperties->COMGETTER(DefaultVRDEExtPack)(&bstr); 825 aExtPack = Utf8Str(bstr); 826 } 827 return hrc; 828 } 829 830 // public methods only for internal purposes 831 ///////////////////////////////////////////////////////////////////////////// 832 HRESULT VRDEServer::setVRDEExtPack(const com::Utf8Str &aExtPack) 833 { 834 HRESULT hrc = S_OK; 835 /* the machine can also be in saved state for this property to change */ 836 AutoMutableOrSavedStateDependency adep(mParent); 837 hrc = adep.rc(); 877 838 if (SUCCEEDED(hrc)) 878 839 { 879 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 880 Utf8Str strExtPack = mData->mVrdeExtPack; 881 alock.release(); 882 883 if (strExtPack.isNotEmpty()) 884 { 885 if (strExtPack.equals(VBOXVRDP_KLUDGE_EXTPACK_NAME)) 840 /* 841 * If not empty, check the specific extension pack. 842 */ 843 if (!aExtPack.isEmpty()) 844 { 845 if (aExtPack.equals(VBOXVRDP_KLUDGE_EXTPACK_NAME)) 886 846 hrc = S_OK; 887 847 else … … 889 849 #ifdef VBOX_WITH_EXTPACK 890 850 ExtPackManager *pExtPackMgr = mParent->getVirtualBox()->getExtPackManager(); 891 hrc = pExtPackMgr->checkVrdeExtPack(& strExtPack);851 hrc = pExtPackMgr->checkVrdeExtPack(&aExtPack); 892 852 #else 893 hrc = setError(E_FAIL, tr("Extension pack '%s' does not exist"), strExtPack.c_str());853 hrc = setError(E_FAIL, tr("Extension pack '%s' does not exist"), aExtPack.c_str()); 894 854 #endif 895 855 } 896 if (SUCCEEDED(hrc)) 897 strExtPack.cloneTo(aExtPack); 898 } 899 else 900 { 901 /* Get the global setting. */ 902 ComPtr<ISystemProperties> systemProperties; 903 hrc = mParent->getVirtualBox()->COMGETTER(SystemProperties)(systemProperties.asOutParam()); 904 if (SUCCEEDED(hrc)) 905 hrc = systemProperties->COMGETTER(DefaultVRDEExtPack)(aExtPack); 906 } 907 } 908 909 return hrc; 910 } 911 912 STDMETHODIMP VRDEServer::COMSETTER(VRDEExtPack)(IN_BSTR aExtPack) 913 { 914 CheckComArgNotNull(aExtPack); 915 Utf8Str strExtPack(aExtPack); 916 917 AutoCaller autoCaller(this); 918 HRESULT hrc = autoCaller.rc(); 919 if (SUCCEEDED(hrc)) 920 { 921 /* the machine can also be in saved state for this property to change */ 922 AutoMutableOrSavedStateDependency adep(mParent); 923 hrc = adep.rc(); 856 } 924 857 if (SUCCEEDED(hrc)) 925 858 { 926 859 /* 927 * If not empty, check the specific extension pack. 860 * Update the setting if there is an actual change, post an 861 * change event to trigger a VRDE server restart. 928 862 */ 929 if (!strExtPack.isEmpty()) 930 { 931 if (strExtPack.equals(VBOXVRDP_KLUDGE_EXTPACK_NAME)) 932 hrc = S_OK; 933 else 934 { 935 #ifdef VBOX_WITH_EXTPACK 936 ExtPackManager *pExtPackMgr = mParent->getVirtualBox()->getExtPackManager(); 937 hrc = pExtPackMgr->checkVrdeExtPack(&strExtPack); 938 #else 939 hrc = setError(E_FAIL, tr("Extension pack '%s' does not exist"), strExtPack.c_str()); 940 #endif 941 } 942 } 943 if (SUCCEEDED(hrc)) 944 { 945 /* 946 * Update the setting if there is an actual change, post an 947 * change event to trigger a VRDE server restart. 948 */ 949 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 950 if (strExtPack != mData->mVrdeExtPack) 951 { 952 mData.backup(); 953 mData->mVrdeExtPack = strExtPack; 954 955 /* leave the lock before informing callbacks */ 956 alock.release(); 957 958 AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS); 959 mParent->setModified(Machine::IsModified_VRDEServer); 960 mlock.release(); 961 962 mParent->onVRDEServerChange(/* aRestart */ TRUE); 963 } 863 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 864 if (aExtPack != mData->mVrdeExtPack) 865 { 866 mData.backup(); 867 mData->mVrdeExtPack = aExtPack; 868 869 /* leave the lock before informing callbacks */ 870 alock.release(); 871 872 AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS); 873 mParent->setModified(Machine::IsModified_VRDEServer); 874 mlock.release(); 875 876 mParent->onVRDEServerChange(/* aRestart */ TRUE); 964 877 } 965 878 } … … 975 888 * @note Locks this object for writing. 976 889 */ 977 void VRDEServer:: rollback()890 void VRDEServer::i_rollback() 978 891 { 979 892 /* sanity */ … … 990 903 * for writing) if there is one. 991 904 */ 992 void VRDEServer:: commit()905 void VRDEServer::i_commit() 993 906 { 994 907 /* sanity */ … … 1019 932 * represented by @a aThat (locked for reading). 1020 933 */ 1021 void VRDEServer:: copyFrom(VRDEServer *aThat)934 void VRDEServer::i_copyFrom(VRDEServer *aThat) 1022 935 { 1023 936 AssertReturnVoid(aThat != NULL); -
trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp
r49517 r49644 2049 2049 ++it) 2050 2050 { 2051 const Bstr &typeId = (*it)->i d();2051 const Bstr &typeId = (*it)->i_id(); 2052 2052 AssertMsg(!typeId.isEmpty(), ("ID must not be NULL")); 2053 2053 if (typeId.compare(aId, Bstr::CaseInsensitive) == 0) … … 3719 3719 ++it) 3720 3720 { 3721 if ((*it)->i d() == bstrOSType)3721 if ((*it)->i_id() == bstrOSType) 3722 3722 { 3723 3723 pGuestOSType = *it; … … 4239 4239 { 4240 4240 settings::DHCPServer d; 4241 rc = (*it)-> saveSettings(d);4241 rc = (*it)->i_saveSettings(d); 4242 4242 if (FAILED(rc)) throw rc; 4243 4243 m->pMainConfigFile->llDhcpServers.push_back(d); -
trunk/src/VBox/Main/src-server/xpcom/server.cpp
r49517 r49644 104 104 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Machine, IMachine) 105 105 106 NS_DECL_CLASSINFO(VFSExplorer)107 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(VFSExplorer, IVFSExplorer)108 109 106 NS_DECL_CLASSINFO(Appliance) 110 107 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Appliance, IAppliance) … … 137 134 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(SharedFolder, ISharedFolder) 138 135 139 NS_DECL_CLASSINFO(VRDEServer)140 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(VRDEServer, IVRDEServer)141 142 136 NS_DECL_CLASSINFO(Host) 143 137 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Host, IHost) … … 146 140 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(HostNetworkInterface, IHostNetworkInterface) 147 141 148 NS_DECL_CLASSINFO(DHCPServer)149 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(DHCPServer, IDHCPServer)150 151 142 NS_DECL_CLASSINFO(NATNetwork) 152 143 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(NATNetwork, INATNetwork) 153 144 154 NS_DECL_CLASSINFO(GuestOSType)155 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(GuestOSType, IGuestOSType)156 157 145 NS_DECL_CLASSINFO(NetworkAdapter) 158 146 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(NetworkAdapter, INetworkAdapter) … … 161 149 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(NATEngine, INATEngine) 162 150 163 164 NS_DECL_CLASSINFO(SerialPort)165 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(SerialPort, ISerialPort)166 167 151 NS_DECL_CLASSINFO(ParallelPort) 168 152 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(ParallelPort, IParallelPort) … … 173 157 NS_DECL_CLASSINFO(USBDeviceFilters) 174 158 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(USBDeviceFilters, IUSBDeviceFilters) 175 176 NS_DECL_CLASSINFO(StorageController)177 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(StorageController, IStorageController)178 159 179 160 #ifdef VBOX_WITH_USB … … 215 196 #endif 216 197 217 NS_DECL_CLASSINFO(BandwidthGroup)218 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(BandwidthGroup, IBandwidthGroup)219 220 NS_DECL_CLASSINFO(BandwidthControl)221 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(BandwidthControl, IBandwidthControl)222 198 223 199 ////////////////////////////////////////////////////////////////////////////////
Note:
See TracChangeset
for help on using the changeset viewer.