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
Modifier and TypeFieldDescriptionstatic final int
The Constant PCAP_STAT_EX_LENGTH. -
Constructor Summary
ConstructorDescriptionPcapStatExRecord
(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 aPcapStatExRecord
record class.PcapStatExRecord
(int size, MemorySegment mseg) Creates a new PcapStatExRecord instance from a native memory segment. -
Method Summary
Modifier and TypeMethodDescriptionlong
capt()
Returns the value of thecapt
record component.long
Returns the value of thecollisions
record component.long
drop()
Returns the value of thedrop
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.long
ifdrop()
Returns the value of theifdrop
record component.long
Returns the value of themulticast
record component.long
netdrop()
Returns the value of thenetdrop
record component.long
recv()
Returns the value of therecv
record component.long
rxBytes()
Returns the value of therxBytes
record component.long
Returns the value of therxCrcErrors
record component.long
Returns the value of therxDropped
record component.long
rxErrors()
Returns the value of therxErrors
record component.long
Returns the value of therxFifoErrors
record component.long
Returns the value of therxFrameErrors
record component.long
Returns the value of therxLengthErrors
record component.long
Returns the value of therxMissedErrors
record component.long
Returns the value of therxOverErrors
record component.long
Returns the value of therxPackets
record component.long
sent()
Returns the value of thesent
record component.int
size()
Returns the value of thesize
record component.static long
sizeOf()
Returns the size of the native pcap_stat_ex structure in bytes.final String
toString()
Returns a string representation of this record class.long
Returns the value of thetxAbortedErrors
record component.long
txBytes()
Returns the value of thetxBytes
record component.long
Returns the value of thetxCarrierErrors
record component.long
Returns the value of thetxDropped
record component.long
txErrors()
Returns the value of thetxErrors
record component.long
Returns the value of thetxFifoErrors
record component.long
Returns the value of thetxHeartbeatErrors
record component.long
Returns the value of thetxPackets
record component.long
Returns the value of thetxWindowErrrors
record 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 aPcapStatExRecord
record class.- Parameters:
size
- the value for thesize
record componentrecv
- the value for therecv
record componentdrop
- the value for thedrop
record componentifdrop
- the value for theifdrop
record componentcapt
- the value for thecapt
record componentsent
- the value for thesent
record componentnetdrop
- the value for thenetdrop
record componentrxPackets
- the value for therxPackets
record componenttxPackets
- the value for thetxPackets
record componentrxBytes
- the value for therxBytes
record componenttxBytes
- the value for thetxBytes
record componentrxErrors
- the value for therxErrors
record componenttxErrors
- the value for thetxErrors
record componentrxDropped
- the value for therxDropped
record componenttxDropped
- the value for thetxDropped
record componentmulticast
- the value for themulticast
record componentcollisions
- the value for thecollisions
record componentrxLengthErrors
- the value for therxLengthErrors
record componentrxOverErrors
- the value for therxOverErrors
record componentrxCrcErrors
- the value for therxCrcErrors
record componentrxFrameErrors
- the value for therxFrameErrors
record componentrxFifoErrors
- the value for therxFifoErrors
record componentrxMissedErrors
- the value for therxMissedErrors
record componenttxAbortedErrors
- the value for thetxAbortedErrors
record componenttxCarrierErrors
- the value for thetxCarrierErrors
record componenttxFifoErrors
- the value for thetxFifoErrors
record componenttxHeartbeatErrors
- the value for thetxHeartbeatErrors
record componenttxWindowErrrors
- the value for thetxWindowErrrors
record 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 thesize
record component.- Specified by:
size
in interfacePcapStatEx
- Returns:
- the value of the
size
record component
-
recv
public long recv()Returns the value of therecv
record component.- Specified by:
recv
in interfacePcapStat
- Specified by:
recv
in interfacePcapStatEx
- Returns:
- the value of the
recv
record component - See Also:
-
drop
public long drop()Returns the value of thedrop
record component.- Specified by:
drop
in interfacePcapStat
- Specified by:
drop
in interfacePcapStatEx
- Returns:
- the value of the
drop
record component - See Also:
-
ifdrop
public long ifdrop()Returns the value of theifdrop
record component.- Specified by:
ifdrop
in interfacePcapStat
- Specified by:
ifdrop
in interfacePcapStatEx
- Returns:
- the value of the
ifdrop
record component - See Also:
-
capt
public long capt()Returns the value of thecapt
record component.- Specified by:
capt
in interfacePcapStat
- Specified by:
capt
in interfacePcapStatEx
- Returns:
- the value of the
capt
record component - See Also:
-
sent
public long sent()Returns the value of thesent
record component.- Specified by:
sent
in interfacePcapStat
- Specified by:
sent
in interfacePcapStatEx
- Returns:
- the value of the
sent
record component - See Also:
-
netdrop
public long netdrop()Returns the value of thenetdrop
record component.- Specified by:
netdrop
in interfacePcapStat
- Specified by:
netdrop
in interfacePcapStatEx
- Returns:
- the value of the
netdrop
record component - See Also:
-
rxPackets
public long rxPackets()Returns the value of therxPackets
record component.- Specified by:
rxPackets
in interfacePcapStatEx
- Returns:
- the value of the
rxPackets
record component
-
txPackets
public long txPackets()Returns the value of thetxPackets
record component.- Specified by:
txPackets
in interfacePcapStatEx
- Returns:
- the value of the
txPackets
record component
-
rxBytes
public long rxBytes()Returns the value of therxBytes
record component.- Specified by:
rxBytes
in interfacePcapStatEx
- Returns:
- the value of the
rxBytes
record component
-
txBytes
public long txBytes()Returns the value of thetxBytes
record component.- Specified by:
txBytes
in interfacePcapStatEx
- Returns:
- the value of the
txBytes
record component
-
rxErrors
public long rxErrors()Returns the value of therxErrors
record component.- Specified by:
rxErrors
in interfacePcapStatEx
- Returns:
- the value of the
rxErrors
record component
-
txErrors
public long txErrors()Returns the value of thetxErrors
record component.- Specified by:
txErrors
in interfacePcapStatEx
- Returns:
- the value of the
txErrors
record component
-
rxDropped
public long rxDropped()Returns the value of therxDropped
record component.- Specified by:
rxDropped
in interfacePcapStatEx
- Returns:
- the value of the
rxDropped
record component
-
txDropped
public long txDropped()Returns the value of thetxDropped
record component.- Specified by:
txDropped
in interfacePcapStatEx
- Returns:
- the value of the
txDropped
record component
-
multicast
public long multicast()Returns the value of themulticast
record component.- Specified by:
multicast
in interfacePcapStatEx
- Returns:
- the value of the
multicast
record component
-
collisions
public long collisions()Returns the value of thecollisions
record component.- Specified by:
collisions
in interfacePcapStatEx
- Returns:
- the value of the
collisions
record component
-
rxLengthErrors
public long rxLengthErrors()Returns the value of therxLengthErrors
record component.- Specified by:
rxLengthErrors
in interfacePcapStatEx
- Returns:
- the value of the
rxLengthErrors
record component
-
rxOverErrors
public long rxOverErrors()Returns the value of therxOverErrors
record component.- Specified by:
rxOverErrors
in interfacePcapStatEx
- Returns:
- the value of the
rxOverErrors
record component
-
rxCrcErrors
public long rxCrcErrors()Returns the value of therxCrcErrors
record component.- Specified by:
rxCrcErrors
in interfacePcapStatEx
- Returns:
- the value of the
rxCrcErrors
record component
-
rxFrameErrors
public long rxFrameErrors()Returns the value of therxFrameErrors
record component.- Specified by:
rxFrameErrors
in interfacePcapStatEx
- Returns:
- the value of the
rxFrameErrors
record component
-
rxFifoErrors
public long rxFifoErrors()Returns the value of therxFifoErrors
record component.- Specified by:
rxFifoErrors
in interfacePcapStatEx
- Returns:
- the value of the
rxFifoErrors
record component
-
rxMissedErrors
public long rxMissedErrors()Returns the value of therxMissedErrors
record component.- Specified by:
rxMissedErrors
in interfacePcapStatEx
- Returns:
- the value of the
rxMissedErrors
record component
-
txAbortedErrors
public long txAbortedErrors()Returns the value of thetxAbortedErrors
record component.- Specified by:
txAbortedErrors
in interfacePcapStatEx
- Returns:
- the value of the
txAbortedErrors
record component
-
txCarrierErrors
public long txCarrierErrors()Returns the value of thetxCarrierErrors
record component.- Specified by:
txCarrierErrors
in interfacePcapStatEx
- Returns:
- the value of the
txCarrierErrors
record component
-
txFifoErrors
public long txFifoErrors()Returns the value of thetxFifoErrors
record component.- Specified by:
txFifoErrors
in interfacePcapStatEx
- Returns:
- the value of the
txFifoErrors
record component
-
txHeartbeatErrors
public long txHeartbeatErrors()Returns the value of thetxHeartbeatErrors
record component.- Specified by:
txHeartbeatErrors
in interfacePcapStatEx
- Returns:
- the value of the
txHeartbeatErrors
record component
-
txWindowErrrors
public long txWindowErrrors()Returns the value of thetxWindowErrrors
record component.- Specified by:
txWindowErrrors
in interfacePcapStatEx
- Returns:
- the value of the
txWindowErrrors
record component
-