VirtualBox

Changeset 17275 in vbox


Ignore:
Timestamp:
Mar 3, 2009 1:28:12 PM (16 years ago)
Author:
vboxsync
Message:

networking API renaming

Location:
trunk/src/VBox
Files:
24 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxBFE/NetworkAdapterImpl.cpp

    r8155 r17275  
    306306}
    307307STDMETHODIMP
    308 NetworkAdapter::AttachToHostInterface()
     308NetworkAdapter::AttachToBridgedNetwork()
    309309{
    310310  AssertMsg(0,("Not implemented yet\n"));
  • trunk/src/VBox/Frontends/VBoxBFE/NetworkAdapterImpl.h

    r8155 r17275  
    107107    // INetworkAdapter methods
    108108    STDMETHOD(AttachToNAT)();
    109     STDMETHOD(AttachToHostInterface)();
     109    STDMETHOD(AttachToBridgedNetwork)();
    110110    STDMETHOD(AttachToInternalNetwork)();
    111111    STDMETHOD(Detach)();
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp

    r17260 r17275  
    683683                        break;
    684684                    }
    685                     case NetworkAttachmentType_HostInterface:
     685                    case NetworkAttachmentType_Bridged:
    686686                    {
    687687                        Bstr strHostIfDev;
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageList.cpp

    r17255 r17275  
    4444
    4545#ifdef VBOX_WITH_HOSTNETIF_API
    46 static const char *getHostIfTypeText(HostNetworkInterfaceType_T enmType)
     46static const char *getHostIfTypeText(HostNetworkInterfaceMediumType_T enmType)
    4747{
    4848    switch (enmType)
    4949    {
    50         case HostNetworkInterfaceType_Ethernet: return "Ethernet";
    51         case HostNetworkInterfaceType_PPP: return "PPP";
    52         case HostNetworkInterfaceType_SLIP: return "SLIP";
     50        case HostNetworkInterfaceMediumType_Ethernet: return "Ethernet";
     51        case HostNetworkInterfaceMediumType_PPP: return "PPP";
     52        case HostNetworkInterfaceMediumType_SLIP: return "SLIP";
    5353    }
    5454    return "Unknown";
     
    326326                networkInterface->COMGETTER(HardwareAddress)(HardwareAddress.asOutParam());
    327327                RTPrintf("HardwareAddress: %lS\n", HardwareAddress.raw());
    328                 HostNetworkInterfaceType_T Type;
    329                 networkInterface->COMGETTER(Type)(&Type);
     328                HostNetworkInterfaceMediumType_T Type;
     329                networkInterface->COMGETTER(MediumType)(&Type);
    330330                RTPrintf("Type:            %s\n", getHostIfTypeText(Type));
    331331                HostNetworkInterfaceStatus_T Status;
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp

    r17255 r17275  
    13841384                {
    13851385                    CHECK_ERROR_RET(nic, COMSETTER(Enabled) (TRUE), 1);
    1386                     CHECK_ERROR_RET(nic, AttachToHostInterface(), 1);
     1386                    CHECK_ERROR_RET(nic, AttachToBridgedNetwork(), 1);
    13871387                }
    13881388                else if (strcmp(nics[n], "intnet") == 0)
     
    13911391                    CHECK_ERROR_RET(nic, AttachToInternalNetwork(), 1);
    13921392                }
    1393 #if defined(RT_OS_LINUX) || defined(RT_OS_DARWIN)
     1393#if defined(RT_OS_LINUX) || defined(RT_OS_DARWIN) || (defined(RT_OS_WINDOWS) && defined(VBOX_WITH_NETFLT))
    13941394                else if (strcmp(nics[n], "hostonly") == 0)
    13951395                {
    13961396                    CHECK_ERROR_RET(nic, COMSETTER(Enabled) (TRUE), 1);
    1397                     CHECK_ERROR_RET(nic, AttachToHostOnlyNetwork(), 1);
     1397                    CHECK_ERROR_RET(nic, AttachToHostOnlyInterface(), 1);
    13981398                }
    13991399#endif /* defined(RT_OS_LINUX) || defined(RT_OS_DARWIN) */
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp

    r17160 r17275  
    23992399                     * an additional symbolic network/interface name field, use
    24002400                     * this name instead */
    2401                     if (type == KNetworkAttachmentType_HostInterface)
     2401                    if (type == KNetworkAttachmentType_Bridged)
    24022402                        attType = attType.arg (tr ("host interface, %1",
    24032403                            "details report (network)").arg (adapter.GetHostInterface()));
     
    34183418    mNetworkAttachmentTypes [KNetworkAttachmentType_NAT] =
    34193419        tr ("NAT", "NetworkAttachmentType");
    3420     mNetworkAttachmentTypes [KNetworkAttachmentType_HostInterface] =
    3421         tr ("Host Interface", "NetworkAttachmentType");
     3420    mNetworkAttachmentTypes [KNetworkAttachmentType_Bridged] =
     3421        tr ("Bridged Interface", "NetworkAttachmentType");
    34223422    mNetworkAttachmentTypes [KNetworkAttachmentType_Internal] =
    34233423        tr ("Internal Network", "NetworkAttachmentType");
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsNetwork.cpp

    r17217 r17275  
    130130            mAdapter.AttachToNAT();
    131131            break;
    132         case KNetworkAttachmentType_HostInterface:
    133             mAdapter.AttachToHostInterface();
     132        case KNetworkAttachmentType_Bridged:
     133            mAdapter.AttachToBridgedNetwork();
    134134            break;
    135135        case KNetworkAttachmentType_Internal:
     
    148148    mAdapter.SetCableConnected (mCbCable->isChecked());
    149149
    150     if (type == KNetworkAttachmentType_HostInterface
     150    if (type == KNetworkAttachmentType_Bridged
    151151#if defined (Q_WS_WIN) && defined (VBOX_WITH_NETFLT)
    152152            || type == KNetworkAttachmentType_HostOnly
     
    257257#if defined (Q_WS_X11) && !defined (VBOX_WITH_NETFLT)
    258258    bool enableHostIf = vboxGlobal().toNetworkAttachmentType (aString) ==
    259                         KNetworkAttachmentType_HostInterface;
     259                        KNetworkAttachmentType_Bridged;
    260260    setTapEnabled (enableHostIf);
    261261#endif
     
    312312        mCbNAType->itemText(1), Qt::ToolTipRole);
    313313    mCbNAType->insertItem (2,
    314         vboxGlobal().toString (KNetworkAttachmentType_HostInterface));
     314        vboxGlobal().toString (KNetworkAttachmentType_Bridged));
    315315    mCbNAType->setItemData (2,
    316316        mCbNAType->itemText(2), Qt::ToolTipRole);
     
    555555    CHost host = vboxGlobal().virtualBox().GetHost();
    556556    CHostNetworkInterface iFace;
    557     CProgress progress = host.CreateHostNetworkInterface (iName, iFace);
     557    CProgress progress = host.CreateHostOnlyNetworkInterface (iName, iFace);
    558558    if (host.isOk())
    559559    {
     
    614614    {
    615615        /* Delete interface */
    616         CProgress progress = host.RemoveHostNetworkInterface (iFace.GetId(), iFace);
     616        CProgress progress = host.RemoveHostOnlyNetworkInterface (iFace.GetId(), iFace);
    617617        if (host.isOk())
    618618        {
     
    673673#if defined(Q_WS_WIN) && defined(VBOX_WITH_NETFLT)
    674674        /* display real for not host-only and viceversa */
    675         if((enmAttachmentType == KNetworkAttachmentType_HostOnly) != it->GetReal())
     675        if((enmAttachmentType == KNetworkAttachmentType_HostOnly)
     676                == (it->GetInterfaceType() == KHostNetworkInterfaceType_HostOnly))
    676677#endif
    677678            itemsList << new VBoxNIListItem (it->GetName());
     
    807808
    808809#if defined (Q_WS_WIN) || defined (VBOX_WITH_NETFLT)
    809         if ((type == KNetworkAttachmentType_HostInterface
     810        if ((type == KNetworkAttachmentType_Bridged
    810811#if defined (Q_WS_WIN) && defined (VBOX_WITH_NETFLT)
    811812                || type == KNetworkAttachmentType_HostOnly
     
    885886    KNetworkAttachmentType enmType = vboxGlobal().toNetworkAttachmentType (page->mCbNAType->currentText());
    886887
    887     bool isHostInterfaceAttached = enmType == KNetworkAttachmentType_HostInterface;
     888    bool isHostInterfaceAttached = enmType == KNetworkAttachmentType_Bridged;
    888889
    889890    mNIList->setEnabled (isHostInterfaceAttached);
  • trunk/src/VBox/Main/ConsoleImpl.cpp

    r17217 r17275  
    42394239        switch (netattach)
    42404240        {
    4241             case NetworkAttachmentType_HostInterface:
     4241            case NetworkAttachmentType_Bridged:
    42424242            {
    42434243#ifdef RT_OS_WINDOWS
     
    56575657 *  @note The caller must lock this object for writing.
    56585658 */
    5659 HRESULT Console::attachToHostInterface(INetworkAdapter *networkAdapter)
     5659HRESULT Console::attachToBridgedInterface(INetworkAdapter *networkAdapter)
    56605660{
    56615661#if !defined(RT_OS_LINUX) || defined(VBOX_WITH_NETFLT)
     
    56795679    NetworkAttachmentType_T attachment;
    56805680    networkAdapter->COMGETTER(AttachmentType)(&attachment);
    5681     Assert(attachment == NetworkAttachmentType_HostInterface);
     5681    Assert(attachment == NetworkAttachmentType_Bridged);
    56825682# endif /* VBOX_STRICT */
    56835683
     
    57355735            if (fcntl(maTapFD[slot], F_SETFL, O_NONBLOCK) != -1)
    57365736            {
    5737                 Log(("attachToHostInterface: %RTfile %ls\n", maTapFD[slot], tapDeviceName.raw()));
     5737                Log(("attachToBridgedInterface: %RTfile %ls\n", maTapFD[slot], tapDeviceName.raw()));
    57385738                /*
    57395739                 * Here is the right place to communicate the TAP file descriptor and
     
    57885788 *  @note The caller must lock this object for writing.
    57895789 */
    5790 HRESULT Console::detachFromHostInterface(INetworkAdapter *networkAdapter)
     5790HRESULT Console::detachFromBridgedInterface(INetworkAdapter *networkAdapter)
    57915791{
    57925792#if !defined(RT_OS_LINUX) || defined(VBOX_WITH_NETFLT)
     
    58085808    NetworkAttachmentType_T attachment;
    58095809    networkAdapter->COMGETTER(AttachmentType)(&attachment);
    5810     Assert(attachment == NetworkAttachmentType_HostInterface);
     5810    Assert(attachment == NetworkAttachmentType_Bridged);
    58115811# endif /* VBOX_STRICT */
    58125812
     
    58805880        NetworkAttachmentType_T attachment;
    58815881        networkAdapter->COMGETTER(AttachmentType)(&attachment);
    5882         if (attachment == NetworkAttachmentType_HostInterface)
    5883         {
    5884             HRESULT rc2 = detachFromHostInterface(networkAdapter);
     5882        if (attachment == NetworkAttachmentType_Bridged)
     5883        {
     5884            HRESULT rc2 = detachFromBridgedInterface(networkAdapter);
    58855885            if (FAILED(rc2) && SUCCEEDED(rc))
    58865886                rc = rc2;
  • trunk/src/VBox/Main/ConsoleImpl2.cpp

    r17230 r17275  
    12921292            }
    12931293
    1294             case NetworkAttachmentType_HostInterface:
     1294            case NetworkAttachmentType_Bridged:
    12951295            {
    12961296                /*
    12971297                 * Perform the attachment if required (don't return on error!)
    12981298                 */
    1299                 hrc = pConsole->attachToHostInterface(networkAdapter);
     1299                hrc = pConsole->attachToBridgedInterface(networkAdapter);
    13001300                if (SUCCEEDED(hrc))
    13011301                {
     
    13331333                    if(FAILED(hrc))
    13341334                    {
    1335                         LogRel(("NetworkAttachmentType_HostInterface: COMGETTER(HostInterface) failed, hrc (0x%x)", hrc));
     1335                        LogRel(("NetworkAttachmentType_Bridged: COMGETTER(HostInterface) failed, hrc (0x%x)", hrc));
    13361336                        H();
    13371337                    }
     
    13821382                    {
    13831383                        AssertBreakpoint();
    1384                         LogRel(("NetworkAttachmentType_HostInterface: FindByName failed, rc (0x%x)", rc));
     1384                        LogRel(("NetworkAttachmentType_Bridged: FindByName failed, rc (0x%x)", rc));
    13851385                        return VMSetError(pVM, VERR_INTERNAL_ERROR, RT_SRC_POS,
    13861386                                          N_("Inexistent host networking interface, name '%ls'"),
     
    13881388                    }
    13891389
    1390                     BOOL real;
    1391                     hrc = hostInterface->COMGETTER(Real)(&real);
     1390                    HostNetworkInterfaceType_T ifType;
     1391                    hrc = hostInterface->COMGETTER(InterfaceType)(&ifType);
    13921392                    if(FAILED(hrc))
    13931393                    {
    1394                         LogRel(("NetworkAttachmentType_HostOnly: COMGETTER(Real) failed, hrc (0x%x)", hrc));
     1394                        LogRel(("NetworkAttachmentType_Bridged: COMGETTER(InterfaceType) failed, hrc (0x%x)", hrc));
    13951395                        H();
    13961396                    }
    13971397
    1398                     if(!real)
    1399                     {
    1400                         LogRel(("NetworkAttachmentType_HostOnly: COMGETTER(Real) failed, hrc (0x%x)", hrc));
     1398                    if(ifType != HostNetworkInterfaceType_Bridged)
     1399                    {
    14011400                        return VMSetError(pVM, VERR_INTERNAL_ERROR, RT_SRC_POS,
    1402                                                               N_("Interface ('%ls') is a Host Adapter interface"),
     1401                                                              N_("Interface ('%ls') is not a Bridged Adapter interface"),
    14031402                                                              HifName.raw());
    14041403                    }
     
    14081407                    if(FAILED(hrc))
    14091408                    {
    1410                         LogRel(("NetworkAttachmentType_HostInterface: COMGETTER(Id) failed, hrc (0x%x)", hrc));
     1409                        LogRel(("NetworkAttachmentType_Bridged: COMGETTER(Id) failed, hrc (0x%x)", hrc));
    14111410                        H();
    14121411                    }
     
    16911690                }
    16921691
    1693                 BOOL real;
    1694                 hrc = hostInterface->COMGETTER(Real)(&real);
     1692                HostNetworkInterfaceType_T ifType;
     1693                hrc = hostInterface->COMGETTER(InterfaceType)(&ifType);
    16951694                if(FAILED(hrc))
    16961695                {
    1697                     LogRel(("NetworkAttachmentType_HostOnly: COMGETTER(Real) failed, hrc (0x%x)", hrc));
     1696                    LogRel(("NetworkAttachmentType_HostOnly: COMGETTER(InterfaceType) failed, hrc (0x%x)", hrc));
    16981697                    H();
    16991698                }
    17001699
    1701                 if(real)
     1700                if(ifType != HostNetworkInterfaceType_HostOnly)
    17021701                {
    1703                     LogRel(("NetworkAttachmentType_HostOnly: COMGETTER(Real) failed, hrc (0x%x)", hrc));
    17041702                    return VMSetError(pVM, VERR_INTERNAL_ERROR, RT_SRC_POS,
    1705                                                           N_("Interface ('%ls') is not a Host Adapter interface"),
     1703                                                          N_("Interface ('%ls') is not a Host-Only Adapter interface"),
    17061704                                                          HifName.raw());
    17071705                }
     1706
    17081707
    17091708                Guid hostIFGuid;
  • trunk/src/VBox/Main/HostImpl.cpp

    r17255 r17275  
    610610    ComObjPtr<HostNetworkInterface> IfObj;
    611611    IfObj.createObject();
    612     if (SUCCEEDED(IfObj->init(Bstr(szNICDesc), Guid(Uuid), true)))
     612    if (SUCCEEDED(IfObj->init(Bstr(szNICDesc), Guid(Uuid), HostNetworkInterfaceType_Bridged)))
    613613        pList->push_back(IfObj);
    614614}
     
    725725            iface.createObject();
    726726            /* remove the curly bracket at the end */
    727             if (SUCCEEDED (iface->init (name, Guid (IfGuid), true)))
     727            if (SUCCEEDED (iface->init (name, Guid (IfGuid), HostNetworkInterfaceType_Bridged)))
    728728            {
    729729                pPist->push_back (iface);
     
    771771        ComObjPtr<HostNetworkInterface> IfObj;
    772772        IfObj.createObject();
    773         if (SUCCEEDED(IfObj->init(Bstr(pEtherNICs->szName), Guid(pEtherNICs->Uuid), true)))
     773        if (SUCCEEDED(IfObj->init(Bstr(pEtherNICs->szName), Guid(pEtherNICs->Uuid), HostNetworkInterfaceType_Bridged)))
    774774            list.push_back(IfObj);
    775775
     
    926926                    /* remove the curly bracket at the end */
    927927                    szNetworkGUID [strlen(szNetworkGUID) - 1] = '\0';
    928                     if (SUCCEEDED (iface->init (name, Guid (szNetworkGUID + 1), true)))
     928                    if (SUCCEEDED (iface->init (name, Guid (szNetworkGUID + 1), HostNetworkInterfaceType_Bridged)))
    929929                        list.push_back (iface);
    930930                }
     
    10521052                        ComObjPtr<HostNetworkInterface> IfObj;
    10531053                        IfObj.createObject();
    1054                         if (SUCCEEDED(IfObj->init(Bstr(pReq->ifr_name), Guid(uuid), true)))
     1054                        if (SUCCEEDED(IfObj->init(Bstr(pReq->ifr_name), Guid(uuid), HostNetworkInterfaceType_Bridged)))
    10551055                            list.push_back(IfObj);
    10561056                    }
     
    13591359{
    13601360    SVCHlpMsg::Code msgCode;
    1361     /* for SVCHlpMsg::CreateHostNetworkInterface */
     1361    /* for SVCHlpMsg::CreateHostOnlyNetworkInterface */
    13621362    Bstr name;
    13631363    ComObjPtr <HostNetworkInterface> iface;
    1364     /* for SVCHlpMsg::RemoveHostNetworkInterface */
     1364    /* for SVCHlpMsg::RemoveHostOnlyNetworkInterface */
    13651365    Guid guid;
    13661366};
    13671367
    13681368STDMETHODIMP
    1369 Host::CreateHostNetworkInterface (IN_BSTR aName,
     1369Host::CreateHostOnlyNetworkInterface (IN_BSTR aName,
    13701370                                  IHostNetworkInterface **aHostNetworkInterface,
    13711371                                  IProgress **aProgress)
     
    14071407    AssertReturn (d.get(), E_OUTOFMEMORY);
    14081408
    1409     d->msgCode = SVCHlpMsg::CreateHostNetworkInterface;
     1409    d->msgCode = SVCHlpMsg::CreateHostOnlyNetworkInterface;
    14101410    d->name = aName;
    14111411    d->iface = iface;
     
    14271427
    14281428STDMETHODIMP
    1429 Host::RemoveHostNetworkInterface (IN_GUID aId,
     1429Host::RemoveHostOnlyNetworkInterface (IN_GUID aId,
    14301430                                  IHostNetworkInterface **aHostNetworkInterface,
    14311431                                  IProgress **aProgress)
     
    14651465    AssertReturn (d.get(), E_OUTOFMEMORY);
    14661466
    1467     d->msgCode = SVCHlpMsg::RemoveHostNetworkInterface;
     1467    d->msgCode = SVCHlpMsg::RemoveHostOnlyNetworkInterface;
    14681468    d->guid = aId;
    14691469
     
    30053005    switch (d->msgCode)
    30063006    {
    3007         case SVCHlpMsg::CreateHostNetworkInterface:
    3008         {
    3009             LogFlowFunc (("CreateHostNetworkInterface:\n"));
     3007        case SVCHlpMsg::CreateHostOnlyNetworkInterface:
     3008        {
     3009            LogFlowFunc (("CreateHostOnlyNetworkInterface:\n"));
    30103010            LogFlowFunc (("Network connection name = '%ls'\n", d->name.raw()));
    30113011
     
    30273027                switch (reply)
    30283028                {
    3029                     case SVCHlpMsg::CreateHostNetworkInterface_OK:
     3029                    case SVCHlpMsg::CreateHostOnlyNetworkInterface_OK:
    30303030                    {
    30313031                        /* read the GUID */
     
    30373037
    30383038                        /* initialize the object returned to the caller by
    3039                          * CreateHostNetworkInterface() */
    3040                         rc = d->iface->init (d->name, guid, false);
     3039                         * CreateHostOnlyNetworkInterface() */
     3040                        rc = d->iface->init (d->name, guid, HostNetworkInterfaceType_HostOnly);
    30413041                        endLoop = true;
    30423042                        break;
     
    30663066            break;
    30673067        }
    3068         case SVCHlpMsg::RemoveHostNetworkInterface:
    3069         {
    3070             LogFlowFunc (("RemoveHostNetworkInterface:\n"));
     3068        case SVCHlpMsg::RemoveHostOnlyNetworkInterface:
     3069        {
     3070            LogFlowFunc (("RemoveHostOnlyNetworkInterface:\n"));
    30713071            LogFlowFunc (("Network connection GUID = {%RTuuid}\n", d->guid.raw()));
    30723072
     
    31473147    switch (aMsgCode)
    31483148    {
    3149         case SVCHlpMsg::CreateHostNetworkInterface:
    3150         {
    3151             LogFlowFunc (("CreateHostNetworkInterface:\n"));
     3149        case SVCHlpMsg::CreateHostOnlyNetworkInterface:
     3150        {
     3151            LogFlowFunc (("CreateHostOnlyNetworkInterface:\n"));
    31523152
    31533153            Utf8Str name;
     
    31623162            {
    31633163                /* write success followed by GUID */
    3164                 vrc = aClient->write (SVCHlpMsg::CreateHostNetworkInterface_OK);
     3164                vrc = aClient->write (SVCHlpMsg::CreateHostOnlyNetworkInterface_OK);
    31653165                if (RT_FAILURE (vrc)) break;
    31663166                vrc = aClient->write (guid);
     
    31803180            break;
    31813181        }
    3182         case SVCHlpMsg::RemoveHostNetworkInterface:
    3183         {
    3184             LogFlowFunc (("RemoveHostNetworkInterface:\n"));
     3182        case SVCHlpMsg::RemoveHostOnlyNetworkInterface:
     3183        {
     3184            LogFlowFunc (("RemoveHostOnlyNetworkInterface:\n"));
    31853185
    31863186            Guid guid;
     
    34593459}
    34603460
     3461STDMETHODIMP Host::FindHostNetworkInterfacesOfType(HostNetworkInterfaceType type, ComSafeArrayOut (IHostNetworkInterface *, aNetworkInterfaces))
     3462{
     3463    com::SafeIfaceArray <IHostNetworkInterface> hostNetworkInterfaces;
     3464    HRESULT hr = COMGETTER(NetworkInterfaces) (ComSafeArrayAsOutParam (hostNetworkInterfaces));
     3465    if(FAILED(hr))
     3466    {
     3467        return hr;
     3468    }
     3469
     3470    std::list <ComObjPtr <IHostNetworkInterface> > list;
     3471
     3472    for (size_t i = 0; i < hostNetworkInterfaces.size(); ++i)
     3473    {
     3474        IHostNetworkInterface * networkInterface = hostNetworkInterfaces[i];
     3475        HostNetworkInterfaceType t;
     3476        hr = networkInterface->COMGETTER(InterfaceType)(&t);
     3477        if(FAILED(hr))
     3478        {
     3479            return hr;
     3480        }
     3481
     3482        if(t == type)
     3483        {
     3484            list.push_back (networkInterface);
     3485        }
     3486    }
     3487
     3488    SafeIfaceArray <IHostNetworkInterface> filteredNetworkInterfaces (list);
     3489    filteredNetworkInterfaces.detachTo (ComSafeArrayOutArg (aNetworkInterfaces));
     3490
     3491    return S_OK;
     3492}
     3493
     3494
    34613495/* vi: set tabstop=4 shiftwidth=4 expandtab: */
  • trunk/src/VBox/Main/HostNetworkInterfaceImpl.cpp

    r16967 r17275  
    5151 * @param   aGuid GUID of the host network interface
    5252 */
    53 HRESULT HostNetworkInterface::init (Bstr aInterfaceName, Guid aGuid, BOOL aReal)
     53HRESULT HostNetworkInterface::init (Bstr aInterfaceName, Guid aGuid, HostNetworkInterfaceType_T ifType)
    5454{
    5555    LogFlowThisFunc (("aInterfaceName={%ls}, aGuid={%s}\n",
     
    6565    unconst (mInterfaceName) = aInterfaceName;
    6666    unconst (mGuid) = aGuid;
    67     mReal = aReal;
     67    mIfType = ifType;
    6868
    6969
     
    112112 * @param   aGuid GUID of the host network interface
    113113 */
    114 HRESULT HostNetworkInterface::init (Bstr aInterfaceName, BOOL aReal, PNETIFINFO pIf)
     114HRESULT HostNetworkInterface::init (Bstr aInterfaceName, HostNetworkInterfaceType_T ifType, PNETIFINFO pIf)
    115115{
    116116//    LogFlowThisFunc (("aInterfaceName={%ls}, aGuid={%s}\n",
     
    127127    unconst (mInterfaceName) = aInterfaceName;
    128128    unconst (mGuid) = pIf->Uuid;
    129     mReal = aReal;
     129    mIfType = ifType;
    130130
    131131    m.IPAddress = pIf->IPAddress.u;
     
    135135    m.hardwareAddress = composeHardwareAddress(&pIf->MACAddress);
    136136#ifdef RT_OS_WINDOWS
    137     m.type = (HostNetworkInterfaceType)pIf->enmType;
     137    m.mediumType = (HostNetworkInterfaceMediumType)pIf->enmMediumType;
    138138    m.status = (HostNetworkInterfaceStatus)pIf->enmStatus;
    139139#else /* !RT_OS_WINDOWS */
     
    285285 * @param   aType address of result pointer
    286286 */
    287 STDMETHODIMP HostNetworkInterface::COMGETTER(Type) (HostNetworkInterfaceType_T *aType)
     287STDMETHODIMP HostNetworkInterface::COMGETTER(MediumType) (HostNetworkInterfaceMediumType_T *aType)
    288288{
    289289    CheckComArgOutPointerValid(aType);
     
    292292    CheckComRCReturnRC (autoCaller.rc());
    293293
    294     *aType = m.type;
     294    *aType = m.mediumType;
    295295
    296296    return S_OK;
     
    316316
    317317/**
    318  * Returns true if this is a "real" adapter, false if this is  a Virtualbox Host Adapter
    319  *
    320  * @returns COM status code
    321  * @param   aReal address of result pointer
    322  */
    323 STDMETHODIMP HostNetworkInterface::COMGETTER(Real) (BOOL *aReal)
    324 {
    325     CheckComArgOutPointerValid(aReal);
    326 
    327     AutoCaller autoCaller (this);
    328     CheckComRCReturnRC (autoCaller.rc());
    329 
    330     *aReal = mReal;
     318 * Returns network interface type
     319 *
     320 * @returns COM status code
     321 * @param   aType address of result pointer
     322 */
     323STDMETHODIMP HostNetworkInterface::COMGETTER(InterfaceType) (HostNetworkInterfaceType_T *aType)
     324{
     325    CheckComArgOutPointerValid(aType);
     326
     327    AutoCaller autoCaller (this);
     328    CheckComRCReturnRC (autoCaller.rc());
     329
     330    *aType = mIfType;
    331331
    332332    return S_OK;
  • trunk/src/VBox/Main/NetworkAdapterImpl.cpp

    r16967 r17275  
    713713}
    714714
    715 STDMETHODIMP NetworkAdapter::AttachToHostInterface()
     715STDMETHODIMP NetworkAdapter::AttachToBridgedNetwork()
    716716{
    717717    AutoCaller autoCaller (this);
     
    725725
    726726    /* don't do anything if we're already host interface attached */
    727     if (mData->mAttachmentType != NetworkAttachmentType_HostInterface)
     727    if (mData->mAttachmentType != NetworkAttachmentType_Bridged)
    728728    {
    729729        mData.backup();
     
    732732        detach();
    733733
    734         mData->mAttachmentType = NetworkAttachmentType_HostInterface;
     734        mData->mAttachmentType = NetworkAttachmentType_Bridged;
    735735
    736736        /* leave the lock before informing callbacks */
     
    925925        CheckComRCReturnRC (rc);
    926926
    927         rc = AttachToHostInterface();
     927        rc = AttachToBridgedNetwork();
    928928        CheckComRCReturnRC (rc);
    929929    }
     
    10341034            break;
    10351035        }
    1036         case NetworkAttachmentType_HostInterface:
     1036        case NetworkAttachmentType_Bridged:
    10371037        {
    10381038            Key attachmentNode = aAdapterNode.createKey ("HostInterface");
     
    12001200            break;
    12011201        }
    1202         case NetworkAttachmentType_HostInterface:
     1202        case NetworkAttachmentType_Bridged:
    12031203        {
    12041204            /* reset handle and device name */
  • trunk/src/VBox/Main/darwin/NetIfList-darwin.cpp

    r16968 r17275  
    6868        PNETIFINFO pNew = (PNETIFINFO)RTMemAllocZ(RT_OFFSETOF(NETIFINFO, szName[cbNameLen]));
    6969        pNew->MACAddress = pEtherNICs->Mac;
    70         pNew->enmType = NETIF_T_ETHERNET;
     70        pNew->enmMediumType = NETIF_T_ETHERNET;
    7171        pNew->Uuid = pEtherNICs->Uuid;
    7272        Assert(sizeof(pNew->szShortName) > sizeof(pEtherNICs->szBSDName));
     
    126126        ComObjPtr<HostNetworkInterface> IfObj;
    127127        IfObj.createObject();
    128         if (SUCCEEDED(IfObj->init(Bstr(pEtherNICs->szName), TRUE, pNew)))
     128        if (SUCCEEDED(IfObj->init(Bstr(pEtherNICs->szName), HostNetworkInterfaceType_Bridged, pNew)))
    129129            list.push_back(IfObj);
    130130        RTMemFree(pNew);
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r17273 r17275  
    63646364
    63656365  <enum
    6366     name="HostNetworkInterfaceType"
    6367     uuid="763754FA-3246-4539-9590-9E603EDBF706"
     6366    name="HostNetworkInterfaceMediumType"
     6367    uuid="1aa54aaf-2497-45a2-bfb1-8eb225e93d5b"
    63686368  >
    63696369    <desc>
     
    64216421  </enum>
    64226422
     6423  <enum
     6424    name="HostNetworkInterfaceType"
     6425    uuid="4cd97025-b31b-430b-98dd-211e85cf389f"
     6426  >
     6427    <desc>
     6428      Network interface type.
     6429    </desc>
     6430    <const name="Bridged"               value="1"/>
     6431    <const name="HostOnly"              value="2"/>
     6432  </enum>
     6433
    64236434  <interface
    64246435     name="IHostNetworkInterface" extends="$unknown"
    6425      uuid="4fc2445f-fb73-4f55-b3b4-ecee47c7077b"
     6436     uuid="c312bf73-b353-4add-9db7-481b891ec08c"
    64266437     wsmap="managed"
    64276438     >
     
    64606471    </attribute>
    64616472
    6462     <attribute name="type" type="HostNetworkInterfaceType" readonly="yes">
     6473    <attribute name="mediumType" type="HostNetworkInterfaceMediumType" readonly="yes">
    64636474      <desc>Type of protocol encapsulation used.</desc>
    64646475    </attribute>
     
    64686479    </attribute>
    64696480
    6470     <attribute name="real" type="boolean" readonly="yes">
    6471       <desc>True if this is a real interface false
    6472       if this is a Virtualbox Host Adapter interface.</desc>
     6481    <attribute name="interfaceType" type="HostNetworkInterfaceType" readonly="yes">
     6482      <desc>specifies the host interface type.</desc>
    64736483    </attribute>
    64746484  </interface>
     
    64766486  <interface
    64776487     name="IHost" extends="$unknown"
    6478      uuid="234a43b3-66a5-4f15-a2a5-c46dbf4c4508"
     6488     uuid="96128709-69b5-43cc-9393-b3895f3b866a"
    64796489     wsmap="managed"
    64806490     >
     
    66246634
    66256635<if target="midl">
    6626     <method name="createHostNetworkInterface">
    6627       <desc>
    6628         Creates a new adapter for Host Interface Networking.
     6636    <method name="createHostOnlyNetworkInterface">
     6637      <desc>
     6638        Creates a new adapter for Host Only Networking.
    66296639        <result name="E_INVALIDARG">
    66306640          Host network interface @a name already exists.
     
    66476657      </param>
    66486658    </method>
    6649     <method name="removeHostNetworkInterface">
    6650       <desc>
    6651         Removes the given host network interface.
     6659    <method name="removeHostOnlyNetworkInterface">
     6660      <desc>
     6661        Removes the given Host Only Networking interface.
    66526662        <result name="VBOX_E_OBJECT_NOT_FOUND">
    66536663          No host network interface matching @a id found.
     
    68306840      <param name="networkInterface" type="IHostNetworkInterface" dir="return">
    68316841        <desc>Found host network interface object.</desc>
     6842      </param>
     6843    </method>
     6844    <method name="findHostNetworkInterfacesOfType">
     6845      <desc>
     6846        Searches through all host network interfaces and returns a list of interfaces of the specified type
     6847      </desc>
     6848      <param name="type" type="HostNetworkInterfaceType" dir="in">
     6849        <desc>type of the host network interfaces to search for.</desc>
     6850      </param>
     6851      <param name="networkInterfaces" type="IHostNetworkInterface" safearray="yes" dir="return">
     6852        <desc>Found host network interface objects.</desc>
    68326853      </param>
    68336854    </method>
     
    1029010311  <enum
    1029110312    name="NetworkAttachmentType"
    10292     uuid="64e770dc-dd1d-4879-9f12-5bd6bc879b78"
     10313    uuid="44bce1ee-99f7-4e8e-89fc-80597fd9eeaf"
    1029310314  >
    1029410315    <desc>
     
    1030010321    </const>
    1030110322    <const name="NAT"                   value="1"/>
    10302     <const name="HostInterface"         value="2"/>
     10323    <const name="Bridged"               value="2"/>
    1030310324    <const name="Internal"              value="3"/>
    1030410325    <const name="HostOnly"              value="4"/>
     
    1032410345  <interface
    1032510346     name="INetworkAdapter" extends="$unknown"
    10326      uuid="4a1ee64e-6c5f-47dd-acfa-f834d7cb74fb"
     10347     uuid="8eca30de-a883-40ee-b856-aac86f1ec383"
    1032710348     wsmap="managed"
    1032810349     >
     
    1041210433    </method>
    1041310434
    10414     <method name="attachToHostInterface">
    10415       <desc>
    10416         Attach the network adapter to a host interface.
     10435    <method name="attachToBridgedNetwork">
     10436      <desc>
     10437        Attach the network adapter to a bridged host interface.
    1041710438      </desc>
    1041810439    </method>
  • trunk/src/VBox/Main/include/ConsoleImpl.h

    r17217 r17275  
    403403    HRESULT callTapSetupApplication(bool isStatic, RTFILE tapFD, Bstr &tapDevice,
    404404                                    Bstr &tapSetupApplication);
    405     HRESULT attachToHostInterface(INetworkAdapter *networkAdapter);
    406     HRESULT detachFromHostInterface(INetworkAdapter *networkAdapter);
     405    HRESULT attachToBridgedInterface(INetworkAdapter *networkAdapter);
     406    HRESULT detachFromBridgedInterface(INetworkAdapter *networkAdapter);
    407407    HRESULT powerDownHostInterfaces();
    408408
  • trunk/src/VBox/Main/include/HostImpl.h

    r17255 r17275  
    100100#ifdef RT_OS_WINDOWS
    101101
    102     STDMETHOD(CreateHostNetworkInterface) (IN_BSTR aName,
     102    STDMETHOD(CreateHostOnlyNetworkInterface) (IN_BSTR aName,
    103103                                           IHostNetworkInterface **aHostNetworkInterface,
    104104                                           IProgress **aProgress);
    105     STDMETHOD(RemoveHostNetworkInterface) (IN_GUID aId,
     105    STDMETHOD(RemoveHostOnlyNetworkInterface) (IN_GUID aId,
    106106                                           IHostNetworkInterface **aHostNetworkInterface,
    107107                                           IProgress **aProgress);
     
    115115    STDMETHOD(FindHostNetworkInterfaceByName) (IN_BSTR aName, IHostNetworkInterface **networkInterface);
    116116    STDMETHOD(FindHostNetworkInterfaceById) (IN_GUID id, IHostNetworkInterface **networkInterface);
     117    STDMETHOD(FindHostNetworkInterfacesOfType) (HostNetworkInterfaceType type, ComSafeArrayOut (IHostNetworkInterface *, aNetworkInterfaces));
    117118
    118119    // public methods only for internal purposes
  • trunk/src/VBox/Main/include/HostNetworkInterfaceImpl.h

    r16967 r17275  
    6060
    6161    // public initializer/uninitializer for internal purposes only
    62     HRESULT init (Bstr interfaceName, Guid guid, BOOL aReal);
     62    HRESULT init (Bstr interfaceName, Guid guid, HostNetworkInterfaceType_T ifType);
    6363#ifdef VBOX_WITH_HOSTNETIF_API
    64     HRESULT init (Bstr aInterfaceName, BOOL aReal, struct NETIFINFO *pIfs);
     64    HRESULT init (Bstr aInterfaceName, HostNetworkInterfaceType_T ifType, struct NETIFINFO *pIfs);
    6565#endif
    6666
     
    7373    STDMETHOD(COMGETTER(IPV6NetworkMask)) (BSTR *aIPV6Mask);
    7474    STDMETHOD(COMGETTER(HardwareAddress)) (BSTR *aHardwareAddress);
    75     STDMETHOD(COMGETTER(Type)) (HostNetworkInterfaceType_T *aType);
     75    STDMETHOD(COMGETTER(MediumType)) (HostNetworkInterfaceMediumType_T *aType);
    7676    STDMETHOD(COMGETTER(Status)) (HostNetworkInterfaceStatus_T *aStatus);
    77     STDMETHOD(COMGETTER(Real)) (BOOL *aReal);
     77    STDMETHOD(COMGETTER(InterfaceType)) (HostNetworkInterfaceType_T *aType);
    7878
    7979    // for VirtualBoxSupportErrorInfoImpl
     
    8383    const Bstr mInterfaceName;
    8484    const Guid mGuid;
    85     BOOL mReal;
     85    HostNetworkInterfaceType_T mIfType;
    8686
    8787    struct Data
    8888    {
    8989        Data() : IPAddress (0), networkMask (0),
    90             type (HostNetworkInterfaceType_Unknown),
     90            mediumType (HostNetworkInterfaceMediumType_Unknown),
    9191            status(HostNetworkInterfaceStatus_Down){}
    9292
     
    9696        Bstr IPV6NetworkMask;
    9797        Bstr hardwareAddress;
    98         HostNetworkInterfaceType_T type;
     98        HostNetworkInterfaceMediumType_T mediumType;
    9999        HostNetworkInterfaceStatus_T status;
    100100    } m;
  • trunk/src/VBox/Main/include/NetworkAdapterImpl.h

    r16509 r17275  
    127127    // INetworkAdapter methods
    128128    STDMETHOD(AttachToNAT)();
    129     STDMETHOD(AttachToHostInterface)();
     129    STDMETHOD(AttachToBridgedNetwork)();
    130130    STDMETHOD(AttachToInternalNetwork)();
    131131    STDMETHOD(AttachToHostOnlyNetwork)();
  • trunk/src/VBox/Main/include/netif.h

    r16967 r17275  
    6262    RTNETADDRIPV6  IPv6NetMask;
    6363    RTMAC          MACAddress;
    64     NETIFTYPE      enmType;
     64    NETIFTYPE      enmMediumType;
    6565    NETIFSTATUS    enmStatus;
    6666    RTUUID         Uuid;
  • trunk/src/VBox/Main/linux/NetIfList-linux.cpp

    r16968 r17275  
    5252        {
    5353            case ARPHRD_ETHER:
    54                 pInfo->enmType = NETIF_T_ETHERNET;
     54                pInfo->enmMediumType = NETIF_T_ETHERNET;
    5555                break;
    5656            default:
    57                 pInfo->enmType = NETIF_T_UNKNOWN;
     57                pInfo->enmMediumType = NETIF_T_UNKNOWN;
    5858                break;
    5959        }
     
    142142                if (RT_FAILURE(rc))
    143143                    break;
    144                 if (Info.enmType == NETIF_T_ETHERNET)
     144                if (Info.enmMediumType == NETIF_T_ETHERNET)
    145145                {
    146146                    ComObjPtr<HostNetworkInterface> IfObj;
    147147                    IfObj.createObject();
    148                     if (SUCCEEDED(IfObj->init(Bstr(pszName), TRUE, &Info)))
     148                    if (SUCCEEDED(IfObj->init(Bstr(pszName), HostNetworkInterfaceType_Bridged, &Info)))
    149149                        list.push_back(IfObj);
    150150                }
  • trunk/src/VBox/Main/solaris/NetIfList-solaris.cpp

    r16972 r17275  
    186186    Uuid.Gen.au8Node[5] = Info.MACAddress.au8[5];
    187187    Info.Uuid = Uuid;
    188     Info.enmType = NETIF_T_ETHERNET;
     188    Info.enmMediumType = NETIF_T_ETHERNET;
    189189
    190190    ComObjPtr<HostNetworkInterface> IfObj;
    191191    IfObj.createObject();
    192     if (SUCCEEDED(IfObj->init(Bstr(szNICDesc), TRUE, &Info)))
     192    if (SUCCEEDED(IfObj->init(Bstr(szNICDesc), HostNetworkInterfaceType_Bridged, &Info)))
    193193        pList->push_back(IfObj);
    194194}
  • trunk/src/VBox/Main/win/NetIfList-win.cpp

    r17229 r17275  
    361361}
    362362
     363static HRESULT VBoxNetCfgWinEnableDHCP(IWbemServices * pSvc, IWbemClassObject *pObj,  in_addr* aIp,  in_addr * aMask, UINT cIp)
     364{
     365    IWbemClassObject * pClass;
     366    BSTR ClassName = SysAllocString(L"Win32_NetworkAdapterConfiguration");
     367    HRESULT hr;
     368    if(ClassName)
     369    {
     370        hr = pSvc->GetObject(ClassName, 0, NULL, &pClass, NULL);
     371        if(SUCCEEDED(hr))
     372        {
     373            BSTR ObjPath;
     374            hr = netIfAdapterConfigPath(pObj, &ObjPath);
     375            if(SUCCEEDED(hr))
     376            {
     377                IWbemClassObject * pOutParams;
     378
     379                hr = netIfExecMethod(pSvc, pClass, ObjPath,
     380                                bstr_t(L"EnableDHCP"), NULL, NULL, 0, &pOutParams);
     381                if(SUCCEEDED(hr))
     382                {
     383                }
     384                SysFreeString(ObjPath);
     385            }
     386            pClass->Release();
     387        }
     388        SysFreeString(ClassName);
     389    }
     390    else
     391    {
     392        DWORD dwError = GetLastError();
     393        Assert(0);
     394        hr = HRESULT_FROM_WIN32( dwError );
     395    }
     396
     397    return hr;
     398}
    363399
    364400static int collectNetIfInfo(Bstr &strName, PNETIFINFO pInfo)
     
    448484                    else
    449485                        memcpy(pInfo->MACAddress.au8, pAdapter->PhysicalAddress, sizeof(pInfo->MACAddress));
    450                     pInfo->enmType = NETIF_T_ETHERNET;
     486                    pInfo->enmMediumType = NETIF_T_ETHERNET;
    451487                    pInfo->enmStatus = pAdapter->OperStatus == IfOperStatusUp ? NETIF_S_UP : NETIF_S_DOWN;
    452488                    RTStrFree(pszUuid);
     
    464500# define VBOX_APP_NAME L"VirtualBox"
    465501
    466 static int vboxNetWinAddComponent(std::list <ComObjPtr <HostNetworkInterface> > * pPist, INetCfgComponent * pncc, bool bReal)
     502static int vboxNetWinAddComponent(std::list <ComObjPtr <HostNetworkInterface> > * pPist, INetCfgComponent * pncc, HostNetworkInterfaceType enmType)
    467503{
    468504    LPWSTR              lpszName;
     
    496532            iface.createObject();
    497533            /* remove the curly bracket at the end */
    498             if (SUCCEEDED (iface->init (name, bReal, &Info)))
     534            if (SUCCEEDED (iface->init (name, enmType, &Info)))
    499535            {
    500536                pPist->push_back (iface);
     
    624660                            if(!_wcsnicmp(pId, L"sun_VBoxNetAdp", sizeof(L"sun_VBoxNetAdp")/2))
    625661                            {
    626                                 vboxNetWinAddComponent(&list, pMpNcc, false);
     662                                vboxNetWinAddComponent(&list, pMpNcc, HostNetworkInterfaceType_HostOnly);
    627663                            }
    628664                            CoTaskMemFree(pId);
     
    765801                    }
    766802
    767                     if (SUCCEEDED (iface->init (name, TRUE, &Info)))
     803                    if (SUCCEEDED (iface->init (name, HostNetworkInterfaceType_Bridged, &Info)))
    768804                        list.push_back (iface);
    769805                }
     
    841877                                        if(uComponentStatus == 0)
    842878                                        {
    843                                             vboxNetWinAddComponent(&list, pMpNcc, true);
     879                                            vboxNetWinAddComponent(&list, pMpNcc, HostNetworkInterfaceType_Bridged);
    844880                                        }
    845881                                    }
  • trunk/src/VBox/Main/win/svchlp.cpp

    r13835 r17275  
    272272        switch (msgCode)
    273273        {
    274             case SVCHlpMsg::CreateHostNetworkInterface:
    275             case SVCHlpMsg::RemoveHostNetworkInterface:
     274            case SVCHlpMsg::CreateHostOnlyNetworkInterface:
     275            case SVCHlpMsg::RemoveHostOnlyNetworkInterface:
    276276            {
    277277                vrc = Host::networkInterfaceHelperServer (this, msgCode);
  • trunk/src/VBox/Main/win/svchlp.h

    r14948 r17275  
    3838        Error, /* Utf8Str string (may be null but must present) */
    3939
    40         CreateHostNetworkInterface = 100, /* see usage in code */
    41         CreateHostNetworkInterface_OK, /* see usage in code */
    42         RemoveHostNetworkInterface, /* see usage in code */
     40        CreateHostOnlyNetworkInterface = 100, /* see usage in code */
     41        CreateHostOnlyNetworkInterface_OK, /* see usage in code */
     42        RemoveHostOnlyNetworkInterface, /* see usage in code */
    4343    };
    4444};
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