Top Fields Constructors Methods
org.eclipse.jetty.quic.quiche.jna

public Class JnaQuicheConnection

extends QuicheConnection
Class Inheritance
Imports
java.io.ByteArrayOutputStream, .IOException, java.net.InetSocketAddress, .SocketAddress, java.nio.ByteBuffer, java.security.SecureRandom, java.util.ArrayList, .List, org.eclipse.jetty.quic.quiche.Quiche, .Quiche.quic_error, .Quiche.quiche_error, .QuicheConfig, .QuicheConnection, org.eclipse.jetty.util.BufferUtil, org.eclipse.jetty.util.thread.AutoLock, org.slf4j.Logger, .LoggerFactory

Field Summary

Modifier and TypeField and Description
private final AutoLock
private static final Logger
private LibQuiche.quiche_config
private LibQuiche.quiche_conn
private static final SecureRandom

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static LibQuiche.quiche_config
public boolean
close(long error, String reason)

Implements abstract org.eclipse.jetty.quic.quiche.QuicheConnection.close.

public static JnaQuicheConnection
public static JnaQuicheConnection
public void
public int

Returns:

how many bytes were added to the buffer.
drainCipherBytes
(ByteBuffer
the buffer to fill.
buffer
)

Implements abstract org.eclipse.jetty.quic.quiche.QuicheConnection.drainCipherBytes.

Fill the given buffer with cipher text to be sent.

public int
public void
enableQlog(String filename, String title, String desc)

public int
feedCipherBytes(ByteBuffer buffer, SocketAddress local, SocketAddress peer)

Implements abstract org.eclipse.jetty.quic.quiche.QuicheConnection.feedCipherBytes.

Read the buffer of cipher text coming from the network.

public int
public static byte[]
public QuicheConnection.CloseInfo
public String
public byte[]
public QuicheConnection.CloseInfo
public boolean
public boolean
public boolean
public boolean
public boolean
protected List<Long>
private static ByteBuffer
jnaBuffer(ByteBuffer buffer)

JNA requires ByteBuffers that are either direct or backed by an array.

public int
public static boolean

Returns:

true if a negotiation packet was written to the packetToSend buffer, false if negotiation failed and the packetRead buffer can be dropped.
negotiate
(QuicheConnection.TokenMinter tokenMinter, ByteBuffer packetRead, ByteBuffer packetToSend)

Hides org.eclipse.jetty.quic.quiche.QuicheConnection.negotiate.

Fully consumes the packetRead buffer.

public long
public void
public static byte
public static String
private static byte[]
resizeIfNeeded(byte[] buffer, int length)

public void
shutdownStream(long streamId, boolean writeSide, long error)

Implements abstract org.eclipse.jetty.quic.quiche.QuicheConnection.shutdownStream.

public static JnaQuicheConnection

Returns:

an established connection if accept succeeded, null if accept failed and negotiation should be tried.
tryAccept
(QuicheConfig quicheConfig, QuicheConnection.TokenValidator tokenValidator, ByteBuffer packetRead, SocketAddress local, SocketAddress peer)

Hides org.eclipse.jetty.quic.quiche.QuicheConnection.tryAccept.

Fully consumes the packetRead buffer if the connection was accepted.

public long
public long
Inherited from org.eclipse.jetty.quic.quiche.QuicheConnection:
feedClearBytesForStreamfeedFinForStreamreadableStreamIdswritableStreamIds

Field Detail

lockback to summary
private final AutoLock lock
LOGback to summary
private static final Logger LOG

Hides org.eclipse.jetty.quic.quiche.QuicheConnection.LOG.

quicheConfigback to summary
private LibQuiche.quiche_config quicheConfig
quicheConnback to summary
private LibQuiche.quiche_conn quicheConn
SECURE_RANDOMback to summary
private static final SecureRandom SECURE_RANDOM

Constructor Detail

JnaQuicheConnectionback to summary
private JnaQuicheConnection(LibQuiche.quiche_conn quicheConn, LibQuiche.quiche_config quicheConfig)

Method Detail

buildConfigback to summary
private static LibQuiche.quiche_config buildConfig(QuicheConfig config) throws IOException
closeback to summary
public boolean close(long error, String reason)

Implements abstract org.eclipse.jetty.quic.quiche.QuicheConnection.close.

Annotations
@Override
connectback to summary
public static JnaQuicheConnection connect(QuicheConfig quicheConfig, InetSocketAddress local, InetSocketAddress peer) throws IOException

Hides org.eclipse.jetty.quic.quiche.QuicheConnection.connect.

connectback to summary
public static JnaQuicheConnection connect(QuicheConfig quicheConfig, InetSocketAddress local, InetSocketAddress peer, int connectionIdLength) throws IOException

Hides org.eclipse.jetty.quic.quiche.QuicheConnection.connect.

disposeback to summary
public void dispose()

Implements abstract org.eclipse.jetty.quic.quiche.QuicheConnection.dispose.

Annotations
@Override
drainCipherBytesback to summary
public int drainCipherBytes(ByteBuffer buffer) throws IOException

Implements abstract org.eclipse.jetty.quic.quiche.QuicheConnection.drainCipherBytes.

Fill the given buffer with cipher text to be sent.

Parameters
buffer:ByteBuffer

the buffer to fill.

Returns:int

how many bytes were added to the buffer.

Annotations
@Override
drainClearBytesForStreamback to summary
public int drainClearBytesForStream(long streamId, ByteBuffer buffer) throws IOException

Implements abstract org.eclipse.jetty.quic.quiche.QuicheConnection.drainClearBytesForStream.

Annotations
@Override
enableQlogback to summary
public void enableQlog(String filename, String title, String desc) throws IOException
feedCipherBytesback to summary
public int feedCipherBytes(ByteBuffer buffer, SocketAddress local, SocketAddress peer) throws IOException

Implements abstract org.eclipse.jetty.quic.quiche.QuicheConnection.feedCipherBytes.

Doc from org.eclipse.jetty.quic.quiche.QuicheConnection.feedCipherBytes.

Read the buffer of cipher text coming from the network.

Annotations
@Override
feedClearBytesForStreamback to summary
public int feedClearBytesForStream(long streamId, ByteBuffer buffer, boolean last) throws IOException

Implements abstract org.eclipse.jetty.quic.quiche.QuicheConnection.feedClearBytesForStream.

Annotations
@Override
fromPacketback to summary
public static byte[] fromPacket(ByteBuffer packet)
getLocalCloseInfoback to summary
public QuicheConnection.CloseInfo getLocalCloseInfo()

Implements abstract org.eclipse.jetty.quic.quiche.QuicheConnection.getLocalCloseInfo.

Annotations
@Override
getNegotiatedProtocolback to summary
public String getNegotiatedProtocol()

Implements abstract org.eclipse.jetty.quic.quiche.QuicheConnection.getNegotiatedProtocol.

Annotations
@Override
getPeerCertificateback to summary
public byte[] getPeerCertificate()
getRemoteCloseInfoback to summary
public QuicheConnection.CloseInfo getRemoteCloseInfo()

Implements abstract org.eclipse.jetty.quic.quiche.QuicheConnection.getRemoteCloseInfo.

Annotations
@Override
isConnectionClosedback to summary
public boolean isConnectionClosed()

Implements abstract org.eclipse.jetty.quic.quiche.QuicheConnection.isConnectionClosed.

Annotations
@Override
isConnectionEstablishedback to summary
public boolean isConnectionEstablished()

Implements abstract org.eclipse.jetty.quic.quiche.QuicheConnection.isConnectionEstablished.

Annotations
@Override
isConnectionInEarlyDataback to summary
public boolean isConnectionInEarlyData()
isDrainingback to summary
public boolean isDraining()

Implements abstract org.eclipse.jetty.quic.quiche.QuicheConnection.isDraining.

Annotations
@Override
isStreamFinishedback to summary
public boolean isStreamFinished(long streamId)

Implements abstract org.eclipse.jetty.quic.quiche.QuicheConnection.isStreamFinished.

Annotations
@Override
iterableStreamIdsback to summary
protected List<Long> iterableStreamIds(boolean write)

Implements abstract org.eclipse.jetty.quic.quiche.QuicheConnection.iterableStreamIds.

Annotations
@Override
jnaBufferback to summary
private static ByteBuffer jnaBuffer(ByteBuffer buffer)

JNA requires ByteBuffers that are either direct or backed by an array. Read-only heap buffer are not direct and are considered not backed by an array, so buffer.hasArray() returns false for then an JNA rejects them by throwing IllegalStateException with the message "Buffer arguments must be direct or have a primitive backing array" from this native method in dispatch.c:615:

static void
dispatch(JNIEnv *env, void* func, jint flags, jobjectArray args,
         ffi_type *return_type, void *presult)
so this method ensures the buffer fulfils JNA's conditions, or it copies the given buffer into a new heap buffer and returns the copy, while also keeping the limit and position of the original buffer and setting them on the new buffer in a way comparable to the original buffer's.
maxLocalStreamsback to summary
public int maxLocalStreams()

Implements abstract org.eclipse.jetty.quic.quiche.QuicheConnection.maxLocalStreams.

Annotations
@Override
negotiateback to summary
public static boolean negotiate(QuicheConnection.TokenMinter tokenMinter, ByteBuffer packetRead, ByteBuffer packetToSend) throws IOException

Hides org.eclipse.jetty.quic.quiche.QuicheConnection.negotiate.

Fully consumes the packetRead buffer.

Returns:boolean

true if a negotiation packet was written to the packetToSend buffer, false if negotiation failed and the packetRead buffer can be dropped.

nextTimeoutback to summary
public long nextTimeout()

Implements abstract org.eclipse.jetty.quic.quiche.QuicheConnection.nextTimeout.

Annotations
@Override
onTimeoutback to summary
public void onTimeout()

Implements abstract org.eclipse.jetty.quic.quiche.QuicheConnection.onTimeout.

Annotations
@Override
packetTypeback to summary
public static byte packetType(ByteBuffer packet)
packetTypeAsStringback to summary
public static String packetTypeAsString(ByteBuffer packet)
resizeIfNeededback to summary
private static byte[] resizeIfNeeded(byte[] buffer, int length)
shutdownStreamback to summary
public void shutdownStream(long streamId, boolean writeSide, long error) throws IOException

Implements abstract org.eclipse.jetty.quic.quiche.QuicheConnection.shutdownStream.

Annotations
@Override
tryAcceptback to summary
public static JnaQuicheConnection tryAccept(QuicheConfig quicheConfig, QuicheConnection.TokenValidator tokenValidator, ByteBuffer packetRead, SocketAddress local, SocketAddress peer) throws IOException

Hides org.eclipse.jetty.quic.quiche.QuicheConnection.tryAccept.

Fully consumes the packetRead buffer if the connection was accepted.

Returns:JnaQuicheConnection

an established connection if accept succeeded, null if accept failed and negotiation should be tried.

windowCapacityback to summary
public long windowCapacity()

Implements abstract org.eclipse.jetty.quic.quiche.QuicheConnection.windowCapacity.

Annotations
@Override
windowCapacityback to summary
public long windowCapacity(long streamId) throws IOException

Implements abstract org.eclipse.jetty.quic.quiche.QuicheConnection.windowCapacity.

Annotations
@Override