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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe Constant PCAP_STAT_EX_LENGTH. -
Constructor Summary
ConstructorsConstructorDescriptionPcapStatExRecord(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) Creates an instance of aPcapStatExRecordrecord class.PcapStatExRecord(int size, MemorySegment mseg) Creates a new PcapStatExRecord instance from a native memory segment. -
Method Summary
Modifier and TypeMethodDescriptionlongcapt()Returns the value of thecaptrecord component.longReturns the value of thecollisionsrecord component.longdrop()Returns the value of thedroprecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.longifdrop()Returns the value of theifdroprecord component.longReturns the value of themulticastrecord component.longnetdrop()Returns the value of thenetdroprecord component.longrecv()Returns the value of therecvrecord component.longrxBytes()Returns the value of therxBytesrecord component.longReturns the value of therxCrcErrorsrecord component.longReturns the value of therxDroppedrecord component.longrxErrors()Returns the value of therxErrorsrecord component.longReturns the value of therxFifoErrorsrecord component.longReturns the value of therxFrameErrorsrecord component.longReturns the value of therxLengthErrorsrecord component.longReturns the value of therxMissedErrorsrecord component.longReturns the value of therxOverErrorsrecord component.longReturns the value of therxPacketsrecord component.longsent()Returns the value of thesentrecord component.intsize()Returns the value of thesizerecord component.static longsizeOf()Returns the size of the native pcap_stat_ex structure in bytes.final StringtoString()Returns a string representation of this record class.longReturns the value of thetxAbortedErrorsrecord component.longtxBytes()Returns the value of thetxBytesrecord component.longReturns the value of thetxCarrierErrorsrecord component.longReturns the value of thetxDroppedrecord component.longtxErrors()Returns the value of thetxErrorsrecord component.longReturns the value of thetxFifoErrorsrecord component.longReturns the value of thetxHeartbeatErrorsrecord component.longReturns the value of thetxPacketsrecord component.longReturns the value of thetxWindowErrrorsrecord component.
-
Field Details
-
PCAP_STAT_EX_LENGTH
public static final int PCAP_STAT_EX_LENGTHThe Constant PCAP_STAT_EX_LENGTH.
-
-
Constructor Details
-
PcapStatExRecord
Creates a new PcapStatExRecord instance from a native memory segment. This constructor reads all statistics fields from the native memory and converts them to appropriate Java types.- Parameters:
size- The expected size of the native structuremseg- The memory segment containing the native pcap_stat_ex structure- Throws:
IllegalArgumentException- if the memory segment size doesn't match the expected size
-
PcapStatExRecord
public 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) Creates an instance of aPcapStatExRecordrecord class.- Parameters:
size- the value for thesizerecord componentrecv- the value for therecvrecord componentdrop- the value for thedroprecord componentifdrop- the value for theifdroprecord componentcapt- the value for thecaptrecord componentsent- the value for thesentrecord componentnetdrop- the value for thenetdroprecord componentrxPackets- the value for therxPacketsrecord componenttxPackets- the value for thetxPacketsrecord componentrxBytes- the value for therxBytesrecord componenttxBytes- the value for thetxBytesrecord componentrxErrors- the value for therxErrorsrecord componenttxErrors- the value for thetxErrorsrecord componentrxDropped- the value for therxDroppedrecord componenttxDropped- the value for thetxDroppedrecord componentmulticast- the value for themulticastrecord componentcollisions- the value for thecollisionsrecord componentrxLengthErrors- the value for therxLengthErrorsrecord componentrxOverErrors- the value for therxOverErrorsrecord componentrxCrcErrors- the value for therxCrcErrorsrecord componentrxFrameErrors- the value for therxFrameErrorsrecord componentrxFifoErrors- the value for therxFifoErrorsrecord componentrxMissedErrors- the value for therxMissedErrorsrecord componenttxAbortedErrors- the value for thetxAbortedErrorsrecord componenttxCarrierErrors- the value for thetxCarrierErrorsrecord componenttxFifoErrors- the value for thetxFifoErrorsrecord componenttxHeartbeatErrors- the value for thetxHeartbeatErrorsrecord componenttxWindowErrrors- the value for thetxWindowErrrorsrecord component
-
-
Method Details
-
sizeOf
public static long sizeOf()Returns the size of the native pcap_stat_ex structure in bytes. This value is platform-dependent and may vary based on the operating system and architecture.- Returns:
- The size of the native structure in bytes
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='. -
size
public int size()Returns the value of thesizerecord component.- Specified by:
sizein interfacePcapStatEx- Returns:
- the value of the
sizerecord component
-
recv
public long recv()Returns the value of therecvrecord component.- Specified by:
recvin interfacePcapStat- Specified by:
recvin interfacePcapStatEx- Returns:
- the value of the
recvrecord component - See Also:
-
drop
public long drop()Returns the value of thedroprecord component.- Specified by:
dropin interfacePcapStat- Specified by:
dropin interfacePcapStatEx- Returns:
- the value of the
droprecord component - See Also:
-
ifdrop
public long ifdrop()Returns the value of theifdroprecord component.- Specified by:
ifdropin interfacePcapStat- Specified by:
ifdropin interfacePcapStatEx- Returns:
- the value of the
ifdroprecord component - See Also:
-
capt
public long capt()Returns the value of thecaptrecord component.- Specified by:
captin interfacePcapStat- Specified by:
captin interfacePcapStatEx- Returns:
- the value of the
captrecord component - See Also:
-
sent
public long sent()Returns the value of thesentrecord component.- Specified by:
sentin interfacePcapStat- Specified by:
sentin interfacePcapStatEx- Returns:
- the value of the
sentrecord component - See Also:
-
netdrop
public long netdrop()Returns the value of thenetdroprecord component.- Specified by:
netdropin interfacePcapStat- Specified by:
netdropin interfacePcapStatEx- Returns:
- the value of the
netdroprecord component - See Also:
-
rxPackets
public long rxPackets()Returns the value of therxPacketsrecord component.- Specified by:
rxPacketsin interfacePcapStatEx- Returns:
- the value of the
rxPacketsrecord component
-
txPackets
public long txPackets()Returns the value of thetxPacketsrecord component.- Specified by:
txPacketsin interfacePcapStatEx- Returns:
- the value of the
txPacketsrecord component
-
rxBytes
public long rxBytes()Returns the value of therxBytesrecord component.- Specified by:
rxBytesin interfacePcapStatEx- Returns:
- the value of the
rxBytesrecord component
-
txBytes
public long txBytes()Returns the value of thetxBytesrecord component.- Specified by:
txBytesin interfacePcapStatEx- Returns:
- the value of the
txBytesrecord component
-
rxErrors
public long rxErrors()Returns the value of therxErrorsrecord component.- Specified by:
rxErrorsin interfacePcapStatEx- Returns:
- the value of the
rxErrorsrecord component
-
txErrors
public long txErrors()Returns the value of thetxErrorsrecord component.- Specified by:
txErrorsin interfacePcapStatEx- Returns:
- the value of the
txErrorsrecord component
-
rxDropped
public long rxDropped()Returns the value of therxDroppedrecord component.- Specified by:
rxDroppedin interfacePcapStatEx- Returns:
- the value of the
rxDroppedrecord component
-
txDropped
public long txDropped()Returns the value of thetxDroppedrecord component.- Specified by:
txDroppedin interfacePcapStatEx- Returns:
- the value of the
txDroppedrecord component
-
multicast
public long multicast()Returns the value of themulticastrecord component.- Specified by:
multicastin interfacePcapStatEx- Returns:
- the value of the
multicastrecord component
-
collisions
public long collisions()Returns the value of thecollisionsrecord component.- Specified by:
collisionsin interfacePcapStatEx- Returns:
- the value of the
collisionsrecord component
-
rxLengthErrors
public long rxLengthErrors()Returns the value of therxLengthErrorsrecord component.- Specified by:
rxLengthErrorsin interfacePcapStatEx- Returns:
- the value of the
rxLengthErrorsrecord component
-
rxOverErrors
public long rxOverErrors()Returns the value of therxOverErrorsrecord component.- Specified by:
rxOverErrorsin interfacePcapStatEx- Returns:
- the value of the
rxOverErrorsrecord component
-
rxCrcErrors
public long rxCrcErrors()Returns the value of therxCrcErrorsrecord component.- Specified by:
rxCrcErrorsin interfacePcapStatEx- Returns:
- the value of the
rxCrcErrorsrecord component
-
rxFrameErrors
public long rxFrameErrors()Returns the value of therxFrameErrorsrecord component.- Specified by:
rxFrameErrorsin interfacePcapStatEx- Returns:
- the value of the
rxFrameErrorsrecord component
-
rxFifoErrors
public long rxFifoErrors()Returns the value of therxFifoErrorsrecord component.- Specified by:
rxFifoErrorsin interfacePcapStatEx- Returns:
- the value of the
rxFifoErrorsrecord component
-
rxMissedErrors
public long rxMissedErrors()Returns the value of therxMissedErrorsrecord component.- Specified by:
rxMissedErrorsin interfacePcapStatEx- Returns:
- the value of the
rxMissedErrorsrecord component
-
txAbortedErrors
public long txAbortedErrors()Returns the value of thetxAbortedErrorsrecord component.- Specified by:
txAbortedErrorsin interfacePcapStatEx- Returns:
- the value of the
txAbortedErrorsrecord component
-
txCarrierErrors
public long txCarrierErrors()Returns the value of thetxCarrierErrorsrecord component.- Specified by:
txCarrierErrorsin interfacePcapStatEx- Returns:
- the value of the
txCarrierErrorsrecord component
-
txFifoErrors
public long txFifoErrors()Returns the value of thetxFifoErrorsrecord component.- Specified by:
txFifoErrorsin interfacePcapStatEx- Returns:
- the value of the
txFifoErrorsrecord component
-
txHeartbeatErrors
public long txHeartbeatErrors()Returns the value of thetxHeartbeatErrorsrecord component.- Specified by:
txHeartbeatErrorsin interfacePcapStatEx- Returns:
- the value of the
txHeartbeatErrorsrecord component
-
txWindowErrrors
public long txWindowErrrors()Returns the value of thetxWindowErrrorsrecord component.- Specified by:
txWindowErrrorsin interfacePcapStatEx- Returns:
- the value of the
txWindowErrrorsrecord component
-