VirtualBox

Changeset 17419 in vbox for trunk


Ignore:
Timestamp:
Mar 5, 2009 6:32:17 PM (16 years ago)
Author:
vboxsync
Message:

VBoxManage interface to hostonly if basis

Location:
trunk/src/VBox
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/Makefile.kmk

    r17322 r17419  
    5858        VBoxManageUSB.cpp \
    5959        VBoxInternalManage.cpp \
     60        VBoxManageHostonly.cpp \
    6061        $(if $(VBOX_WITH_GUEST_PROPS),VBoxManageGuestProp.cpp) \
    6162        VBoxManageSVN.cpp
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp

    r17382 r17419  
    17241724        { "import",           handleImportAppliance },
    17251725        { "export",           handleExportAppliance },
     1726        { "hostonlyif",       handleHostonlyIf },
    17261727        { NULL,               NULL }
    17271728    };
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManage.h

    r17104 r17419  
    188188int handleUSBFilter(HandlerArg *a);
    189189
     190/* VBoxManageHostonly.cpp */
     191int handleHostonlyIf(HandlerArg *a);
     192
    190193#endif /* !VBOX_ONLY_DOCS */
    191194unsigned long VBoxSVNRev();
  • trunk/src/VBox/Main/HostNetworkInterfaceImpl.cpp

    r17380 r17419  
    8080    m.IPAddress = pIf->IPAddress.u;
    8181    m.networkMask = pIf->IPNetMask.u;
    82     m.defaultGateway = pIf->IPDefaultGateway.u;
    8382    m.IPV6Address = composeIPv6Address(&pIf->IPv6Address);
    8483    m.IPV6NetworkMask = composeIPv6Address(&pIf->IPv6NetMask);
    85     m.IPV6DefaultGateway = composeIPv6Address(&pIf->IPV6DefaultGateway);
    8684    m.hardwareAddress = composeHardwareAddress(&pIf->MACAddress);
    8785#ifdef RT_OS_WINDOWS
     
    205203}
    206204
    207 /**
    208  * Returns the default gateway of the host network interface.
    209  *
    210  * @returns COM status code
    211  * @param   aNetworkMask address of result pointer
    212  */
    213 STDMETHODIMP HostNetworkInterface::COMGETTER(DefaultGateway) (ULONG *aDefaultGateway)
    214 {
    215     CheckComArgOutPointerValid(aDefaultGateway);
    216 
    217     AutoCaller autoCaller (this);
    218     CheckComRCReturnRC (autoCaller.rc());
    219 
    220     *aDefaultGateway = m.defaultGateway;
    221 
    222     return S_OK;
    223 }
    224 
    225205STDMETHODIMP HostNetworkInterface::COMGETTER(IPV6Supported) (BOOL *aIPV6Supported)
    226206{
     
    269249
    270250/**
    271  * Returns the IP V6 default gateway of the host network interface.
    272  *
    273  * @returns COM status code
    274  * @param   aIPV6DefaultGateway address of result pointer
    275  */
    276 STDMETHODIMP HostNetworkInterface::COMGETTER(IPV6DefaultGateway) (BSTR *aIPV6DefaultGateway)
    277 {
    278     CheckComArgOutPointerValid(aIPV6DefaultGateway);
    279 
    280     AutoCaller autoCaller (this);
    281     CheckComRCReturnRC (autoCaller.rc());
    282 
    283     m.IPV6DefaultGateway.cloneTo (aIPV6DefaultGateway);
    284 
    285     return S_OK;
    286 }
    287 
    288 /**
    289251 * Returns the hardware address of the host network interface.
    290252 *
     
    359321}
    360322
    361 STDMETHODIMP HostNetworkInterface::EnableStaticIpConfig (ULONG aIPAddress, ULONG aNetworkMask, ULONG aDefaultGateway)
     323STDMETHODIMP HostNetworkInterface::EnableStaticIpConfig (ULONG aIPAddress, ULONG aNetworkMask)
    362324{
    363325#ifndef VBOX_WITH_HOSTNETIF_API
     
    367329    CheckComRCReturnRC (autoCaller.rc());
    368330
    369     int rc = NetIfEnableStaticIpConfig(this, aIPAddress, aNetworkMask, aDefaultGateway);
     331    int rc = NetIfEnableStaticIpConfig(this, aIPAddress, aNetworkMask);
    370332    if (RT_FAILURE(rc))
    371333    {
     
    377339}
    378340
    379 STDMETHODIMP HostNetworkInterface::EnableStaticIpConfigV6 (IN_BSTR aIPV6Address, ULONG aIPV6MaskPrefixLength, IN_BSTR aIPV6DefaultGateway)
     341STDMETHODIMP HostNetworkInterface::EnableStaticIpConfigV6 (IN_BSTR aIPV6Address, ULONG aIPV6MaskPrefixLength)
    380342{
    381343#ifndef VBOX_WITH_HOSTNETIF_API
     
    384346    if (!aIPV6Address)
    385347        return E_INVALIDARG;
    386     if (!aIPV6DefaultGateway)
    387         return E_INVALIDARG;
    388348    if (aIPV6MaskPrefixLength > 128)
    389349        return E_INVALIDARG;
     
    392352    CheckComRCReturnRC (autoCaller.rc());
    393353
    394     int rc = NetIfEnableStaticIpConfigV6(this, aIPV6Address, aIPV6MaskPrefixLength, aIPV6DefaultGateway);
     354    int rc = NetIfEnableStaticIpConfigV6(this, aIPV6Address, aIPV6MaskPrefixLength);
    395355    if (RT_FAILURE(rc))
    396356    {
  • trunk/src/VBox/Main/darwin/NetIfList-darwin.cpp

    r17358 r17419  
    141141}
    142142
    143 int NetIfEnableStaticIpConfig(HostNetworkInterface * pIf, ULONG ip, ULONG mask, ULONG gw)
     143int NetIfEnableStaticIpConfig(HostNetworkInterface * pIf, ULONG ip, ULONG mask)
    144144{
    145145    return VERR_NOT_IMPLEMENTED;
    146146}
    147147
    148 int NetIfEnableStaticIpConfigV6(HostNetworkInterface * pIf, IN_BSTR aIPV6Address, ULONG aIPV6MaskPrefixLength, IN_BSTR aIPV6DefaultGateway)
     148int NetIfEnableStaticIpConfigV6(HostNetworkInterface * pIf, IN_BSTR aIPV6Address, ULONG aIPV6MaskPrefixLength)
    149149{
    150150    return VERR_NOT_IMPLEMENTED;
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r17394 r17419  
    64496449  <interface
    64506450     name="IHostNetworkInterface" extends="$unknown"
    6451      uuid="b4467af7-9b16-479a-a812-c132cbd886a3"
     6451     uuid="a82f7de2-695b-4bb9-ac13-f033e5fd75c2"
    64526452     wsmap="managed"
    64536453     >
     
    64746474    </attribute>
    64756475
    6476     <attribute name="defaultGateway" type="unsigned long" readonly="yes">
    6477       <desc>Returns the network mask of the interface.</desc>
    6478     </attribute>
    6479 
    64806476    <attribute name="IPV6Supported" type="boolean" readonly="yes">
    64816477      <desc>Specifies whether the IP V6 is supported/enabled for the interface.</desc>
     
    64876483
    64886484    <attribute name="IPV6NetworkMask" type="wstring" readonly="yes">
    6489       <desc>Returns the IP V6 network mask of the interface.</desc>
    6490     </attribute>
    6491 
    6492     <attribute name="IPV6DefaultGateway" type="wstring" readonly="yes">
    64936485      <desc>Returns the IP V6 network mask of the interface.</desc>
    64946486    </attribute>
     
    65226514        </desc>
    65236515      </param>
    6524       <param name="defaultGateway" type="unsigned long" dir="in">
    6525         <desc>
    6526           default gateway.
    6527         </desc>
    6528       </param>
    65296516    </method>
    65306517
     
    65376524      </param>
    65386525      <param name="IPV6NetworkMaskPrefixLength" type="unsigned long" dir="in">
    6539         <desc>
    6540           network mask.
    6541         </desc>
    6542       </param>
    6543       <param name="IPV6DefaultGateway" type="wstring" dir="in">
    65446526        <desc>
    65456527          network mask.
  • trunk/src/VBox/Main/include/HostNetworkInterfaceImpl.h

    r17358 r17419  
    7171    STDMETHOD(COMGETTER(IPAddress)) (ULONG *aIPAddress);
    7272    STDMETHOD(COMGETTER(NetworkMask)) (ULONG *aNetworkMask);
    73     STDMETHOD(COMGETTER(DefaultGateway)) (ULONG *aDefaultGateway);
    7473    STDMETHOD(COMGETTER(IPV6Supported)) (BOOL *aIPV6Supported);
    7574    STDMETHOD(COMGETTER(IPV6Address)) (BSTR *aIPV6Address);
    7675    STDMETHOD(COMGETTER(IPV6NetworkMask)) (BSTR *aIPV6Mask);
    77     STDMETHOD(COMGETTER(IPV6DefaultGateway)) (BSTR *aDefaultGateway);
    7876    STDMETHOD(COMGETTER(HardwareAddress)) (BSTR *aHardwareAddress);
    7977    STDMETHOD(COMGETTER(MediumType)) (HostNetworkInterfaceMediumType_T *aType);
     
    8179    STDMETHOD(COMGETTER(InterfaceType)) (HostNetworkInterfaceType_T *aType);
    8280
    83     STDMETHOD(EnableStaticIpConfig) (ULONG aIPAddress, ULONG aNetworkMask, ULONG aDefaultGateway);
    84     STDMETHOD(EnableStaticIpConfigV6) (IN_BSTR aIPV6Address, ULONG aIPV6MaskPrefixLength, IN_BSTR aIPV6DefaultGateway);
     81    STDMETHOD(EnableStaticIpConfig) (ULONG aIPAddress, ULONG aNetworkMask);
     82    STDMETHOD(EnableStaticIpConfigV6) (IN_BSTR aIPV6Address, ULONG aIPV6MaskPrefixLength);
    8583    STDMETHOD(EnableDynamicIpConfig) ();
    8684
     
    9593    struct Data
    9694    {
    97         Data() : IPAddress (0), networkMask (0), defaultGateway(0),
     95        Data() : IPAddress (0), networkMask (0),
    9896            mediumType (HostNetworkInterfaceMediumType_Unknown),
    9997            status(HostNetworkInterfaceStatus_Down){}
     
    10199        ULONG IPAddress;
    102100        ULONG networkMask;
    103         ULONG defaultGateway;
    104101        Bstr IPV6Address;
    105102        Bstr IPV6NetworkMask;
    106         Bstr IPV6DefaultGateway;
    107103        Bstr hardwareAddress;
    108104        HostNetworkInterfaceMediumType_T mediumType;
  • trunk/src/VBox/Main/include/netif.h

    r17380 r17419  
    5959    RTNETADDRIPV4  IPAddress;
    6060    RTNETADDRIPV4  IPNetMask;
    61     RTNETADDRIPV4  IPDefaultGateway;
    6261    RTNETADDRIPV6  IPv6Address;
    6362    RTNETADDRIPV6  IPv6NetMask;
    64     RTNETADDRIPV6  IPV6DefaultGateway;
    6563    RTMAC          MACAddress;
    6664    NETIFTYPE      enmMediumType;
     
    7876
    7977int NetIfList(std::list <ComObjPtr <HostNetworkInterface> > &list);
    80 int NetIfEnableStaticIpConfig(HostNetworkInterface * pIf, ULONG ip, ULONG mask, ULONG gw);
    81 int NetIfEnableStaticIpConfigV6(HostNetworkInterface * pIf, IN_BSTR aIPV6Address, ULONG aIPV6MaskPrefixLength, IN_BSTR aIPV6DefaultGateway);
     78int NetIfEnableStaticIpConfig(HostNetworkInterface * pIf, ULONG ip, ULONG mask);
     79int NetIfEnableStaticIpConfigV6(HostNetworkInterface * pIf, IN_BSTR aIPV6Address, ULONG aIPV6MaskPrefixLength);
    8280int NetIfEnableDynamicIpConfig(HostNetworkInterface * pIf);
    8381
  • trunk/src/VBox/Main/linux/NetIfList-linux.cpp

    r17358 r17419  
    159159}
    160160
    161 int NetIfEnableStaticIpConfig(HostNetworkInterface * pIf, ULONG ip, ULONG mask, ULONG gw)
     161int NetIfEnableStaticIpConfig(HostNetworkInterface * pIf, ULONG ip, ULONG mask)
    162162{
    163163    return VERR_NOT_IMPLEMENTED;
    164164}
    165165
    166 int NetIfEnableStaticIpConfigV6(HostNetworkInterface * pIf, IN_BSTR aIPV6Address, ULONG aIPV6MaskPrefixLength, IN_BSTR aIPV6DefaultGateway)
     166int NetIfEnableStaticIpConfigV6(HostNetworkInterface * pIf, IN_BSTR aIPV6Address, ULONG aIPV6MaskPrefixLength)
    167167{
    168168    return VERR_NOT_IMPLEMENTED;
  • trunk/src/VBox/Main/os2/NetIfList-os2.cpp

    r17358 r17419  
    3838}
    3939
    40 int NetIfEnableStaticIpConfig(HostNetworkInterface * pIf, ULONG ip, ULONG mask, ULONG gw)
     40int NetIfEnableStaticIpConfig(HostNetworkInterface * pIf, ULONG ip, ULONG mask)
    4141{
    4242    return VERR_NOT_IMPLEMENTED;
    4343}
    4444
    45 int NetIfEnableStaticIpConfigV6(HostNetworkInterface * pIf, IN_BSTR aIPV6Address, ULONG aIPV6MaskPrefixLength, IN_BSTR aIPV6DefaultGateway)
     45int NetIfEnableStaticIpConfigV6(HostNetworkInterface * pIf, IN_BSTR aIPV6Address, ULONG aIPV6MaskPrefixLength)
    4646{
    4747    return VERR_NOT_IMPLEMENTED;
  • trunk/src/VBox/Main/solaris/NetIfList-solaris.cpp

    r17358 r17419  
    383383#endif
    384384
    385 int NetIfEnableStaticIpConfig(HostNetworkInterface * pIf, ULONG ip, ULONG mask, ULONG gw)
     385int NetIfEnableStaticIpConfig(HostNetworkInterface * pIf, ULONG ip, ULONG mask)
    386386{
    387387    return VERR_NOT_IMPLEMENTED;
    388388}
    389389
    390 int NetIfEnableStaticIpConfigV6(HostNetworkInterface * pIf, IN_BSTR aIPV6Address, ULONG aIPV6MaskPrefixLength, IN_BSTR aIPV6DefaultGateway)
     390int NetIfEnableStaticIpConfigV6(HostNetworkInterface * pIf, IN_BSTR aIPV6Address, ULONG aIPV6MaskPrefixLength)
    391391{
    392392    return VERR_NOT_IMPLEMENTED;
  • trunk/src/VBox/Main/win/NetIfList-win.cpp

    r17380 r17419  
    650650}
    651651
    652 int NetIfEnableStaticIpConfig(HostNetworkInterface * pIf, ULONG ip, ULONG mask, ULONG gw)
     652int NetIfEnableStaticIpConfig(HostNetworkInterface * pIf, ULONG ip, ULONG mask)
    653653{
    654654    HRESULT hr;
     
    677677                    if(SUCCEEDED(hr))
    678678                    {
     679#if 0
    679680                        in_addr aGw[1];
    680681                        aGw[0].S_un.S_addr = gw;
    681682                        hr = netIfWinSetGatewaysV4(pSvc, ObjPath, aGw, 1);
     683                        if(SUCCEEDED(hr))
     684#endif
     685                        {
     686                            hr = netIfWinUpdateConfig(pIf);
     687                        }
     688                    }
     689                    SysFreeString(ObjPath);
     690                }
     691            }
     692        }
     693    }
     694
     695    return SUCCEEDED(hr) ? VINF_SUCCESS : VERR_GENERAL_FAILURE;
     696}
     697
     698int NetIfEnableStaticIpConfigV6(HostNetworkInterface * pIf, IN_BSTR aIPV6Address, IN_BSTR aIPV6Mask, IN_BSTR aIPV6DefaultGateway)
     699{
     700    HRESULT hr;
     701    GUID guid;
     702    hr = pIf->COMGETTER(Id) (&guid);
     703    if(SUCCEEDED(hr))
     704    {
     705        ComPtr <IWbemServices> pSvc;
     706        hr = netIfWinCreateIWbemServices(pSvc.asOutParam());
     707        if(SUCCEEDED(hr))
     708        {
     709            ComPtr <IWbemClassObject> pAdapterConfig;
     710            hr = netIfWinFindAdapterClassById(pSvc, &guid, pAdapterConfig.asOutParam());
     711            if(SUCCEEDED(hr))
     712            {
     713                BSTR ObjPath;
     714                hr = netIfWinAdapterConfigPath(pAdapterConfig, &ObjPath);
     715                if(SUCCEEDED(hr))
     716                {
     717                    hr = netIfWinEnableStaticV4V6(pSvc, ObjPath, aIPV6Address, aIPV6Mask);
     718                    if(SUCCEEDED(hr))
     719                    {
     720                        if(aIPV6DefaultGateway)
     721                        {
     722                            hr = netIfWinSetGatewaysV4V6(pSvc, ObjPath, aIPV6DefaultGateway);
     723                        }
    682724                        if(SUCCEEDED(hr))
    683725                        {
     
    694736}
    695737
    696 int NetIfEnableStaticIpConfigV6(HostNetworkInterface * pIf, IN_BSTR aIPV6Address, IN_BSTR aIPV6Mask, IN_BSTR aIPV6DefaultGateway)
    697 {
    698     HRESULT hr;
    699     GUID guid;
    700     hr = pIf->COMGETTER(Id) (&guid);
    701     if(SUCCEEDED(hr))
    702     {
    703         ComPtr <IWbemServices> pSvc;
    704         hr = netIfWinCreateIWbemServices(pSvc.asOutParam());
    705         if(SUCCEEDED(hr))
    706         {
    707             ComPtr <IWbemClassObject> pAdapterConfig;
    708             hr = netIfWinFindAdapterClassById(pSvc, &guid, pAdapterConfig.asOutParam());
    709             if(SUCCEEDED(hr))
    710             {
    711                 BSTR ObjPath;
    712                 hr = netIfWinAdapterConfigPath(pAdapterConfig, &ObjPath);
    713                 if(SUCCEEDED(hr))
    714                 {
    715                     hr = netIfWinEnableStaticV4V6(pSvc, ObjPath, aIPV6Address, aIPV6Mask);
    716                     if(SUCCEEDED(hr))
    717                     {
    718                         hr = netIfWinSetGatewaysV4V6(pSvc, ObjPath, aIPV6DefaultGateway);
    719                         if(SUCCEEDED(hr))
    720                         {
    721                             hr = netIfWinUpdateConfig(pIf);
    722                         }
    723                     }
    724                     SysFreeString(ObjPath);
    725                 }
    726             }
    727         }
    728     }
    729 
    730     return SUCCEEDED(hr) ? VINF_SUCCESS : VERR_GENERAL_FAILURE;
    731 }
    732 
    733 int NetIfEnableStaticIpConfigV6(HostNetworkInterface * pIf, IN_BSTR aIPV6Address, ULONG aIPV6MaskPrefixLength, IN_BSTR aIPV6DefaultGateway)
     738int NetIfEnableStaticIpConfigV6(HostNetworkInterface * pIf, IN_BSTR aIPV6Address, ULONG aIPV6MaskPrefixLength)
    734739{
    735740    RTNETADDRIPV6 Mask;
     
    738743    {
    739744        Bstr maskStr = composeIPv6Address(&Mask);
    740         rc = NetIfEnableStaticIpConfigV6(pIf, aIPV6Address, maskStr, aIPV6DefaultGateway);
     745        rc = NetIfEnableStaticIpConfigV6(pIf, aIPV6Address, maskStr, NULL);
    741746    }
    742747    return rc;
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