Module org.jnetpcap

Record Class PcapStatExRecord

java.lang.Object
java.lang.Record
org.jnetpcap.internal.PcapStatExRecord
All Implemented Interfaces:
PcapStat, PcapStatEx

public record PcapStatExRecord(int size, long recv, long drop, long ifdrop, long capt, long sent, long netdrop, long rxPackets, long txPackets, long rxBytes, long txBytes, long rxErrors, long txErrors, long rxDropped, long txDropped, long multicast, long collisions, long rxLengthErrors, long rxOverErrors, long rxCrcErrors, long rxFrameErrors, long rxFifoErrors, long rxMissedErrors, long txAbortedErrors, long txCarrierErrors, long txFifoErrors, long txHeartbeatErrors, long txWindowErrrors) extends Record implements PcapStatEx
Represents extended statistics about network interface performance and error counts. This record encapsulates both standard pcap statistics and additional network interface statistics typically available on Linux and Windows systems.

Statistics Categories

The statistics are grouped into several categories:

1. Basic Pcap Statistics

  • recv - Packets received by the interface
  • drop - Packets dropped by the interface due to insufficient buffer space
  • ifdrop - Packets dropped by the interface driver
  • capt - Packets actually captured and processed
  • sent - Packets sent by the interface
  • netdrop - Packets dropped by the network

2. General Interface Statistics

  • rxPackets/txPackets - Total packets received/transmitted
  • rxBytes/txBytes - Total bytes received/transmitted
  • rxErrors/txErrors - Total error counts for receive/transmit
  • rxDropped/txDropped - Packets dropped during receive/transmit
  • multicast - Multicast packets received
  • collisions - Number of collisions detected

3. Detailed Receive Errors

  • rxLengthErrors - Packets dropped due to incorrect length
  • rxOverErrors - Receiver ring buffer overflow errors
  • rxCrcErrors - Packets with CRC/FCS errors
  • rxFrameErrors - Packets with frame alignment errors
  • rxFifoErrors - FIFO buffer errors
  • rxMissedErrors - Packets missed due to lack of resources

4. Detailed Transmit Errors

  • txAbortedErrors - Transmission aborted errors
  • txCarrierErrors - Carrier errors during transmission
  • txFifoErrors - FIFO buffer errors during transmission
  • txHeartbeatErrors - Heartbeat errors during transmission
  • txWindowErrors - TCP window errors during transmission

Usage Example


 PcapStatExRecord stats = ...;
 
 // Check basic packet statistics
 long packetsReceived = stats.recv();
 long packetsDropped = stats.drop();
 
 // Analyze error rates
 double errorRate = (double) stats.rxErrors() / stats.rxPackets();
 
 // Check specific error types
 if (stats.rxCrcErrors() > 0) {
     // Handle CRC errors
 }
 
Author:
Mark Bednarczyk
See Also: