Package io.github.mahmoudimus.quic.frame
Interface Frame
- All Known Implementing Classes:
Frame.Ack,Frame.AckFrequency,Frame.ApplicationClose,Frame.ConnectionClose,Frame.Crypto,Frame.DataBlocked,Frame.Datagram,Frame.HandshakeDone,Frame.ImmediateAck,Frame.MaxData,Frame.MaxStreamData,Frame.MaxStreams,Frame.NewConnectionId,Frame.NewToken,Frame.Padding,Frame.PathChallenge,Frame.PathResponse,Frame.Ping,Frame.ResetStream,Frame.RetireConnectionId,Frame.StopSending,Frame.Stream,Frame.StreamDataBlocked,Frame.StreamsBlocked
public sealed interface Frame
permits Frame.Padding, Frame.Ping, Frame.Ack, Frame.ResetStream, Frame.StopSending, Frame.Crypto, Frame.NewToken, Frame.Stream, Frame.MaxData, Frame.MaxStreamData, Frame.MaxStreams, Frame.DataBlocked, Frame.StreamDataBlocked, Frame.StreamsBlocked, Frame.NewConnectionId, Frame.RetireConnectionId, Frame.PathChallenge, Frame.PathResponse, Frame.ConnectionClose, Frame.ApplicationClose, Frame.HandshakeDone, Frame.Datagram, Frame.ImmediateAck, Frame.AckFrequency
A QUIC frame (RFC 9000 section 19, RFC 9221 and the ACK frequency extension).
FrameDecoder reads frames; encode(ByteBuffer) writes one.
Frames that carry bytes (CRYPTO, STREAM, DATAGRAM, NEW_TOKEN and the close reasons) hold a
ByteBuffer view: decoded frames point into the decrypted packet without copying, so
copy the bytes if they must outlive the packet buffer. Equality compares the bytes. The
accessors return independent views.
Large frames have budgeted writers, like quinn's packet assembly: Frame.Crypto.encode(ByteBuffer, long, ByteBuffer, int) and Frame.Stream.encode(ByteBuffer, long, long, ByteBuffer, boolean, int) write as much data as fits a byte budget, and Frame.ConnectionClose.encode(ByteBuffer, int) truncates its reason.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordAn ACK frame (types 0x02 and 0x03).static final recordAn ACK_FREQUENCY frame (type 0xaf) of the QUIC ACK frequency extension, as quinn implements it.static final recordAn inclusive range of acknowledged packet numbers.static final recordA CONNECTION_CLOSE frame for an application error (type 0x1d), allowed only in 0-RTT and 1-RTT packets.static final recordA CONNECTION_CLOSE frame for a transport error (type 0x1c).static final recordA CRYPTO frame (type 0x06), carrying TLS handshake bytes.static final recordA DATA_BLOCKED frame (type 0x14).static final recordA DATAGRAM frame (RFC 9221; 0x30 without and 0x31 with a Length field).static final recordThe ECN counts of an ACK frame of type 0x03 (RFC 9000 section 19.3.2).static final recordA HANDSHAKE_DONE frame (type 0x1e).static final recordAn IMMEDIATE_ACK frame (type 0x1f) of the QUIC ACK frequency extension.static final recordA MAX_DATA frame (type 0x10).static final recordA MAX_STREAM_DATA frame (type 0x11).static final recordA MAX_STREAMS frame (0x12 bidirectional, 0x13 unidirectional).static final recordA NEW_CONNECTION_ID frame (type 0x18).static final recordA NEW_TOKEN frame (type 0x07), with a token for future connections.static final recordA run of PADDING frames (type 0x00), each a single zero byte.static final recordA PATH_CHALLENGE frame (type 0x1a).static final recordA PATH_RESPONSE frame (type 0x1b).static final recordA PING frame (type 0x01).static final recordA RESET_STREAM frame (type 0x04).static final recordA RETIRE_CONNECTION_ID frame (type 0x19).static final recordA STOP_SENDING frame (type 0x05).static final recordA STREAM frame (types 0x08 to 0x0f).static final recordA STREAM_DATA_BLOCKED frame (type 0x15).static final recordA STREAMS_BLOCKED frame (0x16 bidirectional, 0x17 unidirectional). -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longThe largest stream count MAX_STREAMS and STREAMS_BLOCKED may carry, 260. -
Method Summary
Modifier and TypeMethodDescriptionvoidencode(ByteBuffer out) Writes the frame at the buffer's position.intThe encoded length.default booleanWhether a packet containing this frame must be acknowledged.type()The frame type.longtypeCode()The exact type code this frame encodes with, flags included.
-
Field Details
-
MAX_STREAM_COUNT
static final long MAX_STREAM_COUNTThe largest stream count MAX_STREAMS and STREAMS_BLOCKED may carry, 260.- See Also:
-
-
Method Details
-
type
FrameType type()The frame type.- Returns:
- the type
-
typeCode
long typeCode()The exact type code this frame encodes with, flags included.- Returns:
- the type code
-
encodedLength
int encodedLength()The encoded length.- Returns:
- the bytes
encode(java.nio.ByteBuffer)writes
-
encode
Writes the frame at the buffer's position.- Parameters:
out- the buffer- Throws:
BufferOverflowException- if fewer thanencodedLength()bytes remain; nothing is written then
-
isAckEliciting
default boolean isAckEliciting()Whether a packet containing this frame must be acknowledged.- Returns:
- the type's ack-eliciting property
-