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

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 Classes
    Modifier and Type
    Interface
    Description
    static final record 
    An ACK frame (types 0x02 and 0x03).
    static final record 
    An ACK_FREQUENCY frame (type 0xaf) of the QUIC ACK frequency extension, as quinn implements it.
    static final record 
    An inclusive range of acknowledged packet numbers.
    static final record 
    A CONNECTION_CLOSE frame for an application error (type 0x1d), allowed only in 0-RTT and 1-RTT packets.
    static final record 
    A CONNECTION_CLOSE frame for a transport error (type 0x1c).
    static final record 
    A CRYPTO frame (type 0x06), carrying TLS handshake bytes.
    static final record 
    A DATA_BLOCKED frame (type 0x14).
    static final record 
    A DATAGRAM frame (RFC 9221; 0x30 without and 0x31 with a Length field).
    static final record 
    The ECN counts of an ACK frame of type 0x03 (RFC 9000 section 19.3.2).
    static final record 
    A HANDSHAKE_DONE frame (type 0x1e).
    static final record 
    An IMMEDIATE_ACK frame (type 0x1f) of the QUIC ACK frequency extension.
    static final record 
    A MAX_DATA frame (type 0x10).
    static final record 
    A MAX_STREAM_DATA frame (type 0x11).
    static final record 
    A MAX_STREAMS frame (0x12 bidirectional, 0x13 unidirectional).
    static final record 
    A NEW_CONNECTION_ID frame (type 0x18).
    static final record 
    A NEW_TOKEN frame (type 0x07), with a token for future connections.
    static final record 
    A run of PADDING frames (type 0x00), each a single zero byte.
    static final record 
    A PATH_CHALLENGE frame (type 0x1a).
    static final record 
    A PATH_RESPONSE frame (type 0x1b).
    static final record 
    A PING frame (type 0x01).
    static final record 
    A RESET_STREAM frame (type 0x04).
    static final record 
    A RETIRE_CONNECTION_ID frame (type 0x19).
    static final record 
    A STOP_SENDING frame (type 0x05).
    static final record 
    A STREAM frame (types 0x08 to 0x0f).
    static final record 
    A STREAM_DATA_BLOCKED frame (type 0x15).
    static final record 
    A STREAMS_BLOCKED frame (0x16 bidirectional, 0x17 unidirectional).
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final long
    The largest stream count MAX_STREAMS and STREAMS_BLOCKED may carry, 260.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Writes the frame at the buffer's position.
    int
    The encoded length.
    default boolean
    Whether a packet containing this frame must be acknowledged.
    The frame type.
    long
    The exact type code this frame encodes with, flags included.
  • Field Details

    • MAX_STREAM_COUNT

      static final long MAX_STREAM_COUNT
      The 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

      void encode(ByteBuffer out)
      Writes the frame at the buffer's position.
      Parameters:
      out - the buffer
      Throws:
      BufferOverflowException - if fewer than encodedLength() 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