Retrieving Statistics for IP and ICMP
A version of this page is also available for
4/8/2010
IP Helper provides information retrieval capabilities that are useful for the network administration of the local computer. The following functions retrieve statistics for the Internet Protocol (IP) and the Internet Control Message Protocol (ICMP). You can also use these functions to set certain configuration parameters for IP.
The GetIpStatistics function retrieves the current IP statistics for the local machine. The GetIcmpStatistics function retrieves the current ICMP statistics.
Use the SetIpStatistics function to enable or disable IP forwarding. This function also makes it possible for you to set the default time-to-live (TTL) for IP datagrams. Alternatively, you can set the TTL by using the SetIpTTL function.
The following table describes each GetIpStatistics variable and MIB_IPSTATS member.
Value | Description |
---|---|
pStats |
Pointer to a MIB_IPSTATS structure that, on successful return, contains the IP statistics for the local computer. |
MIB_IPSTATS (All fields are read-write, and can be changed by the API user with the SetIpStatistics function) |
dwForwarding Specifies whether IP forwarding is enabled or disabled. dwDefaultTTL Specifies the default initial time to live (TTL) for datagrams originating on a particular computer. dwInReceives Specifies the number of datagrams received. dwInHdrErrors Specifies the number of datagrams received that have header errors. dwInAddrErrors Specifies the number of datagrams received that have address errors. dwForwDatagrams Specifies the number of datagrams forwarded. dwInUnknownProtos Specifies the number of datagrams received that have an unknown protocol. dwInDiscards Specifies the number of received datagrams discarded. dwInDelivers Specifies the number of received datagrams delivered. dwOutRequests Specifies the number of outgoing datagrams that IP is requested to transmit. This number does not include forwarded datagrams. dwRoutingDiscards Specifies the number of outgoing datagrams discarded. dwOutDiscards Specifies the number of transmitted datagrams discarded. dwOutNoRoutes Specifies the number of datagrams for which this computer did not have a route to the destination IP address. These datagrams were discarded. DwReasmTimeout Specifies the amount of time allowed for all pieces of a fragmented datagram to arrive. If all pieces do not arrive within this time, the datagram is discarded. dwReasmReqds Specifies the number of datagrams requiring reassembly. dwReasmOks Specifies the number of datagrams successfully reassembled. dwReasmFails Specifies the number of datagrams that cannot be reassembled. dwFragOks Specifies the number of datagrams that were fragmented successfully. dwFragFails Specifies the number of datagrams that cannot be fragmented because the "do not fragment" bit in the IP header is set. These datagrams are discarded. dwFragCreates Specifies the number of fragments created. dwNumIf Specifies the number of interfaces. dwNumAddr Specifies the number of IP addresses associated with this computer. dwNumRoutes Specifies the number of routes in the IP routing table. |
The following table describes each GetIcmpStatistics variable and MIB_ICMP member.
Value | Description |
---|---|
pStats |
Pointer to a MIB_ICMP structure that, on successful return, contains the ICMP statistics for the local computer. |
MIB_ICMP |
stats Specifies a MIBICMPINFO structure that contains the ICMP statistics for the computer. |
MIBICMPINFO (All fields are read-only, and cannot be changed by the API user) |
icmpInStats Specifies an MIBICMPSTATS structure that contains the statistics for incoming ICMP messages. icmpOutStats Specifies an MIBICMPSTATS structure that contains the statistics for outgoing ICMP messages. |
MIBICMPSTATS (All fields are read-only, and cannot be changed by the API user) |
dwMsgs Specifies the number of messages received or sent. dwErrors Specifies the number of errors received or sent. dwDestUnreachs Specifies the number of destination-unreachable messages received or sent. A destination-unreachable message is sent to the originating computer when a datagram fails to reach its intended destination. dwTimeExcds Specifies the number of time-to-live (TTL) exceeded messages received or sent. A time-to-live exceeded message is sent to the originating computer when a datagram is discarded because the number of routers it has passed through exceeds its time-to-live value. dwParmProbs Specifies the number of parameter problem messages received or sent. A parameter problem message is sent to the originating computer when a router or host detects an error in a datagram's IP header. dwSrcQuenchs Specifies the number of source quench messages received or sent. A source quench request is sent to a computer to request that it reduce its rate of packet transmission. dwRedirects Specifies the number of redirect messages received or sent. A redirect message is sent to the originating computer when a better route is discovered for a datagram sent by that computer. dwEchos Specifies the number of echo requests received or sent. An echo request causes the receiving computer to send an echo reply message back to the originating computer. dwEchoReps Specifies the number of echo replies received or sent. A computer sends an echo reply in response to receiving an echo request message. dwTimestamps Specifies the number of time-stamp requests received or sent. A time-stamp request causes the receiving computer to send a time-stamp reply back to the originating computer. dwTimestampReps Specifies the number of time-stamp replies received or sent. A computer sends a time-stamp reply in response to receiving a time-stamp request. Routers can use time-stamp requests and replies to measure the transmission speed of datagrams on a network. dwAddrMasks Specifies the number of address mask requests received or sent. A computer sends an address mask request to determine the number of bits in the subnet mask for its local subnet. dwAddrMaskReps Specifies the number of address mask responses received or sent. A computer sends an address mask response in response to an address mask request. |
The following table describes each SetIpStatistics variable.
Value | Description |
---|---|
pIpStats |
Pointer to a MIB_IPSTATS structure (see the GetIpStatistics description above). The caller should set the dwForwarding and dwDefaultTTL members of this structure to the new values. To keep one of the members at its current value, use MIB_USE_CURRENT_TTL or MIB_USE_CURRENT_FORWARDING. |
The following table describes each SetIpTTL variable.
Value | Description |
---|---|
nTTL |
Specifies the new TTL value for the local computer. |