- Timestamp:
- Dec 12, 2008 2:51:29 PM (16 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 6 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageList.cpp
r15235 r15372 49 49 case HostNetworkInterfaceType_PPP: return "PPP"; 50 50 case HostNetworkInterfaceType_SLIP: return "SLIP"; 51 } 52 return "Unknown"; 53 } 54 55 static const char *getHostIfStatusText(HostNetworkInterfaceStatus_T enmStatus) 56 { 57 switch (enmStatus) 58 { 59 case HostNetworkInterfaceStatus_Up: return "Up"; 60 case HostNetworkInterfaceStatus_Down: return "Down"; 51 61 } 52 62 return "Unknown"; … … 204 214 ComPtr<IHostNetworkInterface> networkInterface; 205 215 CHECK_RC_BREAK(enumerator->GetNext(networkInterface.asOutParam())); 216 #ifndef VBOX_WITH_HOSTNETIF_API 206 217 Bstr interfaceName; 207 218 networkInterface->COMGETTER(Name)(interfaceName.asOutParam()); … … 210 221 networkInterface->COMGETTER(Id)(interfaceGuid.asOutParam()); 211 222 RTPrintf("GUID: %lS\n\n", Bstr(interfaceGuid.toString()).raw()); 212 #ifdef VBOX_WITH_HOSTNETIF_API 213 ULONG IPAddress; 214 networkInterface->COMGETTER(IPAddress)(&IPAddress); 215 RTPrintf("IPAddress: %d.%d.%d.%d\n", 216 ((uint8_t*)&IPAddress)[0], 217 ((uint8_t*)&IPAddress)[1], 218 ((uint8_t*)&IPAddress)[2], 219 ((uint8_t*)&IPAddress)[3]); 220 ULONG NetworkMask; 221 networkInterface->COMGETTER(NetworkMask)(&NetworkMask); 222 RTPrintf("NetworkMask: %d.%d.%d.%d\n", 223 ((uint8_t*)&NetworkMask)[0], 224 ((uint8_t*)&NetworkMask)[1], 225 ((uint8_t*)&NetworkMask)[2], 226 ((uint8_t*)&NetworkMask)[3]); 227 Bstr IPV6Address; 228 networkInterface->COMGETTER(IPV6Address)(IPV6Address.asOutParam()); 229 RTPrintf("IPV6Address: %lS\n", IPV6Address.raw()); 230 Bstr HardwareAddress; 231 networkInterface->COMGETTER(HardwareAddress)(HardwareAddress.asOutParam()); 232 RTPrintf("HardwareAddress: %lS\n", HardwareAddress.raw()); 233 HostNetworkInterfaceType_T Type; 234 networkInterface->COMGETTER(Type)(&Type); 235 RTPrintf("Type: %s\n", getHostIfTypeText(Type)); 236 HostNetworkInterfaceStatus_T Status; 237 networkInterface->COMGETTER(Status)(&Status); 238 RTPrintf("Status: %s\n\n", Status ? "Down":"Up"); 223 #else /* VBOX_WITH_HOSTNETIF_API */ 224 Bstr interfaceName; 225 networkInterface->COMGETTER(Name)(interfaceName.asOutParam()); 226 RTPrintf("Name: %lS\n", interfaceName.raw()); 227 Guid interfaceGuid; 228 networkInterface->COMGETTER(Id)(interfaceGuid.asOutParam()); 229 RTPrintf("GUID: %lS\n", Bstr(interfaceGuid.toString()).raw()); 230 ULONG IPAddress; 231 networkInterface->COMGETTER(IPAddress)(&IPAddress); 232 RTPrintf("IPAddress: %d.%d.%d.%d\n", 233 ((uint8_t*)&IPAddress)[0], 234 ((uint8_t*)&IPAddress)[1], 235 ((uint8_t*)&IPAddress)[2], 236 ((uint8_t*)&IPAddress)[3]); 237 ULONG NetworkMask; 238 networkInterface->COMGETTER(NetworkMask)(&NetworkMask); 239 RTPrintf("NetworkMask: %d.%d.%d.%d\n", 240 ((uint8_t*)&NetworkMask)[0], 241 ((uint8_t*)&NetworkMask)[1], 242 ((uint8_t*)&NetworkMask)[2], 243 ((uint8_t*)&NetworkMask)[3]); 244 Bstr IPV6Address; 245 networkInterface->COMGETTER(IPV6Address)(IPV6Address.asOutParam()); 246 RTPrintf("IPV6Address: %lS\n", IPV6Address.raw()); 247 Bstr IPV6NetworkMask; 248 networkInterface->COMGETTER(IPV6NetworkMask)(IPV6NetworkMask.asOutParam()); 249 RTPrintf("IPV6NetworkMask: %lS\n", IPV6NetworkMask.raw()); 250 Bstr HardwareAddress; 251 networkInterface->COMGETTER(HardwareAddress)(HardwareAddress.asOutParam()); 252 RTPrintf("HardwareAddress: %lS\n", HardwareAddress.raw()); 253 HostNetworkInterfaceType_T Type; 254 networkInterface->COMGETTER(Type)(&Type); 255 RTPrintf("Type: %s\n", getHostIfTypeText(Type)); 256 HostNetworkInterfaceStatus_T Status; 257 networkInterface->COMGETTER(Status)(&Status); 258 RTPrintf("Status: %s\n\n", getHostIfStatusText(Status)); 239 259 #endif 240 260 } -
trunk/src/VBox/Main/HostImpl.cpp
r15235 r15372 117 117 #endif 118 118 #ifdef VBOX_WITH_HOSTNETIF_API 119 #include <iprt/netif.h>119 #include "netif.h" 120 120 #endif 121 121 … … 762 762 763 763 #ifdef VBOX_WITH_HOSTNETIF_API 764 P RTNETIFINFO pIfs = RTNetIfList();764 PNETIFINFO pIfs = NetIfList(); 765 765 while (pIfs) 766 766 { -
trunk/src/VBox/Main/HostNetworkInterfaceImpl.cpp
r15235 r15372 72 72 73 73 #ifdef VBOX_WITH_HOSTNETIF_API 74 static Bstr composeIPv6Address(PRTNETADDRIPV6 aAddrPtr) 75 { 76 char szTmp[8*5]; 77 78 RTStrPrintf(szTmp, sizeof(szTmp), 79 "%02x%02x:%02x%02x:%02x%02x:%02x%02x:" 80 "%02x%02x:%02x%02x:%02x%02x:%02x%02x", 81 aAddrPtr->au8[0], aAddrPtr->au8[1], 82 aAddrPtr->au8[2], aAddrPtr->au8[3], 83 aAddrPtr->au8[4], aAddrPtr->au8[5], 84 aAddrPtr->au8[6], aAddrPtr->au8[7], 85 aAddrPtr->au8[8], aAddrPtr->au8[9], 86 aAddrPtr->au8[10], aAddrPtr->au8[11], 87 aAddrPtr->au8[12], aAddrPtr->au8[13], 88 aAddrPtr->au8[14], aAddrPtr->au8[15]); 89 return Bstr(szTmp); 90 } 91 92 static Bstr composeHardwareAddress(PRTMAC aMacPtr) 93 { 94 char szTmp[6*3]; 95 96 RTStrPrintf(szTmp, sizeof(szTmp), 97 "%02x:%02x:%02x:%02x:%02x:%02x", 98 aMacPtr->au8[0], aMacPtr->au8[1], 99 aMacPtr->au8[2], aMacPtr->au8[3], 100 aMacPtr->au8[4], aMacPtr->au8[5]); 101 return Bstr(szTmp); 102 } 103 74 104 /** 75 105 * Initializes the host object. … … 79 109 * @param aGuid GUID of the host network interface 80 110 */ 81 HRESULT HostNetworkInterface::init (P RTNETIFINFO pIf)111 HRESULT HostNetworkInterface::init (PNETIFINFO pIf) 82 112 { 83 113 // LogFlowThisFunc (("aInterfaceName={%ls}, aGuid={%s}\n", … … 86 116 // ComAssertRet (aInterfaceName, E_INVALIDARG); 87 117 // ComAssertRet (!aGuid.isEmpty(), E_INVALIDARG); 88 ComAssertRet ( !pIf, E_INVALIDARG);118 ComAssertRet (pIf, E_INVALIDARG); 89 119 90 120 /* Enclose the state transition NotReady->InInit->Ready */ … … 94 124 unconst (mInterfaceName) = Bstr(pIf->szName); 95 125 unconst (mGuid) = pIf->Uuid; 96 // m.IPAddress = pIf->IPAddress; 97 // m.networkMask = pIf->IPNetMask; 98 // m.IPv6Address = composeIPv6Address(pIf->IPv6Address, pIf->IPv6NetMask); 126 m.IPAddress = pIf->IPAddress.u; 127 m.networkMask = pIf->IPNetMask.u; 128 m.IPV6Address = composeIPv6Address(&pIf->IPv6Address); 129 m.IPV6NetworkMask = composeIPv6Address(&pIf->IPv6NetMask); 130 m.hardwareAddress = composeHardwareAddress(&pIf->MACAddress); 131 m.type = pIf->enmType; 132 m.status = pIf->enmStatus; 99 133 100 134 /* Confirm a successful initialization */ … … 200 234 201 235 /** 236 * Returns the IP V6 network mask of the host network interface. 237 * 238 * @returns COM status code 239 * @param aIPV6Mask address of result pointer 240 */ 241 STDMETHODIMP HostNetworkInterface::COMGETTER(IPV6NetworkMask) (BSTR *aIPV6Mask) 242 { 243 CheckComArgOutPointerValid(aIPV6Mask); 244 245 AutoCaller autoCaller (this); 246 CheckComRCReturnRC (autoCaller.rc()); 247 248 m.IPV6NetworkMask.cloneTo (aIPV6Mask); 249 250 return S_OK; 251 } 252 253 /** 202 254 * Returns the hardware address of the host network interface. 203 255 * -
trunk/src/VBox/Main/Makefile.kmk
r15235 r15372 341 341 endif 342 342 343 ifdef VBOX_WITH_HOSTNETIF_API 344 VBoxSVC_SOURCES.win += win/NetIfList-win.cpp 345 VBoxSVC_SOURCES.linux += linux/NetIfList-linux.cpp 346 VBoxSVC_SOURCES.os2 += os2/NetIfList-os2.cpp 347 VBoxSVC_SOURCES.darwin += darwin/NetIfList-darwin.cpp 348 VBoxSVC_SOURCES.solaris += solaris/NetIfList-solaris.cpp 349 VBoxSVC_DEFS += VBOX_WITH_HOSTNETIF_API 350 endif 351 343 352 win/VBoxSVC.rc_INCS = $(PATH_VBoxSVC) 344 353 win/VBoxSVC.rc_DEPS = $(PATH_VBoxSVC)/VBoxSVC.rgs $(PATH_VBoxSVC)/VBoxSVC-icon.rc -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r15335 r15372 5902 5902 </desc> 5903 5903 5904 <const name="Up" value="0"> 5904 <const name="Unknown" value="0"> 5905 <desc> 5906 The state of interface cannot be determined. 5907 </desc> 5908 </const> 5909 <const name="Up" value="1"> 5905 5910 <desc> 5906 5911 The interface is fully operational. 5907 5912 </desc> 5908 5913 </const> 5909 <const name="Down" value=" 1">5914 <const name="Down" value="2"> 5910 5915 <desc> 5911 5916 The interface is not functioning. … … 5937 5942 <attribute name="IPV6Address" type="wstring" readonly="yes"> 5938 5943 <desc>Returns the IP V6 address of the interface.</desc> 5944 </attribute> 5945 5946 <attribute name="IPV6NetworkMask" type="wstring" readonly="yes"> 5947 <desc>Returns the IP V6 network mask of the interface.</desc> 5939 5948 </attribute> 5940 5949 -
trunk/src/VBox/Main/include/HostNetworkInterfaceImpl.h
r15235 r15372 28 28 #include "Collection.h" 29 29 #ifdef VBOX_WITH_HOSTNETIF_API 30 #include " iprt/netif.h"30 #include "netif.h" 31 31 #endif 32 32 … … 60 60 HRESULT init (Bstr interfaceName, Guid guid); 61 61 #ifdef VBOX_WITH_HOSTNETIF_API 62 HRESULT init (P RTNETIFINFO pIfs);62 HRESULT init (PNETIFINFO pIfs); 63 63 #endif 64 64 … … 69 69 STDMETHOD(COMGETTER(NetworkMask)) (ULONG *aNetworkMask); 70 70 STDMETHOD(COMGETTER(IPV6Address)) (BSTR *aIPV6Address); 71 STDMETHOD(COMGETTER(IPV6NetworkMask)) (BSTR *aIPV6Mask); 71 72 STDMETHOD(COMGETTER(HardwareAddress)) (BSTR *aHardwareAddress); 72 73 STDMETHOD(COMGETTER(Type)) (HostNetworkInterfaceType_T *aType); … … 88 89 ULONG networkMask; 89 90 Bstr IPV6Address; 91 Bstr IPV6NetworkMask; 90 92 Bstr hardwareAddress; 91 93 HostNetworkInterfaceType_T type; -
trunk/src/VBox/Runtime/Makefile.kmk
r15301 r15372 287 287 r3/tcp.cpp 288 288 289 ifdef VBOX_WITH_HOSTNETIF_API290 RuntimeR3_SOURCES += \291 generic/RTNetIfList-generic.cpp292 RuntimeR3_DEFS += VBOX_WITH_HOSTNETIF_API293 endif294 295 289 #if1of ($(KBUILD_TARGET_ARCH),amd64 x86) 296 290 # RuntimeR3_SOURCES += common/time/timesupA.asm
Note:
See TracChangeset
for help on using the changeset viewer.