mirror of
https://github.com/reactos/reactos.git
synced 2024-10-08 02:13:56 +00:00
- Start reporting packet statistics
- We currently only report received bytes, sent bytes, discarded packets due to unknown protocol, send errors, and receive errors - The network adapter properties window now shows correct send/receive bytes info svn path=/trunk/; revision=41962
This commit is contained in:
parent
09fbbfac10
commit
202957e751
|
@ -134,6 +134,19 @@ typedef struct _LLIP_BIND_INFO {
|
|||
LL_TRANSMIT_ROUTINE Transmit; /* Transmit function for this interface */
|
||||
} LLIP_BIND_INFO, *PLLIP_BIND_INFO;
|
||||
|
||||
typedef struct _SEND_RECV_STATS {
|
||||
UINT InBytes;
|
||||
UINT InUnicast;
|
||||
UINT InNUnicast;
|
||||
UINT InDiscarded;
|
||||
UINT InErrors;
|
||||
UINT InDiscardedUnknownProto;
|
||||
UINT OutBytes;
|
||||
UINT OutUnicast;
|
||||
UINT OutNUnicast;
|
||||
UINT OutDiscarded;
|
||||
UINT OutErrors;
|
||||
} SEND_RECV_STATS, *PSEND_RECV_STATS;
|
||||
|
||||
/* Information about an IP interface */
|
||||
typedef struct _IP_INTERFACE {
|
||||
|
@ -157,6 +170,7 @@ typedef struct _IP_INTERFACE {
|
|||
UINT Index; /* Index of adapter (used to add ip addr) */
|
||||
LL_TRANSMIT_ROUTINE Transmit; /* Pointer to transmit function */
|
||||
PVOID TCPContext; /* TCP Content for this interface */
|
||||
SEND_RECV_STATS Stats; /* Send/Receive statistics */
|
||||
} IP_INTERFACE, *PIP_INTERFACE;
|
||||
|
||||
typedef struct _IP_SET_ADDRESS {
|
||||
|
|
|
@ -20,6 +20,7 @@ TDI_STATUS InfoTdiQueryGetInterfaceMIB(TDIEntityID *ID,
|
|||
PCHAR IFDescr;
|
||||
ULONG Size;
|
||||
UINT DescrLenMax = MAX_IFDESCR_LEN - 1;
|
||||
NDIS_STATUS NdisStatus;
|
||||
|
||||
TI_DbgPrint(DEBUG_INFO,
|
||||
("Getting IFEntry MIB (IF %08x LA %08x) (%04x:%d)\n",
|
||||
|
@ -57,6 +58,28 @@ TDI_STATUS InfoTdiQueryGetInterfaceMIB(TDIEntityID *ID,
|
|||
("IF Speed = %d * 100bps\n", OutData->Speed));
|
||||
memcpy(OutData->PhysAddr,Interface->Address,Interface->AddressLength);
|
||||
TI_DbgPrint(DEBUG_INFO, ("Got HWAddr\n"));
|
||||
|
||||
memcpy(&OutData->InOctets, &Interface->Stats, sizeof(SEND_RECV_STATS));
|
||||
|
||||
NdisStatus = NDISCall(IF,
|
||||
NdisRequestQueryInformation,
|
||||
OID_GEN_XMIT_ERROR,
|
||||
&OutData->OutErrors,
|
||||
sizeof(ULONG));
|
||||
if (NdisStatus != NDIS_STATUS_SUCCESS)
|
||||
OutData->OutErrors = 0;
|
||||
|
||||
TI_DbgPrint(DEBUG_INFO, ("OutErrors = %d\n", OutData->OutErrors));
|
||||
|
||||
NdisStatus = NDISCall(IF,
|
||||
NdisRequestQueryInformation,
|
||||
OID_GEN_RCV_ERROR,
|
||||
&OutData->InErrors,
|
||||
sizeof(ULONG));
|
||||
if (NdisStatus != NDIS_STATUS_SUCCESS)
|
||||
OutData->InErrors = 0;
|
||||
|
||||
TI_DbgPrint(DEBUG_INFO, ("InErrors = %d\n", OutData->InErrors));
|
||||
}
|
||||
|
||||
GetInterfaceName( Interface, IFDescr, MAX_IFDESCR_LEN - 1 );
|
||||
|
|
|
@ -323,6 +323,8 @@ VOID DefaultProtocolHandler(
|
|||
{
|
||||
TI_DbgPrint(MID_TRACE, ("[IF %x] Packet of unknown Internet protocol "
|
||||
"discarded.\n", Interface));
|
||||
|
||||
Interface->Stats.InDiscardedUnknownProto++;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -464,6 +464,8 @@ VOID ProcessFragment(
|
|||
/* Give the packet to the protocol dispatcher */
|
||||
IPDispatchProtocol(IF, &Datagram);
|
||||
|
||||
IF->Stats.InBytes += Datagram.TotalSize;
|
||||
|
||||
/* We're done with this datagram */
|
||||
exFreePool(Datagram.Header);
|
||||
TI_DbgPrint(MAX_TRACE, ("Freeing datagram at (0x%X).\n", Datagram));
|
||||
|
|
|
@ -240,6 +240,8 @@ NTSTATUS IPSendDatagram(PIP_PACKET IPPacket, PNEIGHBOR_CACHE_ENTRY NCE,
|
|||
* send routine (IPSendFragment)
|
||||
*/
|
||||
{
|
||||
UINT PacketSize;
|
||||
|
||||
TI_DbgPrint(MAX_TRACE, ("Called. IPPacket (0x%X) NCE (0x%X)\n", IPPacket, NCE));
|
||||
|
||||
DISPLAY_IP_PACKET(IPPacket);
|
||||
|
@ -264,6 +266,14 @@ NTSTATUS IPSendDatagram(PIP_PACKET IPPacket, PNEIGHBOR_CACHE_ENTRY NCE,
|
|||
IPPacket->Flags));
|
||||
}
|
||||
|
||||
NdisQueryPacket(IPPacket->NdisPacket,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
&PacketSize);
|
||||
|
||||
NCE->Interface->Stats.OutBytes += PacketSize;
|
||||
|
||||
return SendFragments(IPPacket, NCE, NCE->Interface->MTU,
|
||||
Complete, Context);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue