- 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 ConstantDescriptionThe compact be.The compact le.The padded be.The padded le. -
Method Summary
Modifier and TypeMethodDescriptionint
captureLength
(MemorySegment mseg) Capture length.void
captureLength
(MemorySegment mseg, int newLength) Capture length.int
captureLength
(ByteBuffer buffer) Capture length.int
Capture length offset.static PcapHeaderABI
Compact abi.static PcapHeaderABI
compactAbi
(boolean isSwapped) Compact abi.static PcapHeaderABI
compactAbi
(ByteOrder bo) Compact abi.int
Actual, in memory, header length as per this ABI and compiler padding.static PcapHeaderABI
Native abi.static PcapHeaderABI
Native abi.order()
Order.static PcapHeaderABI
Padded abi.static PcapHeaderABI
Select dead abi.static PcapHeaderABI
Select live abi.static PcapHeaderABI
selectOfflineAbi
(boolean isSwapped) Select offline abi.static PcapHeaderException
throwListOfAllAbiPossibilities
(ByteBuffer buffer, PcapHeaderException.OutOfRangeException cause, String name, BiFunction<PcapHeaderABI, ByteBuffer, Integer> action) Throw list of all abi possibilities.long
tvSec
(MemorySegment mseg) Tv sec.void
tvSec
(MemorySegment mseg, long newTvSec) Tv sec.int
Tv sec offset.long
tvUsec
(MemorySegment mseg) Tv usec.void
tvUsec
(MemorySegment mseg, long newTvUsec) Tv usec.int
Tv usec offset.static PcapHeaderABI
Returns 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.int
wireLength
(MemorySegment mseg) Wire length.void
wireLength
(MemorySegment mseg, int newLength) Wire length.int
wireLength
(ByteBuffer buffer) Wire length.int
Wire 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
-