mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 20:53:02 +00:00
[TCPIP]
- Use the structure defined in the public headers instead of some strange internal thing. Uppercase is not so fashionable after all. svn path=/trunk/; revision=65218
This commit is contained in:
parent
0039187504
commit
d4ca070d84
2 changed files with 27 additions and 54 deletions
|
@ -77,31 +77,6 @@ typedef struct IPROUTE_ENTRY {
|
||||||
ULONG Info;
|
ULONG Info;
|
||||||
} IPROUTE_ENTRY, *PIPROUTE_ENTRY;
|
} IPROUTE_ENTRY, *PIPROUTE_ENTRY;
|
||||||
|
|
||||||
typedef struct IFENTRY {
|
|
||||||
ULONG Index;
|
|
||||||
ULONG Type;
|
|
||||||
ULONG Mtu;
|
|
||||||
ULONG Speed;
|
|
||||||
ULONG PhysAddrLen;
|
|
||||||
UCHAR PhysAddr[MAX_PHYSADDR_LEN];
|
|
||||||
ULONG AdminStatus;
|
|
||||||
ULONG OperStatus;
|
|
||||||
ULONG LastChange;
|
|
||||||
ULONG InOctets;
|
|
||||||
ULONG InUcastPackets;
|
|
||||||
ULONG InNUcastPackets;
|
|
||||||
ULONG InDiscards;
|
|
||||||
ULONG InErrors;
|
|
||||||
ULONG InUnknownProtos;
|
|
||||||
ULONG OutOctets;
|
|
||||||
ULONG OutUcastPackets;
|
|
||||||
ULONG OutNUcastPackets;
|
|
||||||
ULONG OutDiscards;
|
|
||||||
ULONG OutErrors;
|
|
||||||
ULONG OutQLen;
|
|
||||||
ULONG DescrLen;
|
|
||||||
} IFENTRY, *PIFENTRY;
|
|
||||||
|
|
||||||
/* Only UDP is supported */
|
/* Only UDP is supported */
|
||||||
#define TDI_SERVICE_FLAGS (TDI_SERVICE_CONNECTIONLESS_MODE | \
|
#define TDI_SERVICE_FLAGS (TDI_SERVICE_CONNECTIONLESS_MODE | \
|
||||||
TDI_SERVICE_BROADCAST_SUPPORTED)
|
TDI_SERVICE_BROADCAST_SUPPORTED)
|
||||||
|
|
|
@ -12,16 +12,18 @@
|
||||||
|
|
||||||
#include <ipifcons.h>
|
#include <ipifcons.h>
|
||||||
|
|
||||||
|
/* See iptypes.h */
|
||||||
|
#define MAX_ADAPTER_DESCRIPTION_LENGTH 128
|
||||||
|
|
||||||
TDI_STATUS InfoTdiQueryGetInterfaceMIB(TDIEntityID ID,
|
TDI_STATUS InfoTdiQueryGetInterfaceMIB(TDIEntityID ID,
|
||||||
PIP_INTERFACE Interface,
|
PIP_INTERFACE Interface,
|
||||||
PNDIS_BUFFER Buffer,
|
PNDIS_BUFFER Buffer,
|
||||||
PUINT BufferSize) {
|
PUINT BufferSize) {
|
||||||
TDI_STATUS Status = TDI_INVALID_REQUEST;
|
TDI_STATUS Status = TDI_INVALID_REQUEST;
|
||||||
PIFENTRY OutData;
|
IFEntry* OutData;
|
||||||
PLAN_ADAPTER IF;
|
PLAN_ADAPTER IF;
|
||||||
PCHAR IFDescr;
|
PCHAR IFDescr;
|
||||||
ULONG Size;
|
ULONG Size;
|
||||||
UINT DescrLenMax = MAX_IFDESCR_LEN - 1;
|
|
||||||
NDIS_STATUS NdisStatus;
|
NDIS_STATUS NdisStatus;
|
||||||
|
|
||||||
if (!Interface)
|
if (!Interface)
|
||||||
|
@ -33,69 +35,65 @@ TDI_STATUS InfoTdiQueryGetInterfaceMIB(TDIEntityID ID,
|
||||||
("Getting IFEntry MIB (IF %08x LA %08x) (%04x:%d)\n",
|
("Getting IFEntry MIB (IF %08x LA %08x) (%04x:%d)\n",
|
||||||
Interface, IF, ID.tei_entity, ID.tei_instance));
|
Interface, IF, ID.tei_entity, ID.tei_instance));
|
||||||
|
|
||||||
OutData =
|
OutData = ExAllocatePool( NonPagedPool, FIELD_OFFSET(IFEntry, if_descr[MAX_ADAPTER_DESCRIPTION_LENGTH + 1]));
|
||||||
(PIFENTRY)ExAllocatePool( NonPagedPool,
|
|
||||||
sizeof(IFENTRY) + MAX_IFDESCR_LEN );
|
|
||||||
|
|
||||||
if( !OutData ) return TDI_NO_RESOURCES; /* Out of memory */
|
if( !OutData ) return TDI_NO_RESOURCES; /* Out of memory */
|
||||||
|
|
||||||
RtlZeroMemory( OutData, sizeof(IFENTRY) + MAX_IFDESCR_LEN );
|
RtlZeroMemory( OutData, FIELD_OFFSET(IFEntry, if_descr[MAX_ADAPTER_DESCRIPTION_LENGTH + 1]));
|
||||||
|
|
||||||
OutData->Index = Interface->Index;
|
OutData->if_index = Interface->Index;
|
||||||
/* viz: tcpip keeps those indices */
|
/* viz: tcpip keeps those indices */
|
||||||
OutData->Type = Interface ==
|
OutData->if_type = Interface ==
|
||||||
Loopback ? MIB_IF_TYPE_LOOPBACK : MIB_IF_TYPE_ETHERNET;
|
Loopback ? MIB_IF_TYPE_LOOPBACK : MIB_IF_TYPE_ETHERNET;
|
||||||
OutData->Mtu = Interface->MTU;
|
OutData->if_mtu = Interface->MTU;
|
||||||
TI_DbgPrint(DEBUG_INFO,
|
TI_DbgPrint(DEBUG_INFO,
|
||||||
("Getting interface speed\n"));
|
("Getting interface speed\n"));
|
||||||
OutData->PhysAddrLen = Interface->AddressLength;
|
OutData->if_physaddrlen = Interface->AddressLength;
|
||||||
OutData->AdminStatus = MIB_IF_ADMIN_STATUS_UP;
|
OutData->if_adminstatus = MIB_IF_ADMIN_STATUS_UP;
|
||||||
/* NDIS_HARDWARE_STATUS -> ROUTER_CONNECTION_STATE */
|
/* NDIS_HARDWARE_STATUS -> ROUTER_CONNECTION_STATE */
|
||||||
Status = GetInterfaceConnectionStatus( Interface, &OutData->OperStatus );
|
Status = GetInterfaceConnectionStatus( Interface, &OutData->if_operstatus );
|
||||||
|
|
||||||
/* Not sure what to do here, but not ready seems a safe bet on failure */
|
/* Not sure what to do here, but not ready seems a safe bet on failure */
|
||||||
if( !NT_SUCCESS(Status) )
|
if( !NT_SUCCESS(Status) )
|
||||||
OutData->OperStatus = NdisHardwareStatusNotReady;
|
OutData->if_operstatus = NdisHardwareStatusNotReady;
|
||||||
|
|
||||||
IFDescr = (PCHAR)&OutData[1];
|
IFDescr = (PCHAR)&OutData->if_descr[0];
|
||||||
|
|
||||||
if( IF ) {
|
if( IF ) {
|
||||||
GetInterfaceSpeed( Interface, (PUINT)&OutData->Speed );
|
GetInterfaceSpeed( Interface, (PUINT)&OutData->if_speed );
|
||||||
TI_DbgPrint(DEBUG_INFO,
|
TI_DbgPrint(DEBUG_INFO,
|
||||||
("IF Speed = %d * 100bps\n", OutData->Speed));
|
("IF Speed = %d * 100bps\n", OutData->if_speed));
|
||||||
memcpy(OutData->PhysAddr,Interface->Address,Interface->AddressLength);
|
memcpy(OutData->if_physaddr, Interface->Address, Interface->AddressLength);
|
||||||
TI_DbgPrint(DEBUG_INFO, ("Got HWAddr\n"));
|
TI_DbgPrint(DEBUG_INFO, ("Got HWAddr\n"));
|
||||||
|
|
||||||
memcpy(&OutData->InOctets, &Interface->Stats, sizeof(SEND_RECV_STATS));
|
memcpy(&OutData->if_inoctets, &Interface->Stats, sizeof(SEND_RECV_STATS));
|
||||||
|
|
||||||
NdisStatus = NDISCall(IF,
|
NdisStatus = NDISCall(IF,
|
||||||
NdisRequestQueryInformation,
|
NdisRequestQueryInformation,
|
||||||
OID_GEN_XMIT_ERROR,
|
OID_GEN_XMIT_ERROR,
|
||||||
&OutData->OutErrors,
|
&OutData->if_outerrors,
|
||||||
sizeof(ULONG));
|
sizeof(ULONG));
|
||||||
if (NdisStatus != NDIS_STATUS_SUCCESS)
|
if (NdisStatus != NDIS_STATUS_SUCCESS)
|
||||||
OutData->OutErrors = 0;
|
OutData->if_outerrors = 0;
|
||||||
|
|
||||||
TI_DbgPrint(DEBUG_INFO, ("OutErrors = %d\n", OutData->OutErrors));
|
TI_DbgPrint(DEBUG_INFO, ("OutErrors = %d\n", OutData->if_outerrors));
|
||||||
|
|
||||||
NdisStatus = NDISCall(IF,
|
NdisStatus = NDISCall(IF,
|
||||||
NdisRequestQueryInformation,
|
NdisRequestQueryInformation,
|
||||||
OID_GEN_RCV_ERROR,
|
OID_GEN_RCV_ERROR,
|
||||||
&OutData->InErrors,
|
&OutData->if_inerrors,
|
||||||
sizeof(ULONG));
|
sizeof(ULONG));
|
||||||
if (NdisStatus != NDIS_STATUS_SUCCESS)
|
if (NdisStatus != NDIS_STATUS_SUCCESS)
|
||||||
OutData->InErrors = 0;
|
OutData->if_inerrors = 0;
|
||||||
|
|
||||||
TI_DbgPrint(DEBUG_INFO, ("InErrors = %d\n", OutData->InErrors));
|
TI_DbgPrint(DEBUG_INFO, ("InErrors = %d\n", OutData->if_inerrors));
|
||||||
}
|
}
|
||||||
|
|
||||||
GetInterfaceName( Interface, IFDescr, MAX_IFDESCR_LEN - 1 );
|
GetInterfaceName( Interface, IFDescr, MAX_ADAPTER_DESCRIPTION_LENGTH );
|
||||||
DescrLenMax = strlen( IFDescr ) + 1;
|
|
||||||
|
|
||||||
TI_DbgPrint(DEBUG_INFO, ("Copied in name %s\n", IFDescr));
|
TI_DbgPrint(DEBUG_INFO, ("Copied in name %s\n", IFDescr));
|
||||||
OutData->DescrLen = DescrLenMax;
|
OutData->if_descrlen = strlen(IFDescr);
|
||||||
IFDescr += DescrLenMax;
|
Size = FIELD_OFFSET(IFEntry, if_descr[OutData->if_descrlen + 1]);
|
||||||
Size = IFDescr - (PCHAR)OutData + 1;
|
|
||||||
|
|
||||||
TI_DbgPrint(DEBUG_INFO, ("Finished IFEntry MIB (%04x:%d) size %d\n",
|
TI_DbgPrint(DEBUG_INFO, ("Finished IFEntry MIB (%04x:%d) size %d\n",
|
||||||
ID.tei_entity, ID.tei_instance, Size));
|
ID.tei_entity, ID.tei_instance, Size));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue