- Timestamp:
- Mar 5, 2009 6:32:17 PM (16 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/Makefile.kmk
r17322 r17419 58 58 VBoxManageUSB.cpp \ 59 59 VBoxInternalManage.cpp \ 60 VBoxManageHostonly.cpp \ 60 61 $(if $(VBOX_WITH_GUEST_PROPS),VBoxManageGuestProp.cpp) \ 61 62 VBoxManageSVN.cpp -
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp
r17382 r17419 1724 1724 { "import", handleImportAppliance }, 1725 1725 { "export", handleExportAppliance }, 1726 { "hostonlyif", handleHostonlyIf }, 1726 1727 { NULL, NULL } 1727 1728 }; -
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.h
r17104 r17419 188 188 int handleUSBFilter(HandlerArg *a); 189 189 190 /* VBoxManageHostonly.cpp */ 191 int handleHostonlyIf(HandlerArg *a); 192 190 193 #endif /* !VBOX_ONLY_DOCS */ 191 194 unsigned long VBoxSVNRev(); -
trunk/src/VBox/Main/HostNetworkInterfaceImpl.cpp
r17380 r17419 80 80 m.IPAddress = pIf->IPAddress.u; 81 81 m.networkMask = pIf->IPNetMask.u; 82 m.defaultGateway = pIf->IPDefaultGateway.u;83 82 m.IPV6Address = composeIPv6Address(&pIf->IPv6Address); 84 83 m.IPV6NetworkMask = composeIPv6Address(&pIf->IPv6NetMask); 85 m.IPV6DefaultGateway = composeIPv6Address(&pIf->IPV6DefaultGateway);86 84 m.hardwareAddress = composeHardwareAddress(&pIf->MACAddress); 87 85 #ifdef RT_OS_WINDOWS … … 205 203 } 206 204 207 /**208 * Returns the default gateway of the host network interface.209 *210 * @returns COM status code211 * @param aNetworkMask address of result pointer212 */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 225 205 STDMETHODIMP HostNetworkInterface::COMGETTER(IPV6Supported) (BOOL *aIPV6Supported) 226 206 { … … 269 249 270 250 /** 271 * Returns the IP V6 default gateway of the host network interface.272 *273 * @returns COM status code274 * @param aIPV6DefaultGateway address of result pointer275 */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 /**289 251 * Returns the hardware address of the host network interface. 290 252 * … … 359 321 } 360 322 361 STDMETHODIMP HostNetworkInterface::EnableStaticIpConfig (ULONG aIPAddress, ULONG aNetworkMask , ULONG aDefaultGateway)323 STDMETHODIMP HostNetworkInterface::EnableStaticIpConfig (ULONG aIPAddress, ULONG aNetworkMask) 362 324 { 363 325 #ifndef VBOX_WITH_HOSTNETIF_API … … 367 329 CheckComRCReturnRC (autoCaller.rc()); 368 330 369 int rc = NetIfEnableStaticIpConfig(this, aIPAddress, aNetworkMask , aDefaultGateway);331 int rc = NetIfEnableStaticIpConfig(this, aIPAddress, aNetworkMask); 370 332 if (RT_FAILURE(rc)) 371 333 { … … 377 339 } 378 340 379 STDMETHODIMP HostNetworkInterface::EnableStaticIpConfigV6 (IN_BSTR aIPV6Address, ULONG aIPV6MaskPrefixLength , IN_BSTR aIPV6DefaultGateway)341 STDMETHODIMP HostNetworkInterface::EnableStaticIpConfigV6 (IN_BSTR aIPV6Address, ULONG aIPV6MaskPrefixLength) 380 342 { 381 343 #ifndef VBOX_WITH_HOSTNETIF_API … … 384 346 if (!aIPV6Address) 385 347 return E_INVALIDARG; 386 if (!aIPV6DefaultGateway)387 return E_INVALIDARG;388 348 if (aIPV6MaskPrefixLength > 128) 389 349 return E_INVALIDARG; … … 392 352 CheckComRCReturnRC (autoCaller.rc()); 393 353 394 int rc = NetIfEnableStaticIpConfigV6(this, aIPV6Address, aIPV6MaskPrefixLength , aIPV6DefaultGateway);354 int rc = NetIfEnableStaticIpConfigV6(this, aIPV6Address, aIPV6MaskPrefixLength); 395 355 if (RT_FAILURE(rc)) 396 356 { -
trunk/src/VBox/Main/darwin/NetIfList-darwin.cpp
r17358 r17419 141 141 } 142 142 143 int NetIfEnableStaticIpConfig(HostNetworkInterface * pIf, ULONG ip, ULONG mask , ULONG gw)143 int NetIfEnableStaticIpConfig(HostNetworkInterface * pIf, ULONG ip, ULONG mask) 144 144 { 145 145 return VERR_NOT_IMPLEMENTED; 146 146 } 147 147 148 int NetIfEnableStaticIpConfigV6(HostNetworkInterface * pIf, IN_BSTR aIPV6Address, ULONG aIPV6MaskPrefixLength , IN_BSTR aIPV6DefaultGateway)148 int NetIfEnableStaticIpConfigV6(HostNetworkInterface * pIf, IN_BSTR aIPV6Address, ULONG aIPV6MaskPrefixLength) 149 149 { 150 150 return VERR_NOT_IMPLEMENTED; -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r17394 r17419 6449 6449 <interface 6450 6450 name="IHostNetworkInterface" extends="$unknown" 6451 uuid=" b4467af7-9b16-479a-a812-c132cbd886a3"6451 uuid="a82f7de2-695b-4bb9-ac13-f033e5fd75c2" 6452 6452 wsmap="managed" 6453 6453 > … … 6474 6474 </attribute> 6475 6475 6476 <attribute name="defaultGateway" type="unsigned long" readonly="yes">6477 <desc>Returns the network mask of the interface.</desc>6478 </attribute>6479 6480 6476 <attribute name="IPV6Supported" type="boolean" readonly="yes"> 6481 6477 <desc>Specifies whether the IP V6 is supported/enabled for the interface.</desc> … … 6487 6483 6488 6484 <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">6493 6485 <desc>Returns the IP V6 network mask of the interface.</desc> 6494 6486 </attribute> … … 6522 6514 </desc> 6523 6515 </param> 6524 <param name="defaultGateway" type="unsigned long" dir="in">6525 <desc>6526 default gateway.6527 </desc>6528 </param>6529 6516 </method> 6530 6517 … … 6537 6524 </param> 6538 6525 <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">6544 6526 <desc> 6545 6527 network mask. -
trunk/src/VBox/Main/include/HostNetworkInterfaceImpl.h
r17358 r17419 71 71 STDMETHOD(COMGETTER(IPAddress)) (ULONG *aIPAddress); 72 72 STDMETHOD(COMGETTER(NetworkMask)) (ULONG *aNetworkMask); 73 STDMETHOD(COMGETTER(DefaultGateway)) (ULONG *aDefaultGateway);74 73 STDMETHOD(COMGETTER(IPV6Supported)) (BOOL *aIPV6Supported); 75 74 STDMETHOD(COMGETTER(IPV6Address)) (BSTR *aIPV6Address); 76 75 STDMETHOD(COMGETTER(IPV6NetworkMask)) (BSTR *aIPV6Mask); 77 STDMETHOD(COMGETTER(IPV6DefaultGateway)) (BSTR *aDefaultGateway);78 76 STDMETHOD(COMGETTER(HardwareAddress)) (BSTR *aHardwareAddress); 79 77 STDMETHOD(COMGETTER(MediumType)) (HostNetworkInterfaceMediumType_T *aType); … … 81 79 STDMETHOD(COMGETTER(InterfaceType)) (HostNetworkInterfaceType_T *aType); 82 80 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); 85 83 STDMETHOD(EnableDynamicIpConfig) (); 86 84 … … 95 93 struct Data 96 94 { 97 Data() : IPAddress (0), networkMask (0), defaultGateway(0),95 Data() : IPAddress (0), networkMask (0), 98 96 mediumType (HostNetworkInterfaceMediumType_Unknown), 99 97 status(HostNetworkInterfaceStatus_Down){} … … 101 99 ULONG IPAddress; 102 100 ULONG networkMask; 103 ULONG defaultGateway;104 101 Bstr IPV6Address; 105 102 Bstr IPV6NetworkMask; 106 Bstr IPV6DefaultGateway;107 103 Bstr hardwareAddress; 108 104 HostNetworkInterfaceMediumType_T mediumType; -
trunk/src/VBox/Main/include/netif.h
r17380 r17419 59 59 RTNETADDRIPV4 IPAddress; 60 60 RTNETADDRIPV4 IPNetMask; 61 RTNETADDRIPV4 IPDefaultGateway;62 61 RTNETADDRIPV6 IPv6Address; 63 62 RTNETADDRIPV6 IPv6NetMask; 64 RTNETADDRIPV6 IPV6DefaultGateway;65 63 RTMAC MACAddress; 66 64 NETIFTYPE enmMediumType; … … 78 76 79 77 int 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);78 int NetIfEnableStaticIpConfig(HostNetworkInterface * pIf, ULONG ip, ULONG mask); 79 int NetIfEnableStaticIpConfigV6(HostNetworkInterface * pIf, IN_BSTR aIPV6Address, ULONG aIPV6MaskPrefixLength); 82 80 int NetIfEnableDynamicIpConfig(HostNetworkInterface * pIf); 83 81 -
trunk/src/VBox/Main/linux/NetIfList-linux.cpp
r17358 r17419 159 159 } 160 160 161 int NetIfEnableStaticIpConfig(HostNetworkInterface * pIf, ULONG ip, ULONG mask , ULONG gw)161 int NetIfEnableStaticIpConfig(HostNetworkInterface * pIf, ULONG ip, ULONG mask) 162 162 { 163 163 return VERR_NOT_IMPLEMENTED; 164 164 } 165 165 166 int NetIfEnableStaticIpConfigV6(HostNetworkInterface * pIf, IN_BSTR aIPV6Address, ULONG aIPV6MaskPrefixLength , IN_BSTR aIPV6DefaultGateway)166 int NetIfEnableStaticIpConfigV6(HostNetworkInterface * pIf, IN_BSTR aIPV6Address, ULONG aIPV6MaskPrefixLength) 167 167 { 168 168 return VERR_NOT_IMPLEMENTED; -
trunk/src/VBox/Main/os2/NetIfList-os2.cpp
r17358 r17419 38 38 } 39 39 40 int NetIfEnableStaticIpConfig(HostNetworkInterface * pIf, ULONG ip, ULONG mask , ULONG gw)40 int NetIfEnableStaticIpConfig(HostNetworkInterface * pIf, ULONG ip, ULONG mask) 41 41 { 42 42 return VERR_NOT_IMPLEMENTED; 43 43 } 44 44 45 int NetIfEnableStaticIpConfigV6(HostNetworkInterface * pIf, IN_BSTR aIPV6Address, ULONG aIPV6MaskPrefixLength , IN_BSTR aIPV6DefaultGateway)45 int NetIfEnableStaticIpConfigV6(HostNetworkInterface * pIf, IN_BSTR aIPV6Address, ULONG aIPV6MaskPrefixLength) 46 46 { 47 47 return VERR_NOT_IMPLEMENTED; -
trunk/src/VBox/Main/solaris/NetIfList-solaris.cpp
r17358 r17419 383 383 #endif 384 384 385 int NetIfEnableStaticIpConfig(HostNetworkInterface * pIf, ULONG ip, ULONG mask , ULONG gw)385 int NetIfEnableStaticIpConfig(HostNetworkInterface * pIf, ULONG ip, ULONG mask) 386 386 { 387 387 return VERR_NOT_IMPLEMENTED; 388 388 } 389 389 390 int NetIfEnableStaticIpConfigV6(HostNetworkInterface * pIf, IN_BSTR aIPV6Address, ULONG aIPV6MaskPrefixLength , IN_BSTR aIPV6DefaultGateway)390 int NetIfEnableStaticIpConfigV6(HostNetworkInterface * pIf, IN_BSTR aIPV6Address, ULONG aIPV6MaskPrefixLength) 391 391 { 392 392 return VERR_NOT_IMPLEMENTED; -
trunk/src/VBox/Main/win/NetIfList-win.cpp
r17380 r17419 650 650 } 651 651 652 int NetIfEnableStaticIpConfig(HostNetworkInterface * pIf, ULONG ip, ULONG mask , ULONG gw)652 int NetIfEnableStaticIpConfig(HostNetworkInterface * pIf, ULONG ip, ULONG mask) 653 653 { 654 654 HRESULT hr; … … 677 677 if(SUCCEEDED(hr)) 678 678 { 679 #if 0 679 680 in_addr aGw[1]; 680 681 aGw[0].S_un.S_addr = gw; 681 682 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 698 int 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 } 682 724 if(SUCCEEDED(hr)) 683 725 { … … 694 736 } 695 737 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) 738 int NetIfEnableStaticIpConfigV6(HostNetworkInterface * pIf, IN_BSTR aIPV6Address, ULONG aIPV6MaskPrefixLength) 734 739 { 735 740 RTNETADDRIPV6 Mask; … … 738 743 { 739 744 Bstr maskStr = composeIPv6Address(&Mask); 740 rc = NetIfEnableStaticIpConfigV6(pIf, aIPV6Address, maskStr, aIPV6DefaultGateway);745 rc = NetIfEnableStaticIpConfigV6(pIf, aIPV6Address, maskStr, NULL); 741 746 } 742 747 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.