mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 20:35:43 +00:00
[TCPIP] Retrieve the interface medium type from NDIS
Send OID_GEN_PHYSICAL_MEDIUM and OID_GEN_MEDIA_SUPPORTED query requests to NDIS. This will enable us to distinguish wired and wireless ethernet adapters.
This commit is contained in:
parent
c876fe350d
commit
3842b59f75
1 changed files with 98 additions and 6 deletions
|
@ -24,6 +24,7 @@ TDI_STATUS InfoTdiQueryGetInterfaceMIB(TDIEntityID ID,
|
|||
PLAN_ADAPTER IF;
|
||||
PCHAR IFDescr;
|
||||
ULONG Size;
|
||||
ULONG Medium;
|
||||
NDIS_STATUS NdisStatus;
|
||||
|
||||
if (!Interface)
|
||||
|
@ -44,7 +45,7 @@ TDI_STATUS InfoTdiQueryGetInterfaceMIB(TDIEntityID ID,
|
|||
OutData->if_index = Interface->Index;
|
||||
/* viz: tcpip keeps those indices */
|
||||
OutData->if_type = Interface ==
|
||||
Loopback ? MIB_IF_TYPE_LOOPBACK : MIB_IF_TYPE_ETHERNET;
|
||||
Loopback ? MIB_IF_TYPE_LOOPBACK : MIB_IF_TYPE_OTHER;
|
||||
OutData->if_mtu = Interface->MTU;
|
||||
TI_DbgPrint(DEBUG_INFO,
|
||||
("Getting interface speed\n"));
|
||||
|
@ -56,11 +57,102 @@ TDI_STATUS InfoTdiQueryGetInterfaceMIB(TDIEntityID ID,
|
|||
IFDescr = (PCHAR)&OutData->if_descr[0];
|
||||
|
||||
if( IF ) {
|
||||
GetInterfaceSpeed( Interface, (PUINT)&OutData->if_speed );
|
||||
TI_DbgPrint(DEBUG_INFO,
|
||||
("IF Speed = %d * 100bps\n", OutData->if_speed));
|
||||
memcpy(OutData->if_physaddr, Interface->Address, Interface->AddressLength);
|
||||
TI_DbgPrint(DEBUG_INFO, ("Got HWAddr\n"));
|
||||
if (OutData->if_type == MIB_IF_TYPE_OTHER)
|
||||
{
|
||||
NdisStatus = NDISCall(IF,
|
||||
NdisRequestQueryInformation,
|
||||
OID_GEN_PHYSICAL_MEDIUM,
|
||||
&Medium,
|
||||
sizeof(ULONG));
|
||||
if (NdisStatus == NDIS_STATUS_SUCCESS)
|
||||
{
|
||||
switch (Medium)
|
||||
{
|
||||
#if 0
|
||||
case NdisPhysicalMediumUnspecified:
|
||||
#endif
|
||||
case NdisPhysicalMediumWirelessLan:
|
||||
OutData->if_type = IF_TYPE_IEEE80211;
|
||||
break;
|
||||
#if 0
|
||||
case NdisPhysicalMediumCableModem:
|
||||
case NdisPhysicalMediumPhoneLine:
|
||||
case NdisPhysicalMediumPowerLine:
|
||||
case NdisPhysicalMediumDSL:
|
||||
case NdisPhysicalMediumFibreChannel:
|
||||
case NdisPhysicalMedium1394:
|
||||
case NdisPhysicalMediumWirelessWan:
|
||||
#endif
|
||||
case NdisPhysicalMediumNative802_11:
|
||||
OutData->if_type = IF_TYPE_IEEE80211;
|
||||
break;
|
||||
#if 0
|
||||
case NdisPhysicalMediumBluetooth:
|
||||
case NdisPhysicalMediumInfiniband:
|
||||
case NdisPhysicalMediumWiMax:
|
||||
case NdisPhysicalMediumUWB:
|
||||
#endif
|
||||
case NdisPhysicalMedium802_3:
|
||||
OutData->if_type = MIB_IF_TYPE_ETHERNET;
|
||||
break;
|
||||
|
||||
case NdisPhysicalMedium802_5:
|
||||
OutData->if_type = MIB_IF_TYPE_TOKENRING;
|
||||
break;
|
||||
#if 0
|
||||
case NdisPhysicalMediumIrda:
|
||||
case NdisPhysicalMediumWiredWAN:
|
||||
case NdisPhysicalMediumWiredCoWan:
|
||||
case NdisPhysicalMediumOther:
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (OutData->if_type == MIB_IF_TYPE_OTHER)
|
||||
{
|
||||
NdisStatus = NDISCall(IF,
|
||||
NdisRequestQueryInformation,
|
||||
OID_GEN_MEDIA_SUPPORTED,
|
||||
&Medium,
|
||||
sizeof(ULONG));
|
||||
if (NdisStatus == NDIS_STATUS_SUCCESS)
|
||||
{
|
||||
switch (Medium)
|
||||
{
|
||||
case NdisMedium802_3:
|
||||
OutData->if_type = MIB_IF_TYPE_ETHERNET;
|
||||
break;
|
||||
|
||||
case NdisMedium802_5:
|
||||
OutData->if_type = MIB_IF_TYPE_TOKENRING;
|
||||
break;
|
||||
|
||||
case NdisMediumFddi:
|
||||
OutData->if_type = MIB_IF_TYPE_FDDI;
|
||||
break;
|
||||
#if 0
|
||||
case NdisMediumWan,
|
||||
case NdisMediumLocalTalk:
|
||||
case NdisMediumDix:
|
||||
case NdisMediumArcnetRaw:
|
||||
case NdisMediumArcnet878_2:
|
||||
case NdisMediumAtm:
|
||||
case NdisMediumWirelessWan:
|
||||
case NdisMediumIrda:
|
||||
case NdisMediumBpc:
|
||||
case NdisMediumCoWan:
|
||||
case NdisMedium1394:
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GetInterfaceSpeed( Interface, (PUINT)&OutData->if_speed );
|
||||
TI_DbgPrint(DEBUG_INFO,
|
||||
("IF Speed = %d * 100bps\n", OutData->if_speed));
|
||||
memcpy(OutData->if_physaddr, Interface->Address, Interface->AddressLength);
|
||||
TI_DbgPrint(DEBUG_INFO, ("Got HWAddr\n"));
|
||||
|
||||
memcpy(&OutData->if_inoctets, &Interface->Stats, sizeof(SEND_RECV_STATS));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue