VirtualBox

儲存庫 vbox 的更動 17309


忽略:
時間撮記:
2009-3-3 下午06:54:23 (16 年 以前)
作者:
vboxsync
訊息:

Main: IHostNetworkInterfaceIpConfig added

位置:
trunk/src/VBox
檔案:
修改 6 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageList.cpp

    r17275 r17309  
    303303                networkInterface->COMGETTER(Id)(interfaceGuid.asOutParam());
    304304                RTPrintf("GUID:            %lS\n", Bstr(interfaceGuid.toString()).raw());
     305                ComPtr<IHostNetworkInterfaceIpConfig> ipConfig;
     306                networkInterface->COMGETTER(IpConfig)(ipConfig.asOutParam());
    305307                ULONG IPAddress;
    306                 networkInterface->COMGETTER(IPAddress)(&IPAddress);
     308                ipConfig->COMGETTER(IPAddress)(&IPAddress);
    307309                RTPrintf("IPAddress:       %d.%d.%d.%d\n",
    308310                        ((uint8_t*)&IPAddress)[0],
     
    311313                        ((uint8_t*)&IPAddress)[3]);
    312314                ULONG NetworkMask;
    313                 networkInterface->COMGETTER(NetworkMask)(&NetworkMask);
     315                ipConfig->COMGETTER(NetworkMask)(&NetworkMask);
    314316                RTPrintf("NetworkMask:     %d.%d.%d.%d\n",
    315317                        ((uint8_t*)&NetworkMask)[0],
     
    318320                        ((uint8_t*)&NetworkMask)[3]);
    319321                Bstr IPV6Address;
    320                 networkInterface->COMGETTER(IPV6Address)(IPV6Address.asOutParam());
     322                ipConfig->COMGETTER(IPV6Address)(IPV6Address.asOutParam());
    321323                RTPrintf("IPV6Address:     %lS\n", IPV6Address.raw());
    322324                Bstr IPV6NetworkMask;
    323                 networkInterface->COMGETTER(IPV6NetworkMask)(IPV6NetworkMask.asOutParam());
     325                ipConfig->COMGETTER(IPV6NetworkMask)(IPV6NetworkMask.asOutParam());
    324326                RTPrintf("IPV6NetworkMask: %lS\n", IPV6NetworkMask.raw());
    325327                Bstr HardwareAddress;
  • trunk/src/VBox/Main/HostNetworkInterfaceImpl.cpp

    r17277 r17309  
    7272
    7373    return S_OK;
     74}
     75
     76void HostNetworkInterface::uninit()
     77{
     78    LogFlowThisFunc (("\n"));
     79
     80    /* Enclose the state transition Ready->InUninit->NotReady */
     81    AutoUninitSpan autoUninitSpan (this);
     82    if (autoUninitSpan.uninitDone())
     83        return;
     84
     85    m.ipConfig.setNull();
    7486}
    7587
     
    129141    mIfType = ifType;
    130142
    131     m.IPAddress = pIf->IPAddress.u;
    132     m.networkMask = pIf->IPNetMask.u;
    133     m.IPV6Address = composeIPv6Address(&pIf->IPv6Address);
    134     m.IPV6NetworkMask = composeIPv6Address(&pIf->IPv6NetMask);
     143    m.ipConfig.createObject();
     144
     145    HRESULT hr = m.ipConfig->init (pIf);
     146    if(FAILED(hr))
     147        return hr;
     148
    135149    m.hardwareAddress = composeHardwareAddress(&pIf->MACAddress);
    136150#ifdef RT_OS_WINDOWS
     
    188202}
    189203
    190 
    191 /**
    192  * Returns the IP address of the host network interface.
    193  *
    194  * @returns COM status code
    195  * @param   aIPAddress address of result pointer
    196  */
    197 STDMETHODIMP HostNetworkInterface::COMGETTER(IPAddress) (ULONG *aIPAddress)
    198 {
    199     CheckComArgOutPointerValid(aIPAddress);
    200 
    201     AutoCaller autoCaller (this);
    202     CheckComRCReturnRC (autoCaller.rc());
    203 
    204     *aIPAddress = m.IPAddress;
    205 
    206     return S_OK;
    207 }
    208 
    209 /**
    210  * Returns the netwok mask of the host network interface.
    211  *
    212  * @returns COM status code
    213  * @param   aNetworkMask address of result pointer
    214  */
    215 STDMETHODIMP HostNetworkInterface::COMGETTER(NetworkMask) (ULONG *aNetworkMask)
    216 {
    217     CheckComArgOutPointerValid(aNetworkMask);
    218 
    219     AutoCaller autoCaller (this);
    220     CheckComRCReturnRC (autoCaller.rc());
    221 
    222     *aNetworkMask = m.networkMask;
    223 
    224     return S_OK;
    225 }
    226 
    227 /**
    228  * Returns the IP V6 address of the host network interface.
    229  *
    230  * @returns COM status code
    231  * @param   aIPV6Address address of result pointer
    232  */
    233 STDMETHODIMP HostNetworkInterface::COMGETTER(IPV6Address) (BSTR *aIPV6Address)
    234 {
    235     CheckComArgOutPointerValid(aIPV6Address);
    236 
    237     AutoCaller autoCaller (this);
    238     CheckComRCReturnRC (autoCaller.rc());
    239 
    240     m.IPV6Address.cloneTo (aIPV6Address);
    241 
    242     return S_OK;
    243 }
    244 
    245 /**
    246  * Returns the IP V6 network mask of the host network interface.
    247  *
    248  * @returns COM status code
    249  * @param   aIPV6Mask address of result pointer
    250  */
    251 STDMETHODIMP HostNetworkInterface::COMGETTER(IPV6NetworkMask) (BSTR *aIPV6Mask)
    252 {
    253     CheckComArgOutPointerValid(aIPV6Mask);
    254 
    255     AutoCaller autoCaller (this);
    256     CheckComRCReturnRC (autoCaller.rc());
    257 
    258     m.IPV6NetworkMask.cloneTo (aIPV6Mask);
     204STDMETHODIMP HostNetworkInterface::COMGETTER(IpConfig) (IHostNetworkInterfaceIpConfig **aIpConfig)
     205{
     206    if (!aIpConfig)
     207        return E_POINTER;
     208
     209    AutoCaller autoCaller (this);
     210    CheckComRCReturnRC (autoCaller.rc());
     211
     212    m.ipConfig.queryInterfaceTo (aIpConfig);
    259213
    260214    return S_OK;
  • trunk/src/VBox/Main/Makefile.kmk

    r17208 r17309  
    281281        HostFloppyDriveImpl.cpp \
    282282        HostNetworkInterfaceImpl.cpp \
     283        HostNetworkInterfaceIpConfigImpl.cpp \
    283284        GuestOSTypeImpl.cpp \
    284285        NetworkAdapterImpl.cpp \
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r17291 r17309  
    64486448
    64496449  <interface
     6450     name="IHostNetworkInterfaceIpConfig" extends="$unknown"
     6451     uuid="38f31587-1ad2-4593-ab0c-d16f6e36c0ee"
     6452     wsmap="managed"
     6453     >
     6454    <desc>
     6455      Reprents IP settings for one of host's network interfaces. IP V6 address and network
     6456      mask are strings of 32 hexdecimal digits grouped by four. Groups are
     6457      separated by colons.
     6458      For example, fe80:0000:0000:0000:021e:c2ff:fed2:b030.
     6459    </desc>
     6460
     6461    <attribute name="IPAddress" type="unsigned long" readonly="yes">
     6462      <desc>Returns the IP V4 address of the interface.</desc>
     6463    </attribute>
     6464
     6465    <attribute name="networkMask" type="unsigned long" readonly="yes">
     6466      <desc>Returns the network mask of the interface.</desc>
     6467    </attribute>
     6468
     6469    <attribute name="defaultGateway" type="unsigned long" readonly="yes">
     6470      <desc>Returns the network mask of the interface.</desc>
     6471    </attribute>
     6472
     6473    <attribute name="IPV6Address" type="wstring" readonly="yes">
     6474      <desc>Returns the IP V6 address of the interface.</desc>
     6475    </attribute>
     6476
     6477    <attribute name="IPV6NetworkMask" type="wstring" readonly="yes">
     6478      <desc>Returns the IP V6 network mask of the interface.</desc>
     6479    </attribute>
     6480  </interface>
     6481
     6482  <interface
    64506483     name="IHostNetworkInterface" extends="$unknown"
    6451      uuid="c312bf73-b353-4add-9db7-481b891ec08c"
     6484     uuid="3fd5d8d9-c503-4c1a-b88c-e78fb78f8559"
    64526485     wsmap="managed"
    64536486     >
     
    64666499    </attribute>
    64676500
    6468     <attribute name="IPAddress" type="unsigned long" readonly="yes">
    6469       <desc>Returns the IP V4 address of the interface.</desc>
    6470     </attribute>
    6471 
    6472     <attribute name="networkMask" type="unsigned long" readonly="yes">
    6473       <desc>Returns the network mask of the interface.</desc>
    6474     </attribute>
    6475 
    6476     <attribute name="IPV6Address" type="wstring" readonly="yes">
    6477       <desc>Returns the IP V6 address of the interface.</desc>
    6478     </attribute>
    6479 
    6480     <attribute name="IPV6NetworkMask" type="wstring" readonly="yes">
    6481       <desc>Returns the IP V6 network mask of the interface.</desc>
     6501    <attribute name="ipConfig" type="IHostNetworkInterfaceIpConfig" readonly="yes">
     6502      <desc>Returns the adapter ip config information </desc>
    64826503    </attribute>
    64836504
  • trunk/src/VBox/Main/include/HostNetworkInterfaceImpl.h

    r17275 r17309  
    2727#include "VirtualBoxBase.h"
    2828#include "Collection.h"
     29#include "HostNetworkInterfaceIpConfigImpl.h"
     30
    2931#ifdef VBOX_WITH_HOSTNETIF_API
    3032/* class HostNetworkInterface; */
     
    6466    HRESULT init (Bstr aInterfaceName, HostNetworkInterfaceType_T ifType, struct NETIFINFO *pIfs);
    6567#endif
     68    void uninit();
    6669
    6770    // IHostNetworkInterface properties
    6871    STDMETHOD(COMGETTER(Name)) (BSTR *aInterfaceName);
    6972    STDMETHOD(COMGETTER(Id)) (OUT_GUID aGuid);
    70     STDMETHOD(COMGETTER(IPAddress)) (ULONG *aIPAddress);
    71     STDMETHOD(COMGETTER(NetworkMask)) (ULONG *aNetworkMask);
    72     STDMETHOD(COMGETTER(IPV6Address)) (BSTR *aIPV6Address);
    73     STDMETHOD(COMGETTER(IPV6NetworkMask)) (BSTR *aIPV6Mask);
     73    STDMETHOD(COMGETTER(IpConfig)) (IHostNetworkInterfaceIpConfig **aIpConfig);
    7474    STDMETHOD(COMGETTER(HardwareAddress)) (BSTR *aHardwareAddress);
    7575    STDMETHOD(COMGETTER(MediumType)) (HostNetworkInterfaceMediumType_T *aType);
     
    8787    struct Data
    8888    {
    89         Data() : IPAddress (0), networkMask (0),
    90             mediumType (HostNetworkInterfaceMediumType_Unknown),
     89        Data() : mediumType (HostNetworkInterfaceMediumType_Unknown),
    9190            status(HostNetworkInterfaceStatus_Down){}
    9291
    93         ULONG IPAddress;
    94         ULONG networkMask;
    95         Bstr IPV6Address;
    96         Bstr IPV6NetworkMask;
     92        ComObjPtr <HostNetworkInterfaceIpConfig> ipConfig;
    9793        Bstr hardwareAddress;
    9894        HostNetworkInterfaceMediumType_T mediumType;
  • trunk/src/VBox/Main/include/netif.h

    r17275 r17309  
    5959    RTNETADDRIPV4  IPAddress;
    6060    RTNETADDRIPV4  IPNetMask;
     61    RTNETADDRIPV4  IPDefaultGateway;
    6162    RTNETADDRIPV6  IPv6Address;
    6263    RTNETADDRIPV6  IPv6NetMask;
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

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