- All Implemented Interfaces:
Serializable,Comparable<PcapHeaderABI>,Constable
Configures different ABI (Application Binary Interfaces) for access to binary
pcap header data. On 64-bit architectures the header structure in native
memory received from libpcap will be padded to end up with 24 byte header
length. When stored in ''savefiles'' and handling in non native storage will
be represented as 16 byte compact structure.
Note that MemoryLayouts are actually harder to use in this case. Thus we poke
the values directly, plus its more efficient this way.
- Author:
- Sly Technologies Inc, repos@slytechs.com, mark
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionThe compact be.The compact le.The padded be.The padded le. -
Method Summary
Modifier and TypeMethodDescriptionintcaptureLength(MemorySegment mseg) Capture length.voidcaptureLength(MemorySegment mseg, int newLength) Capture length.intcaptureLength(ByteBuffer buffer) Capture length.intCapture length offset.static PcapHeaderABICompact abi.static PcapHeaderABIcompactAbi(boolean isSwapped) Compact abi.static PcapHeaderABIcompactAbi(ByteOrder bo) Compact abi.intActual, in memory, header length as per this ABI and compiler padding.static PcapHeaderABINative abi.static PcapHeaderABINative abi.order()Order.static PcapHeaderABIPadded abi.static PcapHeaderABISelect dead abi.static PcapHeaderABISelect live abi.static PcapHeaderABIselectOfflineAbi(boolean isSwapped) Select offline abi.static PcapHeaderExceptionthrowListOfAllAbiPossibilities(ByteBuffer buffer, PcapHeaderException.OutOfRangeException cause, String name, BiFunction<PcapHeaderABI, ByteBuffer, Integer> action) Throw list of all abi possibilities.longtvSec(MemorySegment mseg) Tv sec.voidtvSec(MemorySegment mseg, long newTvSec) Tv sec.intTv sec offset.longtvUsec(MemorySegment mseg) Tv usec.voidtvUsec(MemorySegment mseg, long newTvUsec) Tv usec.intTv usec offset.static PcapHeaderABIReturns the enum constant of this class with the specified name.static PcapHeaderABI[]values()Returns an array containing the constants of this enum class, in the order they are declared.intwireLength(MemorySegment mseg) Wire length.voidwireLength(MemorySegment mseg, int newLength) Wire length.intwireLength(ByteBuffer buffer) Wire length.intWire length offset.
-
Enum Constant Details
-
COMPACT_LE
The compact le. -
COMPACT_BE
The compact be. -
PADDED_LE
The padded le. -
PADDED_BE
The padded be.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
compactAbi
-
compactAbi
Compact abi.- Parameters:
isSwapped- the is swapped- Returns:
- the pcap header ABI
-
compactAbi
Compact abi.- Parameters:
bo- the bo- Returns:
- the pcap header ABI
-
nativeAbi
-
nativeAbi
Native abi.- Parameters:
bo- the bo- Returns:
- the pcap header ABI
-
paddedAbi
-
selectDeadAbi
-
selectLiveAbi
-
selectOfflineAbi
Select offline abi.- Parameters:
isSwapped- the is swapped- Returns:
- the pcap header ABI
-
throwListOfAllAbiPossibilities
public static PcapHeaderException throwListOfAllAbiPossibilities(ByteBuffer buffer, PcapHeaderException.OutOfRangeException cause, String name, BiFunction<PcapHeaderABI, ByteBuffer, throws PcapHeaderExceptionInteger> action) Throw list of all abi possibilities.- Parameters:
buffer- the buffercause- the causename- the nameaction- the action- Returns:
- the pcap header exception
- Throws:
PcapHeaderException- the pcap header exception
-
captureLength
Capture length.- Parameters:
buffer- the buffer- Returns:
- the int
-
captureLength
Capture length.- Parameters:
mseg- the mseg- Returns:
- the int
-
captureLength
Capture length.- Parameters:
mseg- the msegnewLength- the new length
-
captureLengthOffset
public int captureLengthOffset()Capture length offset.- Returns:
- the int
-
headerLength
public int headerLength()Actual, in memory, header length as per this ABI and compiler padding.- Returns:
- the int
-
order
-
tvSec
-
tvSec
Tv sec.- Parameters:
mseg- the msegnewTvSec- the new tv sec
-
tvSecOffset
public int tvSecOffset()Tv sec offset.- Returns:
- the int
-
tvUsec
-
tvUsec
Tv usec.- Parameters:
mseg- the msegnewTvUsec- the new tv usec
-
tvUsecOffset
public int tvUsecOffset()Tv usec offset.- Returns:
- the int
-
wireLength
Wire length.- Parameters:
buffer- the buffer- Returns:
- the int
-
wireLength
-
wireLength
Wire length.- Parameters:
mseg- the msegnewLength- the new length
-
wireLengthOffset
public int wireLengthOffset()Wire length offset.- Returns:
- the int
-