Class QuicheConnection

java.lang.Object
org.eclipse.jetty.quic.quiche.QuicheConnection
Direct Known Subclasses:
JnaQuicheConnection

public abstract class QuicheConnection extends Object
  • Constructor Details

    • QuicheConnection

      public QuicheConnection()
  • Method Details

    • connect

      public static QuicheConnection connect(QuicheConfig quicheConfig, InetSocketAddress local, InetSocketAddress peer) throws IOException
      Throws:
      IOException
    • connect

      public static QuicheConnection connect(QuicheConfig quicheConfig, InetSocketAddress local, InetSocketAddress peer, int connectionIdLength) throws IOException
      Throws:
      IOException
    • negotiate

      public static boolean negotiate(QuicheConnection.TokenMinter tokenMinter, ByteBuffer packetRead, ByteBuffer packetToSend) throws IOException
      Fully consumes the packetRead buffer.
      Returns:
      true if a negotiation packet was written to the packetToSend buffer, false if negotiation failed and the packetRead buffer can be dropped.
      Throws:
      IOException
    • tryAccept

      public static QuicheConnection tryAccept(QuicheConfig quicheConfig, QuicheConnection.TokenValidator tokenValidator, ByteBuffer packetRead, SocketAddress local, SocketAddress peer) throws IOException
      Fully consumes the packetRead buffer if the connection was accepted.
      Returns:
      an established connection if accept succeeded, null if accept failed and negotiation should be tried.
      Throws:
      IOException
    • readableStreamIds

      public final List<Long> readableStreamIds()
    • writableStreamIds

      public final List<Long> writableStreamIds()
    • iterableStreamIds

      protected abstract List<Long> iterableStreamIds(boolean write)
    • feedCipherBytes

      public abstract int feedCipherBytes(ByteBuffer buffer, SocketAddress local, SocketAddress peer) throws IOException
      Read the buffer of cipher text coming from the network.
      Parameters:
      buffer - the buffer to read.
      local - the local address on which the buffer was received.
      peer - the address of the peer from which the buffer was received.
      Returns:
      how many bytes were consumed.
      Throws:
      IOException
    • drainCipherBytes

      public abstract int drainCipherBytes(ByteBuffer buffer) throws IOException
      Fill the given buffer with cipher text to be sent.
      Parameters:
      buffer - the buffer to fill.
      Returns:
      how many bytes were added to the buffer.
      Throws:
      IOException
    • isConnectionClosed

      public abstract boolean isConnectionClosed()
    • isConnectionEstablished

      public abstract boolean isConnectionEstablished()
    • nextTimeout

      public abstract long nextTimeout()
    • onTimeout

      public abstract void onTimeout()
    • getNegotiatedProtocol

      public abstract String getNegotiatedProtocol()
    • close

      public abstract boolean close(long error, String reason)
    • dispose

      public abstract void dispose()
    • isDraining

      public abstract boolean isDraining()
    • maxLocalStreams

      public abstract int maxLocalStreams()
    • windowCapacity

      public abstract long windowCapacity()
    • windowCapacity

      public abstract long windowCapacity(long streamId) throws IOException
      Throws:
      IOException
    • shutdownStream

      public abstract void shutdownStream(long streamId, boolean writeSide, long error) throws IOException
      Throws:
      IOException
    • feedFinForStream

      public final void feedFinForStream(long streamId) throws IOException
      Throws:
      IOException
    • feedClearBytesForStream

      public final int feedClearBytesForStream(long streamId, ByteBuffer buffer) throws IOException
      Throws:
      IOException
    • feedClearBytesForStream

      public abstract int feedClearBytesForStream(long streamId, ByteBuffer buffer, boolean last) throws IOException
      Throws:
      IOException
    • drainClearBytesForStream

      public abstract int drainClearBytesForStream(long streamId, ByteBuffer buffer) throws IOException
      Throws:
      IOException
    • isStreamFinished

      public abstract boolean isStreamFinished(long streamId)
    • getRemoteCloseInfo

      public abstract QuicheConnection.CloseInfo getRemoteCloseInfo()
    • getLocalCloseInfo

      public abstract QuicheConnection.CloseInfo getLocalCloseInfo()
    • getPeerCertificate

      public abstract byte[] getPeerCertificate()