APIdia Launch Partner
Top Description Inners Fields Constructors Methods
jdk.internal.net.http.quic.packets

public Class QuicPacketDecoder

extends Object
Class Inheritance
Imports
jdk.internal.net.http.common.Log, .Logger, .Utils, jdk.internal.net.http.quic.PeerConnectionId, .QuicConnectionId, .CodingContext, .VariableLengthEncoder, jdk.internal.net.quic.QuicKeyUnavailableException, .QuicVersion, .QuicTLSEngine, .QuicTransportErrors, .QuicTransportException, jdk.internal.net.http.quic.frames.QuicFrame, jdk.internal.net.http.quic.packets.QuicPacket.PacketNumberSpace, .QuicPacket.PacketType, javax.crypto.AEADBadTagException, .ShortBufferException, java.io.IOException, java.nio.ByteBuffer, .ByteOrder, .BufferUnderflowException, java.util.ArrayList, .HexFormat, .Objects, .List

A QuicPacketDecoder encapsulates the logic to decode a quic packet. A QuicPacketDecoder is typically tied to a particular version of the QUIC protocol.
External Specification
https://www.rfc-editor.org/info/rfc9000, https://www.rfc-editor.org/info/rfc9001, https://www.rfc-editor.org/info/rfc9369

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
private static class
private abstract static class
private static class
public abstract static class
private static class
private abstract static class
private static class
private static class
pack-priv class
QuicPacketDecoder.PacketReader

A PacketReader to read a Quic packet.

Field Summary

Modifier and TypeField and Description
private static final Logger
private final QuicVersion

Constructor Summary

AccessConstructor and Description
private
QuicPacketDecoder(final QuicVersion quicVersion)

Method Summary

Modifier and TypeMethod and Description
private static int

Returns:

the connection ID length
connectionIdLength
(byte
the connection ID length byte.
length
)

Reads a connection ID length from the connection ID length byte.

public QuicPacketDecoder.IncomingQuicPacket
decode(ByteBuffer
the buffer with the bytes to be decoded
buffer
,
CodingContext
the decoding context
context
)

Decode the contents of the given ByteBuffer and, depending on the PacketType, return a QuicPacket with the corresponding type.

private static QuicConnectionId
private static QuicPacket.HeadersType

Returns:

the headers type encoded in the given byte.
headersType
(byte
the first byte of a quic packet
first
)

Reads the headers type from the given byte.

private static boolean

Returns:

true if the first packet in the buffer is a version negotiation packet.
isVersionNegotiation
(ByteBuffer
the buffer containing the packet.
buffer
,
int
the offset at which the packet starts.
offset
)

Returns true if the first packet in the buffer is a version negotiation packet.

public ByteBuffer

Returns:

the next packet.
nextPacketSlice
(ByteBuffer
a buffer containing coalesced packets
buffer
,
int
the offset at which the next packet starts
offset
)

Find the length of the next packet in the buffer, and return the next packet bytes as a slice of the original packet.

public static QuicPacketDecoder

Returns:

a decoder for the given Quic version or null
of
(QuicVersion
the Quic protocol version number
quicVersion
)

Returns a decoder for the given Quic version.

public static QuicPacketDecoder

Returns:

A QuicPacketDecoder instance to decode the packet starting at the given offset.
of
(ByteBuffer
A buffer containing a Quic packet
buffer
,
int
The offset at which the packet starts
offset
)

Returns a QuicPacketDecoder to decode the packet starting at the specified offset in the buffer.

private QuicPacket.PacketType

Returns:

the packet type encoded in the given byte.
packetType
(byte
the first byte of a quic packet
headerByte
)

Reads the Quic V1 packet type from the given byte.

public static QuicPacket.HeadersType

Returns:

the header's type of the packet contained in this byte buffer. NONE if the header's type cannot be determined.
peekHeaderType
(ByteBuffer
the byte buffer containing a packet.
buffer
,
int
the offset at which the packet starts.
offset
)

Peeks at the headers type in the given byte buffer.

public static ByteBuffer

Returns:

token or null if packet is malformed
peekInitialPacketToken
(ByteBuffer
the buffer containing an initial packet.
buffer
)

Returns a bytebuffer containing the token from initial packet.

public static ByteBuffer

Returns:

A ByteBuffer slice containing the connection id bytes, or null if the packet is malformed and the connection id could not be read.
peekLongConnectionId
(ByteBuffer
the buffer containing a long headers packet.
buffer
)

Peeks at the connection id in the long header packet bytes.

public static LongHeader

Returns:

A LongHeader containing the packet header data, or null if the packet is malformed
peekLongHeader
(ByteBuffer
the buffer containing a long header packet.
buffer
)

Peeks at the header in the long header packet bytes.

public static LongHeader

Returns:

A LongHeader containing the packet header data, or null if the packet is malformed
peekLongHeader
(ByteBuffer
the buffer containing a long header packet.
buffer
,
int
the position of the start of the packet
offset
)

Peeks at the header in the long header packet bytes.

private int

Returns:

the position just after the first packet present in the buffer.
peekPacketEnd
(QuicPacket.PacketType
the first packet type. Must be INITIAL, HANDSHAKE, or ZERORTT.
type
,
ByteBuffer
the byte buffer containing the packet
buffer
)

Returns the position just after the first packet present in the buffer.

public int

Returns:

the size of the first packet present in the buffer.
peekPacketSize
(ByteBuffer
A byte buffer containing quic packets
buffer
)

Peek at the size of the first packet present in the buffer.

public QuicPacket.PacketType
public QuicPacket.PacketType
peekPacketType(ByteBuffer buffer, int offset)

public static ByteBuffer

Returns:

A ByteBuffer slice containing the connection id bytes, or null if the packet is malformed and the connection id could not be read.
peekShortConnectionId
(ByteBuffer
the buffer containing a short headers packet.
buffer
,
int
the connection id length.
length
)

Peeks at the connection id in the short header packet bytes.

public static int

Returns:

the version of the packet in the buffer, or 0.
peekVersion
(ByteBuffer
the buffer containing the packet.
buffer
)

Returns the version of the first packet in the buffer.

public static int

Returns:

the version of the packet in the buffer, or 0.
peekVersion
(ByteBuffer
the buffer containing the packet.
buffer
,
int
the offset at which the packet starts.
offset
)

Returns the version of the first packet in the buffer.

public void
skipPacket(ByteBuffer
A byte buffer containing quic packets
buffer
,
int
The offset at which the packet starts
offset
)

Advance the bytebuffer position to the end of the packet

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait