Bug 895793: added interface type and link speed detection for Windows. r=bwc

This commit is contained in:
Nils Ohlmeier [:drno] 2016-01-08 14:37:18 -08:00
parent 607c3b7a01
commit 8a3f816bd8

View File

@ -217,9 +217,20 @@ stun_get_win32_addrs(nr_local_addr addrs[], int maxaddrs, int *count)
}
strlcpy(addrs[n].addr.ifname, hex_hashed_ifname, sizeof(addrs[n].addr.ifname));
/* TODO: (Bug 895793) Getting interface properties for Windows */
addrs[n].interface.type = NR_INTERFACE_TYPE_UNKNOWN;
if (tmpAddress->IfType == IF_TYPE_ETHERNET_CSMACD) {
addrs[n].interface.type = NR_INTERFACE_TYPE_WIRED;
} else if (tmpAddress->IfType == IF_TYPE_IEEE80211) {
/* Note: this only works for >= Win Vista */
addrs[n].interface.type = NR_INTERFACE_TYPE_WIFI;
} else {
addrs[n].interface.type = NR_INTERFACE_TYPE_UNKNOWN;
}
#if (_WIN32_WINNT >= 0x0600)
/* Note: only >= Vista provide link speed information */
addrs[n].interface.estimated_speed = tmpAddress->TransmitLinkSpeed / 1000;
#else
addrs[n].interface.estimated_speed = 0;
#endif
if (++n >= maxaddrs)
goto done;
}