Changeset 17275 in vbox
- Timestamp:
- Mar 3, 2009 1:28:12 PM (16 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxBFE/NetworkAdapterImpl.cpp
r8155 r17275 306 306 } 307 307 STDMETHODIMP 308 NetworkAdapter::AttachTo HostInterface()308 NetworkAdapter::AttachToBridgedNetwork() 309 309 { 310 310 AssertMsg(0,("Not implemented yet\n")); -
trunk/src/VBox/Frontends/VBoxBFE/NetworkAdapterImpl.h
r8155 r17275 107 107 // INetworkAdapter methods 108 108 STDMETHOD(AttachToNAT)(); 109 STDMETHOD(AttachTo HostInterface)();109 STDMETHOD(AttachToBridgedNetwork)(); 110 110 STDMETHOD(AttachToInternalNetwork)(); 111 111 STDMETHOD(Detach)(); -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp
r17260 r17275 683 683 break; 684 684 } 685 case NetworkAttachmentType_ HostInterface:685 case NetworkAttachmentType_Bridged: 686 686 { 687 687 Bstr strHostIfDev; -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageList.cpp
r17255 r17275 44 44 45 45 #ifdef VBOX_WITH_HOSTNETIF_API 46 static const char *getHostIfTypeText(HostNetworkInterface Type_T enmType)46 static const char *getHostIfTypeText(HostNetworkInterfaceMediumType_T enmType) 47 47 { 48 48 switch (enmType) 49 49 { 50 case HostNetworkInterface Type_Ethernet: return "Ethernet";51 case HostNetworkInterface Type_PPP: return "PPP";52 case HostNetworkInterface Type_SLIP: return "SLIP";50 case HostNetworkInterfaceMediumType_Ethernet: return "Ethernet"; 51 case HostNetworkInterfaceMediumType_PPP: return "PPP"; 52 case HostNetworkInterfaceMediumType_SLIP: return "SLIP"; 53 53 } 54 54 return "Unknown"; … … 326 326 networkInterface->COMGETTER(HardwareAddress)(HardwareAddress.asOutParam()); 327 327 RTPrintf("HardwareAddress: %lS\n", HardwareAddress.raw()); 328 HostNetworkInterface Type_T Type;329 networkInterface->COMGETTER( Type)(&Type);328 HostNetworkInterfaceMediumType_T Type; 329 networkInterface->COMGETTER(MediumType)(&Type); 330 330 RTPrintf("Type: %s\n", getHostIfTypeText(Type)); 331 331 HostNetworkInterfaceStatus_T Status; -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp
r17255 r17275 1384 1384 { 1385 1385 CHECK_ERROR_RET(nic, COMSETTER(Enabled) (TRUE), 1); 1386 CHECK_ERROR_RET(nic, AttachTo HostInterface(), 1);1386 CHECK_ERROR_RET(nic, AttachToBridgedNetwork(), 1); 1387 1387 } 1388 1388 else if (strcmp(nics[n], "intnet") == 0) … … 1391 1391 CHECK_ERROR_RET(nic, AttachToInternalNetwork(), 1); 1392 1392 } 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)) 1394 1394 else if (strcmp(nics[n], "hostonly") == 0) 1395 1395 { 1396 1396 CHECK_ERROR_RET(nic, COMSETTER(Enabled) (TRUE), 1); 1397 CHECK_ERROR_RET(nic, AttachToHostOnly Network(), 1);1397 CHECK_ERROR_RET(nic, AttachToHostOnlyInterface(), 1); 1398 1398 } 1399 1399 #endif /* defined(RT_OS_LINUX) || defined(RT_OS_DARWIN) */ -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp
r17160 r17275 2399 2399 * an additional symbolic network/interface name field, use 2400 2400 * this name instead */ 2401 if (type == KNetworkAttachmentType_ HostInterface)2401 if (type == KNetworkAttachmentType_Bridged) 2402 2402 attType = attType.arg (tr ("host interface, %1", 2403 2403 "details report (network)").arg (adapter.GetHostInterface())); … … 3418 3418 mNetworkAttachmentTypes [KNetworkAttachmentType_NAT] = 3419 3419 tr ("NAT", "NetworkAttachmentType"); 3420 mNetworkAttachmentTypes [KNetworkAttachmentType_ HostInterface] =3421 tr (" HostInterface", "NetworkAttachmentType");3420 mNetworkAttachmentTypes [KNetworkAttachmentType_Bridged] = 3421 tr ("Bridged Interface", "NetworkAttachmentType"); 3422 3422 mNetworkAttachmentTypes [KNetworkAttachmentType_Internal] = 3423 3423 tr ("Internal Network", "NetworkAttachmentType"); -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsNetwork.cpp
r17217 r17275 130 130 mAdapter.AttachToNAT(); 131 131 break; 132 case KNetworkAttachmentType_ HostInterface:133 mAdapter.AttachTo HostInterface();132 case KNetworkAttachmentType_Bridged: 133 mAdapter.AttachToBridgedNetwork(); 134 134 break; 135 135 case KNetworkAttachmentType_Internal: … … 148 148 mAdapter.SetCableConnected (mCbCable->isChecked()); 149 149 150 if (type == KNetworkAttachmentType_ HostInterface150 if (type == KNetworkAttachmentType_Bridged 151 151 #if defined (Q_WS_WIN) && defined (VBOX_WITH_NETFLT) 152 152 || type == KNetworkAttachmentType_HostOnly … … 257 257 #if defined (Q_WS_X11) && !defined (VBOX_WITH_NETFLT) 258 258 bool enableHostIf = vboxGlobal().toNetworkAttachmentType (aString) == 259 KNetworkAttachmentType_ HostInterface;259 KNetworkAttachmentType_Bridged; 260 260 setTapEnabled (enableHostIf); 261 261 #endif … … 312 312 mCbNAType->itemText(1), Qt::ToolTipRole); 313 313 mCbNAType->insertItem (2, 314 vboxGlobal().toString (KNetworkAttachmentType_ HostInterface));314 vboxGlobal().toString (KNetworkAttachmentType_Bridged)); 315 315 mCbNAType->setItemData (2, 316 316 mCbNAType->itemText(2), Qt::ToolTipRole); … … 555 555 CHost host = vboxGlobal().virtualBox().GetHost(); 556 556 CHostNetworkInterface iFace; 557 CProgress progress = host.CreateHost NetworkInterface (iName, iFace);557 CProgress progress = host.CreateHostOnlyNetworkInterface (iName, iFace); 558 558 if (host.isOk()) 559 559 { … … 614 614 { 615 615 /* Delete interface */ 616 CProgress progress = host.RemoveHost NetworkInterface (iFace.GetId(), iFace);616 CProgress progress = host.RemoveHostOnlyNetworkInterface (iFace.GetId(), iFace); 617 617 if (host.isOk()) 618 618 { … … 673 673 #if defined(Q_WS_WIN) && defined(VBOX_WITH_NETFLT) 674 674 /* 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)) 676 677 #endif 677 678 itemsList << new VBoxNIListItem (it->GetName()); … … 807 808 808 809 #if defined (Q_WS_WIN) || defined (VBOX_WITH_NETFLT) 809 if ((type == KNetworkAttachmentType_ HostInterface810 if ((type == KNetworkAttachmentType_Bridged 810 811 #if defined (Q_WS_WIN) && defined (VBOX_WITH_NETFLT) 811 812 || type == KNetworkAttachmentType_HostOnly … … 885 886 KNetworkAttachmentType enmType = vboxGlobal().toNetworkAttachmentType (page->mCbNAType->currentText()); 886 887 887 bool isHostInterfaceAttached = enmType == KNetworkAttachmentType_ HostInterface;888 bool isHostInterfaceAttached = enmType == KNetworkAttachmentType_Bridged; 888 889 889 890 mNIList->setEnabled (isHostInterfaceAttached); -
trunk/src/VBox/Main/ConsoleImpl.cpp
r17217 r17275 4239 4239 switch (netattach) 4240 4240 { 4241 case NetworkAttachmentType_ HostInterface:4241 case NetworkAttachmentType_Bridged: 4242 4242 { 4243 4243 #ifdef RT_OS_WINDOWS … … 5657 5657 * @note The caller must lock this object for writing. 5658 5658 */ 5659 HRESULT Console::attachTo HostInterface(INetworkAdapter *networkAdapter)5659 HRESULT Console::attachToBridgedInterface(INetworkAdapter *networkAdapter) 5660 5660 { 5661 5661 #if !defined(RT_OS_LINUX) || defined(VBOX_WITH_NETFLT) … … 5679 5679 NetworkAttachmentType_T attachment; 5680 5680 networkAdapter->COMGETTER(AttachmentType)(&attachment); 5681 Assert(attachment == NetworkAttachmentType_ HostInterface);5681 Assert(attachment == NetworkAttachmentType_Bridged); 5682 5682 # endif /* VBOX_STRICT */ 5683 5683 … … 5735 5735 if (fcntl(maTapFD[slot], F_SETFL, O_NONBLOCK) != -1) 5736 5736 { 5737 Log(("attachTo HostInterface: %RTfile %ls\n", maTapFD[slot], tapDeviceName.raw()));5737 Log(("attachToBridgedInterface: %RTfile %ls\n", maTapFD[slot], tapDeviceName.raw())); 5738 5738 /* 5739 5739 * Here is the right place to communicate the TAP file descriptor and … … 5788 5788 * @note The caller must lock this object for writing. 5789 5789 */ 5790 HRESULT Console::detachFrom HostInterface(INetworkAdapter *networkAdapter)5790 HRESULT Console::detachFromBridgedInterface(INetworkAdapter *networkAdapter) 5791 5791 { 5792 5792 #if !defined(RT_OS_LINUX) || defined(VBOX_WITH_NETFLT) … … 5808 5808 NetworkAttachmentType_T attachment; 5809 5809 networkAdapter->COMGETTER(AttachmentType)(&attachment); 5810 Assert(attachment == NetworkAttachmentType_ HostInterface);5810 Assert(attachment == NetworkAttachmentType_Bridged); 5811 5811 # endif /* VBOX_STRICT */ 5812 5812 … … 5880 5880 NetworkAttachmentType_T attachment; 5881 5881 networkAdapter->COMGETTER(AttachmentType)(&attachment); 5882 if (attachment == NetworkAttachmentType_ HostInterface)5883 { 5884 HRESULT rc2 = detachFrom HostInterface(networkAdapter);5882 if (attachment == NetworkAttachmentType_Bridged) 5883 { 5884 HRESULT rc2 = detachFromBridgedInterface(networkAdapter); 5885 5885 if (FAILED(rc2) && SUCCEEDED(rc)) 5886 5886 rc = rc2; -
trunk/src/VBox/Main/ConsoleImpl2.cpp
r17230 r17275 1292 1292 } 1293 1293 1294 case NetworkAttachmentType_ HostInterface:1294 case NetworkAttachmentType_Bridged: 1295 1295 { 1296 1296 /* 1297 1297 * Perform the attachment if required (don't return on error!) 1298 1298 */ 1299 hrc = pConsole->attachTo HostInterface(networkAdapter);1299 hrc = pConsole->attachToBridgedInterface(networkAdapter); 1300 1300 if (SUCCEEDED(hrc)) 1301 1301 { … … 1333 1333 if(FAILED(hrc)) 1334 1334 { 1335 LogRel(("NetworkAttachmentType_ HostInterface: COMGETTER(HostInterface) failed, hrc (0x%x)", hrc));1335 LogRel(("NetworkAttachmentType_Bridged: COMGETTER(HostInterface) failed, hrc (0x%x)", hrc)); 1336 1336 H(); 1337 1337 } … … 1382 1382 { 1383 1383 AssertBreakpoint(); 1384 LogRel(("NetworkAttachmentType_ HostInterface: FindByName failed, rc (0x%x)", rc));1384 LogRel(("NetworkAttachmentType_Bridged: FindByName failed, rc (0x%x)", rc)); 1385 1385 return VMSetError(pVM, VERR_INTERNAL_ERROR, RT_SRC_POS, 1386 1386 N_("Inexistent host networking interface, name '%ls'"), … … 1388 1388 } 1389 1389 1390 BOOL real;1391 hrc = hostInterface->COMGETTER( Real)(&real);1390 HostNetworkInterfaceType_T ifType; 1391 hrc = hostInterface->COMGETTER(InterfaceType)(&ifType); 1392 1392 if(FAILED(hrc)) 1393 1393 { 1394 LogRel(("NetworkAttachmentType_ HostOnly: COMGETTER(Real) failed, hrc (0x%x)", hrc));1394 LogRel(("NetworkAttachmentType_Bridged: COMGETTER(InterfaceType) failed, hrc (0x%x)", hrc)); 1395 1395 H(); 1396 1396 } 1397 1397 1398 if(!real) 1399 { 1400 LogRel(("NetworkAttachmentType_HostOnly: COMGETTER(Real) failed, hrc (0x%x)", hrc)); 1398 if(ifType != HostNetworkInterfaceType_Bridged) 1399 { 1401 1400 return VMSetError(pVM, VERR_INTERNAL_ERROR, RT_SRC_POS, 1402 N_("Interface ('%ls') is a HostAdapter interface"),1401 N_("Interface ('%ls') is not a Bridged Adapter interface"), 1403 1402 HifName.raw()); 1404 1403 } … … 1408 1407 if(FAILED(hrc)) 1409 1408 { 1410 LogRel(("NetworkAttachmentType_ HostInterface: COMGETTER(Id) failed, hrc (0x%x)", hrc));1409 LogRel(("NetworkAttachmentType_Bridged: COMGETTER(Id) failed, hrc (0x%x)", hrc)); 1411 1410 H(); 1412 1411 } … … 1691 1690 } 1692 1691 1693 BOOL real;1694 hrc = hostInterface->COMGETTER( Real)(&real);1692 HostNetworkInterfaceType_T ifType; 1693 hrc = hostInterface->COMGETTER(InterfaceType)(&ifType); 1695 1694 if(FAILED(hrc)) 1696 1695 { 1697 LogRel(("NetworkAttachmentType_HostOnly: COMGETTER( Real) failed, hrc (0x%x)", hrc));1696 LogRel(("NetworkAttachmentType_HostOnly: COMGETTER(InterfaceType) failed, hrc (0x%x)", hrc)); 1698 1697 H(); 1699 1698 } 1700 1699 1701 if( real)1700 if(ifType != HostNetworkInterfaceType_HostOnly) 1702 1701 { 1703 LogRel(("NetworkAttachmentType_HostOnly: COMGETTER(Real) failed, hrc (0x%x)", hrc));1704 1702 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"), 1706 1704 HifName.raw()); 1707 1705 } 1706 1708 1707 1709 1708 Guid hostIFGuid; -
trunk/src/VBox/Main/HostImpl.cpp
r17255 r17275 610 610 ComObjPtr<HostNetworkInterface> IfObj; 611 611 IfObj.createObject(); 612 if (SUCCEEDED(IfObj->init(Bstr(szNICDesc), Guid(Uuid), true)))612 if (SUCCEEDED(IfObj->init(Bstr(szNICDesc), Guid(Uuid), HostNetworkInterfaceType_Bridged))) 613 613 pList->push_back(IfObj); 614 614 } … … 725 725 iface.createObject(); 726 726 /* 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))) 728 728 { 729 729 pPist->push_back (iface); … … 771 771 ComObjPtr<HostNetworkInterface> IfObj; 772 772 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))) 774 774 list.push_back(IfObj); 775 775 … … 926 926 /* remove the curly bracket at the end */ 927 927 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))) 929 929 list.push_back (iface); 930 930 } … … 1052 1052 ComObjPtr<HostNetworkInterface> IfObj; 1053 1053 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))) 1055 1055 list.push_back(IfObj); 1056 1056 } … … 1359 1359 { 1360 1360 SVCHlpMsg::Code msgCode; 1361 /* for SVCHlpMsg::CreateHost NetworkInterface */1361 /* for SVCHlpMsg::CreateHostOnlyNetworkInterface */ 1362 1362 Bstr name; 1363 1363 ComObjPtr <HostNetworkInterface> iface; 1364 /* for SVCHlpMsg::RemoveHost NetworkInterface */1364 /* for SVCHlpMsg::RemoveHostOnlyNetworkInterface */ 1365 1365 Guid guid; 1366 1366 }; 1367 1367 1368 1368 STDMETHODIMP 1369 Host::CreateHost NetworkInterface (IN_BSTR aName,1369 Host::CreateHostOnlyNetworkInterface (IN_BSTR aName, 1370 1370 IHostNetworkInterface **aHostNetworkInterface, 1371 1371 IProgress **aProgress) … … 1407 1407 AssertReturn (d.get(), E_OUTOFMEMORY); 1408 1408 1409 d->msgCode = SVCHlpMsg::CreateHost NetworkInterface;1409 d->msgCode = SVCHlpMsg::CreateHostOnlyNetworkInterface; 1410 1410 d->name = aName; 1411 1411 d->iface = iface; … … 1427 1427 1428 1428 STDMETHODIMP 1429 Host::RemoveHost NetworkInterface (IN_GUID aId,1429 Host::RemoveHostOnlyNetworkInterface (IN_GUID aId, 1430 1430 IHostNetworkInterface **aHostNetworkInterface, 1431 1431 IProgress **aProgress) … … 1465 1465 AssertReturn (d.get(), E_OUTOFMEMORY); 1466 1466 1467 d->msgCode = SVCHlpMsg::RemoveHost NetworkInterface;1467 d->msgCode = SVCHlpMsg::RemoveHostOnlyNetworkInterface; 1468 1468 d->guid = aId; 1469 1469 … … 3005 3005 switch (d->msgCode) 3006 3006 { 3007 case SVCHlpMsg::CreateHost NetworkInterface:3008 { 3009 LogFlowFunc (("CreateHost NetworkInterface:\n"));3007 case SVCHlpMsg::CreateHostOnlyNetworkInterface: 3008 { 3009 LogFlowFunc (("CreateHostOnlyNetworkInterface:\n")); 3010 3010 LogFlowFunc (("Network connection name = '%ls'\n", d->name.raw())); 3011 3011 … … 3027 3027 switch (reply) 3028 3028 { 3029 case SVCHlpMsg::CreateHost NetworkInterface_OK:3029 case SVCHlpMsg::CreateHostOnlyNetworkInterface_OK: 3030 3030 { 3031 3031 /* read the GUID */ … … 3037 3037 3038 3038 /* initialize the object returned to the caller by 3039 * CreateHost NetworkInterface() */3040 rc = d->iface->init (d->name, guid, false);3039 * CreateHostOnlyNetworkInterface() */ 3040 rc = d->iface->init (d->name, guid, HostNetworkInterfaceType_HostOnly); 3041 3041 endLoop = true; 3042 3042 break; … … 3066 3066 break; 3067 3067 } 3068 case SVCHlpMsg::RemoveHost NetworkInterface:3069 { 3070 LogFlowFunc (("RemoveHost NetworkInterface:\n"));3068 case SVCHlpMsg::RemoveHostOnlyNetworkInterface: 3069 { 3070 LogFlowFunc (("RemoveHostOnlyNetworkInterface:\n")); 3071 3071 LogFlowFunc (("Network connection GUID = {%RTuuid}\n", d->guid.raw())); 3072 3072 … … 3147 3147 switch (aMsgCode) 3148 3148 { 3149 case SVCHlpMsg::CreateHost NetworkInterface:3150 { 3151 LogFlowFunc (("CreateHost NetworkInterface:\n"));3149 case SVCHlpMsg::CreateHostOnlyNetworkInterface: 3150 { 3151 LogFlowFunc (("CreateHostOnlyNetworkInterface:\n")); 3152 3152 3153 3153 Utf8Str name; … … 3162 3162 { 3163 3163 /* write success followed by GUID */ 3164 vrc = aClient->write (SVCHlpMsg::CreateHost NetworkInterface_OK);3164 vrc = aClient->write (SVCHlpMsg::CreateHostOnlyNetworkInterface_OK); 3165 3165 if (RT_FAILURE (vrc)) break; 3166 3166 vrc = aClient->write (guid); … … 3180 3180 break; 3181 3181 } 3182 case SVCHlpMsg::RemoveHost NetworkInterface:3183 { 3184 LogFlowFunc (("RemoveHost NetworkInterface:\n"));3182 case SVCHlpMsg::RemoveHostOnlyNetworkInterface: 3183 { 3184 LogFlowFunc (("RemoveHostOnlyNetworkInterface:\n")); 3185 3185 3186 3186 Guid guid; … … 3459 3459 } 3460 3460 3461 STDMETHODIMP 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 3461 3495 /* vi: set tabstop=4 shiftwidth=4 expandtab: */ -
trunk/src/VBox/Main/HostNetworkInterfaceImpl.cpp
r16967 r17275 51 51 * @param aGuid GUID of the host network interface 52 52 */ 53 HRESULT HostNetworkInterface::init (Bstr aInterfaceName, Guid aGuid, BOOL aReal)53 HRESULT HostNetworkInterface::init (Bstr aInterfaceName, Guid aGuid, HostNetworkInterfaceType_T ifType) 54 54 { 55 55 LogFlowThisFunc (("aInterfaceName={%ls}, aGuid={%s}\n", … … 65 65 unconst (mInterfaceName) = aInterfaceName; 66 66 unconst (mGuid) = aGuid; 67 m Real = aReal;67 mIfType = ifType; 68 68 69 69 … … 112 112 * @param aGuid GUID of the host network interface 113 113 */ 114 HRESULT HostNetworkInterface::init (Bstr aInterfaceName, BOOL aReal, PNETIFINFO pIf)114 HRESULT HostNetworkInterface::init (Bstr aInterfaceName, HostNetworkInterfaceType_T ifType, PNETIFINFO pIf) 115 115 { 116 116 // LogFlowThisFunc (("aInterfaceName={%ls}, aGuid={%s}\n", … … 127 127 unconst (mInterfaceName) = aInterfaceName; 128 128 unconst (mGuid) = pIf->Uuid; 129 m Real = aReal;129 mIfType = ifType; 130 130 131 131 m.IPAddress = pIf->IPAddress.u; … … 135 135 m.hardwareAddress = composeHardwareAddress(&pIf->MACAddress); 136 136 #ifdef RT_OS_WINDOWS 137 m. type = (HostNetworkInterfaceType)pIf->enmType;137 m.mediumType = (HostNetworkInterfaceMediumType)pIf->enmMediumType; 138 138 m.status = (HostNetworkInterfaceStatus)pIf->enmStatus; 139 139 #else /* !RT_OS_WINDOWS */ … … 285 285 * @param aType address of result pointer 286 286 */ 287 STDMETHODIMP HostNetworkInterface::COMGETTER( Type) (HostNetworkInterfaceType_T *aType)287 STDMETHODIMP HostNetworkInterface::COMGETTER(MediumType) (HostNetworkInterfaceMediumType_T *aType) 288 288 { 289 289 CheckComArgOutPointerValid(aType); … … 292 292 CheckComRCReturnRC (autoCaller.rc()); 293 293 294 *aType = m. type;294 *aType = m.mediumType; 295 295 296 296 return S_OK; … … 316 316 317 317 /** 318 * Returns true if this is a "real" adapter, false if this is a Virtualbox Host Adapter319 * 320 * @returns COM status code 321 * @param a Realaddress of result pointer322 */ 323 STDMETHODIMP HostNetworkInterface::COMGETTER( Real) (BOOL *aReal)324 { 325 CheckComArgOutPointerValid(a Real);326 327 AutoCaller autoCaller (this); 328 CheckComRCReturnRC (autoCaller.rc()); 329 330 *a Real = mReal;318 * Returns network interface type 319 * 320 * @returns COM status code 321 * @param aType address of result pointer 322 */ 323 STDMETHODIMP HostNetworkInterface::COMGETTER(InterfaceType) (HostNetworkInterfaceType_T *aType) 324 { 325 CheckComArgOutPointerValid(aType); 326 327 AutoCaller autoCaller (this); 328 CheckComRCReturnRC (autoCaller.rc()); 329 330 *aType = mIfType; 331 331 332 332 return S_OK; -
trunk/src/VBox/Main/NetworkAdapterImpl.cpp
r16967 r17275 713 713 } 714 714 715 STDMETHODIMP NetworkAdapter::AttachTo HostInterface()715 STDMETHODIMP NetworkAdapter::AttachToBridgedNetwork() 716 716 { 717 717 AutoCaller autoCaller (this); … … 725 725 726 726 /* don't do anything if we're already host interface attached */ 727 if (mData->mAttachmentType != NetworkAttachmentType_ HostInterface)727 if (mData->mAttachmentType != NetworkAttachmentType_Bridged) 728 728 { 729 729 mData.backup(); … … 732 732 detach(); 733 733 734 mData->mAttachmentType = NetworkAttachmentType_ HostInterface;734 mData->mAttachmentType = NetworkAttachmentType_Bridged; 735 735 736 736 /* leave the lock before informing callbacks */ … … 925 925 CheckComRCReturnRC (rc); 926 926 927 rc = AttachTo HostInterface();927 rc = AttachToBridgedNetwork(); 928 928 CheckComRCReturnRC (rc); 929 929 } … … 1034 1034 break; 1035 1035 } 1036 case NetworkAttachmentType_ HostInterface:1036 case NetworkAttachmentType_Bridged: 1037 1037 { 1038 1038 Key attachmentNode = aAdapterNode.createKey ("HostInterface"); … … 1200 1200 break; 1201 1201 } 1202 case NetworkAttachmentType_ HostInterface:1202 case NetworkAttachmentType_Bridged: 1203 1203 { 1204 1204 /* reset handle and device name */ -
trunk/src/VBox/Main/darwin/NetIfList-darwin.cpp
r16968 r17275 68 68 PNETIFINFO pNew = (PNETIFINFO)RTMemAllocZ(RT_OFFSETOF(NETIFINFO, szName[cbNameLen])); 69 69 pNew->MACAddress = pEtherNICs->Mac; 70 pNew->enm Type = NETIF_T_ETHERNET;70 pNew->enmMediumType = NETIF_T_ETHERNET; 71 71 pNew->Uuid = pEtherNICs->Uuid; 72 72 Assert(sizeof(pNew->szShortName) > sizeof(pEtherNICs->szBSDName)); … … 126 126 ComObjPtr<HostNetworkInterface> IfObj; 127 127 IfObj.createObject(); 128 if (SUCCEEDED(IfObj->init(Bstr(pEtherNICs->szName), TRUE, pNew)))128 if (SUCCEEDED(IfObj->init(Bstr(pEtherNICs->szName), HostNetworkInterfaceType_Bridged, pNew))) 129 129 list.push_back(IfObj); 130 130 RTMemFree(pNew); -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r17273 r17275 6364 6364 6365 6365 <enum 6366 name="HostNetworkInterface Type"6367 uuid=" 763754FA-3246-4539-9590-9E603EDBF706"6366 name="HostNetworkInterfaceMediumType" 6367 uuid="1aa54aaf-2497-45a2-bfb1-8eb225e93d5b" 6368 6368 > 6369 6369 <desc> … … 6421 6421 </enum> 6422 6422 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 6423 6434 <interface 6424 6435 name="IHostNetworkInterface" extends="$unknown" 6425 uuid=" 4fc2445f-fb73-4f55-b3b4-ecee47c7077b"6436 uuid="c312bf73-b353-4add-9db7-481b891ec08c" 6426 6437 wsmap="managed" 6427 6438 > … … 6460 6471 </attribute> 6461 6472 6462 <attribute name=" type" type="HostNetworkInterfaceType" readonly="yes">6473 <attribute name="mediumType" type="HostNetworkInterfaceMediumType" readonly="yes"> 6463 6474 <desc>Type of protocol encapsulation used.</desc> 6464 6475 </attribute> … … 6468 6479 </attribute> 6469 6480 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> 6473 6483 </attribute> 6474 6484 </interface> … … 6476 6486 <interface 6477 6487 name="IHost" extends="$unknown" 6478 uuid=" 234a43b3-66a5-4f15-a2a5-c46dbf4c4508"6488 uuid="96128709-69b5-43cc-9393-b3895f3b866a" 6479 6489 wsmap="managed" 6480 6490 > … … 6624 6634 6625 6635 <if target="midl"> 6626 <method name="createHost NetworkInterface">6627 <desc> 6628 Creates a new adapter for Host InterfaceNetworking.6636 <method name="createHostOnlyNetworkInterface"> 6637 <desc> 6638 Creates a new adapter for Host Only Networking. 6629 6639 <result name="E_INVALIDARG"> 6630 6640 Host network interface @a name already exists. … … 6647 6657 </param> 6648 6658 </method> 6649 <method name="removeHost NetworkInterface">6650 <desc> 6651 Removes the given host networkinterface.6659 <method name="removeHostOnlyNetworkInterface"> 6660 <desc> 6661 Removes the given Host Only Networking interface. 6652 6662 <result name="VBOX_E_OBJECT_NOT_FOUND"> 6653 6663 No host network interface matching @a id found. … … 6830 6840 <param name="networkInterface" type="IHostNetworkInterface" dir="return"> 6831 6841 <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> 6832 6853 </param> 6833 6854 </method> … … 10290 10311 <enum 10291 10312 name="NetworkAttachmentType" 10292 uuid=" 64e770dc-dd1d-4879-9f12-5bd6bc879b78"10313 uuid="44bce1ee-99f7-4e8e-89fc-80597fd9eeaf" 10293 10314 > 10294 10315 <desc> … … 10300 10321 </const> 10301 10322 <const name="NAT" value="1"/> 10302 <const name=" HostInterface"value="2"/>10323 <const name="Bridged" value="2"/> 10303 10324 <const name="Internal" value="3"/> 10304 10325 <const name="HostOnly" value="4"/> … … 10324 10345 <interface 10325 10346 name="INetworkAdapter" extends="$unknown" 10326 uuid=" 4a1ee64e-6c5f-47dd-acfa-f834d7cb74fb"10347 uuid="8eca30de-a883-40ee-b856-aac86f1ec383" 10327 10348 wsmap="managed" 10328 10349 > … … 10412 10433 </method> 10413 10434 10414 <method name="attachTo HostInterface">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. 10417 10438 </desc> 10418 10439 </method> -
trunk/src/VBox/Main/include/ConsoleImpl.h
r17217 r17275 403 403 HRESULT callTapSetupApplication(bool isStatic, RTFILE tapFD, Bstr &tapDevice, 404 404 Bstr &tapSetupApplication); 405 HRESULT attachTo HostInterface(INetworkAdapter *networkAdapter);406 HRESULT detachFrom HostInterface(INetworkAdapter *networkAdapter);405 HRESULT attachToBridgedInterface(INetworkAdapter *networkAdapter); 406 HRESULT detachFromBridgedInterface(INetworkAdapter *networkAdapter); 407 407 HRESULT powerDownHostInterfaces(); 408 408 -
trunk/src/VBox/Main/include/HostImpl.h
r17255 r17275 100 100 #ifdef RT_OS_WINDOWS 101 101 102 STDMETHOD(CreateHost NetworkInterface) (IN_BSTR aName,102 STDMETHOD(CreateHostOnlyNetworkInterface) (IN_BSTR aName, 103 103 IHostNetworkInterface **aHostNetworkInterface, 104 104 IProgress **aProgress); 105 STDMETHOD(RemoveHost NetworkInterface) (IN_GUID aId,105 STDMETHOD(RemoveHostOnlyNetworkInterface) (IN_GUID aId, 106 106 IHostNetworkInterface **aHostNetworkInterface, 107 107 IProgress **aProgress); … … 115 115 STDMETHOD(FindHostNetworkInterfaceByName) (IN_BSTR aName, IHostNetworkInterface **networkInterface); 116 116 STDMETHOD(FindHostNetworkInterfaceById) (IN_GUID id, IHostNetworkInterface **networkInterface); 117 STDMETHOD(FindHostNetworkInterfacesOfType) (HostNetworkInterfaceType type, ComSafeArrayOut (IHostNetworkInterface *, aNetworkInterfaces)); 117 118 118 119 // public methods only for internal purposes -
trunk/src/VBox/Main/include/HostNetworkInterfaceImpl.h
r16967 r17275 60 60 61 61 // 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); 63 63 #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); 65 65 #endif 66 66 … … 73 73 STDMETHOD(COMGETTER(IPV6NetworkMask)) (BSTR *aIPV6Mask); 74 74 STDMETHOD(COMGETTER(HardwareAddress)) (BSTR *aHardwareAddress); 75 STDMETHOD(COMGETTER( Type)) (HostNetworkInterfaceType_T *aType);75 STDMETHOD(COMGETTER(MediumType)) (HostNetworkInterfaceMediumType_T *aType); 76 76 STDMETHOD(COMGETTER(Status)) (HostNetworkInterfaceStatus_T *aStatus); 77 STDMETHOD(COMGETTER( Real)) (BOOL *aReal);77 STDMETHOD(COMGETTER(InterfaceType)) (HostNetworkInterfaceType_T *aType); 78 78 79 79 // for VirtualBoxSupportErrorInfoImpl … … 83 83 const Bstr mInterfaceName; 84 84 const Guid mGuid; 85 BOOL mReal;85 HostNetworkInterfaceType_T mIfType; 86 86 87 87 struct Data 88 88 { 89 89 Data() : IPAddress (0), networkMask (0), 90 type (HostNetworkInterfaceType_Unknown),90 mediumType (HostNetworkInterfaceMediumType_Unknown), 91 91 status(HostNetworkInterfaceStatus_Down){} 92 92 … … 96 96 Bstr IPV6NetworkMask; 97 97 Bstr hardwareAddress; 98 HostNetworkInterface Type_T type;98 HostNetworkInterfaceMediumType_T mediumType; 99 99 HostNetworkInterfaceStatus_T status; 100 100 } m; -
trunk/src/VBox/Main/include/NetworkAdapterImpl.h
r16509 r17275 127 127 // INetworkAdapter methods 128 128 STDMETHOD(AttachToNAT)(); 129 STDMETHOD(AttachTo HostInterface)();129 STDMETHOD(AttachToBridgedNetwork)(); 130 130 STDMETHOD(AttachToInternalNetwork)(); 131 131 STDMETHOD(AttachToHostOnlyNetwork)(); -
trunk/src/VBox/Main/include/netif.h
r16967 r17275 62 62 RTNETADDRIPV6 IPv6NetMask; 63 63 RTMAC MACAddress; 64 NETIFTYPE enm Type;64 NETIFTYPE enmMediumType; 65 65 NETIFSTATUS enmStatus; 66 66 RTUUID Uuid; -
trunk/src/VBox/Main/linux/NetIfList-linux.cpp
r16968 r17275 52 52 { 53 53 case ARPHRD_ETHER: 54 pInfo->enm Type = NETIF_T_ETHERNET;54 pInfo->enmMediumType = NETIF_T_ETHERNET; 55 55 break; 56 56 default: 57 pInfo->enm Type = NETIF_T_UNKNOWN;57 pInfo->enmMediumType = NETIF_T_UNKNOWN; 58 58 break; 59 59 } … … 142 142 if (RT_FAILURE(rc)) 143 143 break; 144 if (Info.enm Type == NETIF_T_ETHERNET)144 if (Info.enmMediumType == NETIF_T_ETHERNET) 145 145 { 146 146 ComObjPtr<HostNetworkInterface> IfObj; 147 147 IfObj.createObject(); 148 if (SUCCEEDED(IfObj->init(Bstr(pszName), TRUE, &Info)))148 if (SUCCEEDED(IfObj->init(Bstr(pszName), HostNetworkInterfaceType_Bridged, &Info))) 149 149 list.push_back(IfObj); 150 150 } -
trunk/src/VBox/Main/solaris/NetIfList-solaris.cpp
r16972 r17275 186 186 Uuid.Gen.au8Node[5] = Info.MACAddress.au8[5]; 187 187 Info.Uuid = Uuid; 188 Info.enm Type = NETIF_T_ETHERNET;188 Info.enmMediumType = NETIF_T_ETHERNET; 189 189 190 190 ComObjPtr<HostNetworkInterface> IfObj; 191 191 IfObj.createObject(); 192 if (SUCCEEDED(IfObj->init(Bstr(szNICDesc), TRUE, &Info)))192 if (SUCCEEDED(IfObj->init(Bstr(szNICDesc), HostNetworkInterfaceType_Bridged, &Info))) 193 193 pList->push_back(IfObj); 194 194 } -
trunk/src/VBox/Main/win/NetIfList-win.cpp
r17229 r17275 361 361 } 362 362 363 static 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 } 363 399 364 400 static int collectNetIfInfo(Bstr &strName, PNETIFINFO pInfo) … … 448 484 else 449 485 memcpy(pInfo->MACAddress.au8, pAdapter->PhysicalAddress, sizeof(pInfo->MACAddress)); 450 pInfo->enm Type = NETIF_T_ETHERNET;486 pInfo->enmMediumType = NETIF_T_ETHERNET; 451 487 pInfo->enmStatus = pAdapter->OperStatus == IfOperStatusUp ? NETIF_S_UP : NETIF_S_DOWN; 452 488 RTStrFree(pszUuid); … … 464 500 # define VBOX_APP_NAME L"VirtualBox" 465 501 466 static int vboxNetWinAddComponent(std::list <ComObjPtr <HostNetworkInterface> > * pPist, INetCfgComponent * pncc, bool bReal)502 static int vboxNetWinAddComponent(std::list <ComObjPtr <HostNetworkInterface> > * pPist, INetCfgComponent * pncc, HostNetworkInterfaceType enmType) 467 503 { 468 504 LPWSTR lpszName; … … 496 532 iface.createObject(); 497 533 /* remove the curly bracket at the end */ 498 if (SUCCEEDED (iface->init (name, bReal, &Info)))534 if (SUCCEEDED (iface->init (name, enmType, &Info))) 499 535 { 500 536 pPist->push_back (iface); … … 624 660 if(!_wcsnicmp(pId, L"sun_VBoxNetAdp", sizeof(L"sun_VBoxNetAdp")/2)) 625 661 { 626 vboxNetWinAddComponent(&list, pMpNcc, false);662 vboxNetWinAddComponent(&list, pMpNcc, HostNetworkInterfaceType_HostOnly); 627 663 } 628 664 CoTaskMemFree(pId); … … 765 801 } 766 802 767 if (SUCCEEDED (iface->init (name, TRUE, &Info)))803 if (SUCCEEDED (iface->init (name, HostNetworkInterfaceType_Bridged, &Info))) 768 804 list.push_back (iface); 769 805 } … … 841 877 if(uComponentStatus == 0) 842 878 { 843 vboxNetWinAddComponent(&list, pMpNcc, true);879 vboxNetWinAddComponent(&list, pMpNcc, HostNetworkInterfaceType_Bridged); 844 880 } 845 881 } -
trunk/src/VBox/Main/win/svchlp.cpp
r13835 r17275 272 272 switch (msgCode) 273 273 { 274 case SVCHlpMsg::CreateHost NetworkInterface:275 case SVCHlpMsg::RemoveHost NetworkInterface:274 case SVCHlpMsg::CreateHostOnlyNetworkInterface: 275 case SVCHlpMsg::RemoveHostOnlyNetworkInterface: 276 276 { 277 277 vrc = Host::networkInterfaceHelperServer (this, msgCode); -
trunk/src/VBox/Main/win/svchlp.h
r14948 r17275 38 38 Error, /* Utf8Str string (may be null but must present) */ 39 39 40 CreateHost NetworkInterface = 100, /* see usage in code */41 CreateHost NetworkInterface_OK, /* see usage in code */42 RemoveHost NetworkInterface, /* see usage in code */40 CreateHostOnlyNetworkInterface = 100, /* see usage in code */ 41 CreateHostOnlyNetworkInterface_OK, /* see usage in code */ 42 RemoveHostOnlyNetworkInterface, /* see usage in code */ 43 43 }; 44 44 };
Note:
See TracChangeset
for help on using the changeset viewer.