Interface QuicStreamContext

All Superinterfaces:
QuicContext

public interface QuicStreamContext extends QuicContext
One stream of an intercepted QUIC connection, as a QuicInterceptor sees it: the connection's details (QuicContext), which stream it is, who opened it, and a way to add bytes. The same context is given to every hook call of the stream, so it can serve as a key for per-stream state; QuicContext.connection() is the key for per-connection state.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Whether the stream is bidirectional; a unidirectional stream carries data only from the side that opened it.
    boolean
    Whether the client opened the stream, rather than the server.
    void
    send(boolean fromClient, byte[] data)
    Adds bytes to the stream, as if one side had sent them: with fromClient they go to the server, else to the client.
    long
    The stream's ID on the proxy's connection to the server.
    long
    The stream's ID on the client's connection (RFC 9000 section 2.1).

    Methods inherited from interface org.microproxy.quic.QuicContext

    alpn, clientAddress, connection, connectionId, flowContext, host, masque, port, sendDatagram, serverAddress, sni
  • Method Details

    • streamId

      long streamId()
      The stream's ID on the client's connection (RFC 9000 section 2.1). Its two low bits say who opened it and whether it is unidirectional.
      Returns:
      the client-side stream ID
    • serverStreamId

      long serverStreamId()
      The stream's ID on the proxy's connection to the server. Streams are opened on the other connection in the order they arrive, so the two IDs are usually the same.
      Returns:
      the server-side stream ID
    • bidirectional

      boolean bidirectional()
      Whether the stream is bidirectional; a unidirectional stream carries data only from the side that opened it.
      Returns:
      true for a bidirectional stream
    • clientInitiated

      boolean clientInitiated()
      Whether the client opened the stream, rather than the server.
      Returns:
      true for a stream the client opened
    • send

      void send(boolean fromClient, byte[] data)
      Adds bytes to the stream, as if one side had sent them: with fromClient they go to the server, else to the client. They do not pass through QuicInterceptor.streamData(org.microproxy.quic.QuicStreamMessage, org.microproxy.quic.QuicStreamContext) or QuicInterceptor.streamMessage(org.microproxy.quic.QuicMessage, org.microproxy.quic.QuicStreamContext), and are not framed: on a framed stream, return messages from streamMessage instead. Called from a streamData or streamMessage hook of the same direction, they follow that message (or what replaced it); otherwise, from any hook or any thread while that direction is open, they are written at once, between messages. The call may block while the destination's flow control holds the data back.
      Parameters:
      fromClient - true to send to the server, false to send to the client
      data - the bytes, written as they are
      Throws:
      IllegalStateException - if that direction has ended (finished, reset or stopped) or does not exist on a unidirectional stream
      NullPointerException - if data is null