VirtualBox

Changeset 10896 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Jul 25, 2008 11:58:01 PM (17 years ago)
Author:
vboxsync
Message:

Main & VBoxManage: Made HostNetworkInterface, IHost::networkInterfaces and list hostifs available everywhere. Only Windows and Darwin implements the enumeration.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/HostImpl.cpp

    r10753 r10896  
    8181#include "HostDVDDriveImpl.h"
    8282#include "HostFloppyDriveImpl.h"
     83#include "HostNetworkInterfaceImpl.h"
    8384#ifdef VBOX_WITH_USB
    8485# include "HostUSBDeviceImpl.h"
     
    9495#endif
    9596
    96 #ifdef RT_OS_WINDOWS
    97 # include "HostNetworkInterfaceImpl.h"
    98 #endif
    9997
    10098#include <VBox/usb.h>
     
    454452
    455453#ifdef RT_OS_WINDOWS
    456 
     454/**
     455 * Windows helper function for Host::COMGETTER(NetworkInterfaces).
     456 *
     457 * @returns true / false.
     458 *
     459 * @param   guid        The GUID.
     460 */
    457461static bool IsTAPDevice(const char *guid)
    458462{
     
    467471        return false;
    468472
    469     while(true)
     473    for (;;)
    470474    {
    471475        char szEnumName[256];
     
    482486        if (status == ERROR_SUCCESS)
    483487        {
    484             len = sizeof (szNetCfgInstanceId);
     488            len = sizeof(szNetCfgInstanceId);
    485489            status = RegQueryValueExA(hNetCardGUID, "NetCfgInstanceId", NULL, &dwKeyType, (LPBYTE)szNetCfgInstanceId, &len);
    486490            if (status == ERROR_SUCCESS && dwKeyType == REG_SZ)
     
    499503                if (   !strcmp(szNetCfgInstanceId, guid)
    500504                    && !strcmp(szNetProductName, "VirtualBox TAP Adapter")
    501                     && (!strcmp(szNetProviderName, "innotek GmbH") || !strcmp(szNetProviderName, "Sun Microsystems, Inc.")))
     505                    && (   !strcmp(szNetProviderName, "innotek GmbH")
     506                        || !strcmp(szNetProviderName, "Sun Microsystems, Inc.")))
    502507                {
    503508                    ret = true;
     
    511516    }
    512517
    513     RegCloseKey (hNetcard);
     518    RegCloseKey(hNetcard);
    514519    return ret;
    515520}
     521#endif /* RT_OS_WINDOWS */
    516522
    517523/**
     
    523529STDMETHODIMP Host::COMGETTER(NetworkInterfaces) (IHostNetworkInterfaceCollection **networkInterfaces)
    524530{
     531#if defined(RT_OS_WINDOWS) || defined(RT_OS_DARWIN) /*|| defined(RT_OS_SOLARIS)*/ /*|| defined(RT_OS_OS2)*/
    525532    if (!networkInterfaces)
    526533        return E_POINTER;
     
    530537    std::list <ComObjPtr <HostNetworkInterface> > list;
    531538
     539# if defined(RT_OS_DARWIN)
     540    PDARWINETHERNIC pEtherNICs = DarwinGetEthernetControllers();
     541    while (pEtherNICs)
     542    {
     543        ComObjPtr<HostNetworkInterface> IfObj;
     544        IfObj.createObject();
     545        if (SUCCEEDED(IfObj->init(Bstr(pEtherNICs->szName), Guid(pEtherNICs->Uuid))))
     546            list.push_back(IfObj);
     547
     548        /* next, free current */
     549        void *pvFree = pEtherNICs;
     550        pEtherNICs = pEtherNICs->pNext;
     551        RTMemFree(pvFree);
     552    }
     553
     554# elif defined RT_OS_WINDOWS
    532555    static const char *NetworkKey = "SYSTEM\\CurrentControlSet\\Control\\Network\\"
    533556                                    "{4D36E972-E325-11CE-BFC1-08002BE10318}";
     
    585608    }
    586609    RegCloseKey (hCtrlNet);
     610# endif /* RT_OS_WINDOWS */
    587611
    588612    ComObjPtr <HostNetworkInterfaceCollection> collection;
     
    591615    collection.queryInterfaceTo (networkInterfaces);
    592616    return S_OK;
    593 }
    594 #endif /* RT_OS_WINDOWS */
     617
     618#else
     619    /* Not implemented / supported on this platform. */
     620    return E_NOTIMPL;
     621#endif
     622}
    595623
    596624STDMETHODIMP Host::COMGETTER(USBDevices)(IHostUSBDeviceCollection **aUSBDevices)
  • trunk/src/VBox/Main/Makefile.kmk

    r10868 r10896  
    217217        HostDVDDriveImpl.cpp \
    218218        HostFloppyDriveImpl.cpp \
     219        HostNetworkInterfaceImpl.cpp \
    219220        GuestOSTypeImpl.cpp \
    220221        NetworkAdapterImpl.cpp \
     
    236237
    237238VBoxSVC_SOURCES.win = \
    238         HostNetworkInterfaceImpl.cpp \
    239239        win/svcmain.cpp \
    240240        win/svchlp.cpp \
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r10797 r10896  
    27632763      <desc>
    27642764        This setting determines whether VirtualBox will try to make use of
    2765         the nested paging extension of Intel VT-x and AMD-V. Note that in case 
     2765        the nested paging extension of Intel VT-x and AMD-V. Note that in case
    27662766        such extensions are not available, they will not be used.
    27672767      </desc>
     
    48534853  </collection>
    48544854
    4855 <if target="midl">
    48564855  <interface
    48574856     name="IHostNetworkInterface" extends="$unknown"
     
    49104909    </method>
    49114910  </collection>
    4912 </if>
    49134911
    49144912  <interface
    49154913     name="IHost" extends="$unknown"
    4916      uuid="3d864057-ae6b-4d05-9cf7-c341139b6062"
     4914     uuid="D56DC1AF-8D1B-4A06-86D7-26016E0E2B74"
    49174915     wsmap="managed"
    49184916     >
     
    49784976    </attribute>
    49794977
    4980 <if target="midl">
    49814978    <attribute name="networkInterfaces" type="IHostNetworkInterfaceCollection" readonly="yes">
    49824979      <desc>List of host network interfaces currently defined on the host.</desc>
    49834980    </attribute>
    4984 </if>
    49854981
    49864982    <attribute name="processorCount" type="unsigned long" readonly="yes">
     
    1034010336      <param name="period" type="unsigned long" dir="in">
    1034110337        <desc>
    10342           Time interval in seconds between two consecutive samples of performace 
     10338          Time interval in seconds between two consecutive samples of performace
    1034310339          data.
    1034410340        </desc>
     
    1034610342      <param name="count" type="unsigned long" dir="in">
    1034710343        <desc>
    10348           Number of samples to retain in performance data history. Older samples 
     10344          Number of samples to retain in performance data history. Older samples
    1034910345          get discarded.
    1035010346        </desc>
     
    1039710393      <desc>
    1039810394        Queries collected metrics data for a set of objects.
    10399        
     10395
    1040010396        The data itself and related metric information are returned in four
    1040110397        parallel and one flattened array of arrays. Elements of @c
    10402         returnMetricNames, @c returnObjects, @c returnDataIndices and @ 
    10403         returnDataLengths with the same index describe one set of values 
     10398        returnMetricNames, @c returnObjects, @c returnDataIndices and @
     10399        returnDataLengths with the same index describe one set of values
    1040410400        corresponding to a single metric.
    1040510401
     
    1044810444      <param name="returnData" type="long" dir="return" safearray="yes">
    1044910445        <desc>
    10450           Flattened array of all metric data containing sequences of values for 
     10446          Flattened array of all metric data containing sequences of values for
    1045110447          each metric.
    1045210448        </desc>
  • trunk/src/VBox/Main/include/HostImpl.h

    r10595 r10896  
    8080    STDMETHOD(COMGETTER(USBDevices))(IHostUSBDeviceCollection **aUSBDevices);
    8181    STDMETHOD(COMGETTER(USBDeviceFilters))(IHostUSBDeviceFilterCollection ** aUSBDeviceFilters);
    82 #ifdef RT_OS_WINDOWS
    8382    STDMETHOD(COMGETTER(NetworkInterfaces))(IHostNetworkInterfaceCollection **networkInterfaces);
    84 #endif
    8583    STDMETHOD(COMGETTER(ProcessorCount))(ULONG *count);
    8684    STDMETHOD(GetProcessorSpeed)(ULONG cpuId, ULONG *speed);
  • trunk/src/VBox/Main/include/HostNetworkInterfaceImpl.h

    r8155 r10896  
    2222#ifndef ____H_HOSTNETWORKINTERFACEIMPL
    2323#define ____H_HOSTNETWORKINTERFACEIMPL
    24 
    25 #ifndef RT_OS_WINDOWS
    26 #error This is Windows only stuff!
    27 #endif
    2824
    2925#include "VirtualBoxBase.h"
  • trunk/src/VBox/Main/xpcom/server.cpp

    r10544 r10896  
    102102#include <HostDVDDriveImpl.h>
    103103#include <HostFloppyDriveImpl.h>
     104#include <HostNetworkInterfaceImpl.h>
    104105#include <GuestOSTypeImpl.h>
    105106#include <NetworkAdapterImpl.h>
     
    165166NS_DECL_CLASSINFO(HostFloppyDrive)
    166167NS_IMPL_THREADSAFE_ISUPPORTS1_CI(HostFloppyDrive, IHostFloppyDrive)
     168NS_DECL_CLASSINFO(HostNetworkInterface)
     169NS_IMPL_THREADSAFE_ISUPPORTS1_CI(HostNetworkInterface, IHostNetworkInterface)
    167170NS_DECL_CLASSINFO(GuestOSType)
    168171NS_IMPL_THREADSAFE_ISUPPORTS1_CI(GuestOSType, IGuestOSType)
     
    205208COM_IMPL_READONLY_ENUM_AND_COLLECTION(HostDVDDrive)
    206209COM_IMPL_READONLY_ENUM_AND_COLLECTION(HostFloppyDrive)
     210COM_IMPL_READONLY_ENUM_AND_COLLECTION(HostNetworkInterface)
    207211COM_IMPL_READONLY_ENUM_AND_COLLECTION(HardDisk)
    208212COM_IMPL_READONLY_ENUM_AND_COLLECTION(DVDImage)
Note: See TracChangeset for help on using the changeset viewer.

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