Changeset 36615 in vbox for trunk/src/VBox
- Timestamp:
- Apr 7, 2011 12:45:27 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 71064
- Location:
- trunk/src/VBox/Main
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/idl/VirtualBox.xidl
r36276 r36615 6946 6946 <interface 6947 6947 name="IHost" extends="$unknown" 6948 uuid=" 35b004f4-7806-4009-bfa8-d1308adba7e5"6948 uuid="dab4a2b8-c735-4f08-94fc-9bec84182e2f" 6949 6949 wsmap="managed" 6950 6950 > … … 7377 7377 <param name="device" type="IHostUSBDevice" dir="return"> 7378 7378 <desc>Found USB device object.</desc> 7379 </param> 7380 </method> 7381 7382 <method name="generateMACAddress"> 7383 <desc> 7384 Generates a valid Ethernet MAC address, 12 hexadecimal characters. 7385 </desc> 7386 <param name="address" type="wstring" dir="return"> 7387 <desc>New Ethernet MAC address.</desc> 7379 7388 </param> 7380 7389 </method> -
trunk/src/VBox/Main/include/HostImpl.h
r35813 r36615 5 5 6 6 /* 7 * Copyright (C) 2006-20 09Oracle Corporation7 * Copyright (C) 2006-2011 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 57 57 58 58 // IHost properties 59 STDMETHOD(COMGETTER(DVDDrives))(ComSafeArrayOut 60 STDMETHOD(COMGETTER(FloppyDrives))(ComSafeArrayOut 61 STDMETHOD(COMGETTER(USBDevices))(ComSafeArrayOut 62 STDMETHOD(COMGETTER(USBDeviceFilters))(ComSafeArrayOut 63 STDMETHOD(COMGETTER(NetworkInterfaces))(ComSafeArrayOut 59 STDMETHOD(COMGETTER(DVDDrives))(ComSafeArrayOut(IMedium *, drives)); 60 STDMETHOD(COMGETTER(FloppyDrives))(ComSafeArrayOut(IMedium *, drives)); 61 STDMETHOD(COMGETTER(USBDevices))(ComSafeArrayOut(IHostUSBDevice *, aUSBDevices)); 62 STDMETHOD(COMGETTER(USBDeviceFilters))(ComSafeArrayOut(IHostUSBDeviceFilter *, aUSBDeviceFilters)); 63 STDMETHOD(COMGETTER(NetworkInterfaces))(ComSafeArrayOut(IHostNetworkInterface *, aNetworkInterfaces)); 64 64 STDMETHOD(COMGETTER(ProcessorCount))(ULONG *count); 65 65 STDMETHOD(COMGETTER(ProcessorOnlineCount))(ULONG *count); … … 67 67 STDMETHOD(GetProcessorSpeed)(ULONG cpuId, ULONG *speed); 68 68 STDMETHOD(GetProcessorDescription)(ULONG cpuId, BSTR *description); 69 STDMETHOD(GetProcessorFeature) 69 STDMETHOD(GetProcessorFeature)(ProcessorFeature_T feature, BOOL *supported); 70 70 STDMETHOD(GetProcessorCPUIDLeaf)(ULONG aCpuId, ULONG aLeaf, ULONG aSubLeaf, ULONG *aValEAX, ULONG *aValEBX, ULONG *aValECX, ULONG *aValEDX); 71 71 STDMETHOD(COMGETTER(MemorySize))(ULONG *size); … … 77 77 78 78 // IHost methods 79 STDMETHOD(CreateHostOnlyNetworkInterface) 80 81 STDMETHOD(RemoveHostOnlyNetworkInterface) 82 STDMETHOD(CreateUSBDeviceFilter) 83 STDMETHOD(InsertUSBDeviceFilter) 84 STDMETHOD(RemoveUSBDeviceFilter) 79 STDMETHOD(CreateHostOnlyNetworkInterface)(IHostNetworkInterface **aHostNetworkInterface, 80 IProgress **aProgress); 81 STDMETHOD(RemoveHostOnlyNetworkInterface)(IN_BSTR aId, IProgress **aProgress); 82 STDMETHOD(CreateUSBDeviceFilter)(IN_BSTR aName, IHostUSBDeviceFilter **aFilter); 83 STDMETHOD(InsertUSBDeviceFilter)(ULONG aPosition, IHostUSBDeviceFilter *aFilter); 84 STDMETHOD(RemoveUSBDeviceFilter)(ULONG aPosition); 85 85 86 STDMETHOD(FindHostDVDDrive) (IN_BSTR aName, IMedium **aDrive); 87 STDMETHOD(FindHostFloppyDrive) (IN_BSTR aName, IMedium **aDrive); 88 STDMETHOD(FindHostNetworkInterfaceByName) (IN_BSTR aName, IHostNetworkInterface **networkInterface); 89 STDMETHOD(FindHostNetworkInterfaceById) (IN_BSTR id, IHostNetworkInterface **networkInterface); 90 STDMETHOD(FindHostNetworkInterfacesOfType) (HostNetworkInterfaceType_T type, ComSafeArrayOut (IHostNetworkInterface *, aNetworkInterfaces)); 91 STDMETHOD(FindUSBDeviceByAddress) (IN_BSTR aAddress, IHostUSBDevice **aDevice); 92 STDMETHOD(FindUSBDeviceById) (IN_BSTR aId, IHostUSBDevice **aDevice); 86 STDMETHOD(FindHostDVDDrive)(IN_BSTR aName, IMedium **aDrive); 87 STDMETHOD(FindHostFloppyDrive)(IN_BSTR aName, IMedium **aDrive); 88 STDMETHOD(FindHostNetworkInterfaceByName)(IN_BSTR aName, IHostNetworkInterface **networkInterface); 89 STDMETHOD(FindHostNetworkInterfaceById)(IN_BSTR id, IHostNetworkInterface **networkInterface); 90 STDMETHOD(FindHostNetworkInterfacesOfType)(HostNetworkInterfaceType_T type, ComSafeArrayOut(IHostNetworkInterface *, aNetworkInterfaces)); 91 STDMETHOD(FindUSBDeviceByAddress)(IN_BSTR aAddress, IHostUSBDevice **aDevice); 92 STDMETHOD(FindUSBDeviceById)(IN_BSTR aId, IHostUSBDevice **aDevice); 93 STDMETHOD(GenerateMACAddress)(BSTR *aAddress); 93 94 94 95 // public methods only for internal purposes … … 125 126 #endif /* !VBOX_WITH_USB */ 126 127 128 static void generateMACAddress(Utf8Str &mac); 129 127 130 private: 128 131 … … 143 146 144 147 #ifdef VBOX_WITH_RESOURCE_USAGE_API 145 void registerMetrics 146 void unregisterMetrics 148 void registerMetrics(PerformanceCollector *aCollector); 149 void unregisterMetrics(PerformanceCollector *aCollector); 147 150 #endif /* VBOX_WITH_RESOURCE_USAGE_API */ 148 151 -
trunk/src/VBox/Main/src-server/HostImpl.cpp
r36451 r36615 5 5 6 6 /* 7 * Copyright (C) 2006-201 0Oracle Corporation7 * Copyright (C) 2006-2011 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 1511 1511 return E_NOTIMPL; 1512 1512 #endif /* !VBOX_WITH_USB */ 1513 } 1514 1515 STDMETHODIMP Host::GenerateMACAddress(BSTR *aAddress) 1516 { 1517 CheckComArgOutPointerValid(aAddress); 1518 // no locking required 1519 Utf8Str mac; 1520 generateMACAddress(mac); 1521 Bstr(mac).cloneTo(aAddress); 1522 return S_OK; 1513 1523 } 1514 1524 … … 2796 2806 ramUsageFree); 2797 2807 aCollector->registerBaseMetric (ramUsage); 2798 pm::BaseMetric *ramVmm = new pm::HostRamVmm(aCollector->getGuestManager(), objptr, 2808 pm::BaseMetric *ramVmm = new pm::HostRamVmm(aCollector->getGuestManager(), objptr, 2799 2809 ramVMMUsed, 2800 2810 ramVMMFree, … … 2898 2908 } 2899 2909 2910 2911 /* static */ 2912 void Host::generateMACAddress(Utf8Str &mac) 2913 { 2914 /* 2915 * Our strategy is as follows: the first three bytes are our fixed 2916 * vendor ID (080027). The remaining 3 bytes will be taken from the 2917 * start of a GUID. This is a fairly safe algorithm. 2918 */ 2919 Guid guid; 2920 guid.create(); 2921 mac = Utf8StrFmt("080027%02X%02X%02X", 2922 guid.raw()->au8[0], guid.raw()->au8[1], guid.raw()->au8[2]); 2923 } 2924 2900 2925 #endif /* VBOX_WITH_RESOURCE_USAGE_API */ 2901 2926 -
trunk/src/VBox/Main/src-server/NetworkAdapterImpl.cpp
r36276 r36615 5 5 6 6 /* 7 * Copyright (C) 2006-201 0Oracle Corporation7 * Copyright (C) 2006-2011 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 22 22 #include "MachineImpl.h" 23 23 #include "GuestOSTypeImpl.h" 24 #include "HostImpl.h" 24 25 25 26 #include <iprt/string.h> … … 1265 1266 if (FAILED(rc)) return rc; 1266 1267 } 1267 1268 1268 1269 // leave the lock before attaching 1269 1270 alock.release(); … … 1573 1574 void NetworkAdapter::generateMACAddress() 1574 1575 { 1575 /* 1576 * Our strategy is as follows: the first three bytes are our fixed 1577 * vendor ID (080027). The remaining 3 bytes will be taken from the 1578 * start of a GUID. This is a fairly safe algorithm. 1579 */ 1580 char strMAC[13]; 1581 Guid guid; 1582 guid.create(); 1583 RTStrPrintf (strMAC, sizeof(strMAC), "080027%02X%02X%02X", 1584 guid.raw()->au8[0], guid.raw()->au8[1], guid.raw()->au8[2]); 1585 LogFlowThisFunc(("generated MAC: '%s'\n", strMAC)); 1586 mData->mMACAddress = strMAC; 1576 Utf8Str mac; 1577 Host::generateMACAddress(mac); 1578 LogFlowThisFunc(("generated MAC: '%s'\n", mac.c_str())); 1579 mData->mMACAddress = mac; 1587 1580 } 1588 1581
Note:
See TracChangeset
for help on using the changeset viewer.