Class JnaQuicheConnection
java.lang.Object
org.eclipse.jetty.quic.quiche.QuicheConnection
org.eclipse.jetty.quic.quiche.jna.JnaQuicheConnection
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jetty.quic.quiche.QuicheConnection
QuicheConnection.CloseInfo, QuicheConnection.TokenMinter, QuicheConnection.TokenValidationException, QuicheConnection.TokenValidator
-
Method Summary
Modifier and TypeMethodDescriptionboolean
static JnaQuicheConnection
connect
(QuicheConfig quicheConfig, InetSocketAddress local, InetSocketAddress peer) static JnaQuicheConnection
connect
(QuicheConfig quicheConfig, InetSocketAddress local, InetSocketAddress peer, int connectionIdLength) void
dispose()
int
drainCipherBytes
(ByteBuffer buffer) Fill the given buffer with cipher text to be sent.int
drainClearBytesForStream
(long streamId, ByteBuffer buffer) void
enableQlog
(String filename, String title, String desc) int
feedCipherBytes
(ByteBuffer buffer, SocketAddress local, SocketAddress peer) Read the buffer of cipher text coming from the network.int
feedClearBytesForStream
(long streamId, ByteBuffer buffer, boolean last) static byte[]
fromPacket
(ByteBuffer packet) byte[]
boolean
boolean
boolean
boolean
boolean
isStreamFinished
(long streamId) iterableStreamIds
(boolean write) int
static boolean
negotiate
(QuicheConnection.TokenMinter tokenMinter, ByteBuffer packetRead, ByteBuffer packetToSend) Fully consumes thepacketRead
buffer.long
void
static byte
packetType
(ByteBuffer packet) static String
packetTypeAsString
(ByteBuffer packet) void
shutdownStream
(long streamId, boolean writeSide, long error) static JnaQuicheConnection
tryAccept
(QuicheConfig quicheConfig, QuicheConnection.TokenValidator tokenValidator, ByteBuffer packetRead, SocketAddress local, SocketAddress peer) Fully consumes thepacketRead
buffer if the connection was accepted.long
long
windowCapacity
(long streamId) Methods inherited from class org.eclipse.jetty.quic.quiche.QuicheConnection
feedClearBytesForStream, feedFinForStream, readableStreamIds, writableStreamIds
-
Method Details
-
fromPacket
-
connect
public static JnaQuicheConnection connect(QuicheConfig quicheConfig, InetSocketAddress local, InetSocketAddress peer) throws IOException - Throws:
IOException
-
connect
public static JnaQuicheConnection connect(QuicheConfig quicheConfig, InetSocketAddress local, InetSocketAddress peer, int connectionIdLength) throws IOException - Throws:
IOException
-
packetTypeAsString
-
packetType
-
negotiate
public static boolean negotiate(QuicheConnection.TokenMinter tokenMinter, ByteBuffer packetRead, ByteBuffer packetToSend) throws IOException Fully consumes thepacketRead
buffer.- Returns:
- true if a negotiation packet was written to the
packetToSend
buffer, false if negotiation failed and thepacketRead
buffer can be dropped. - Throws:
IOException
-
tryAccept
public static JnaQuicheConnection tryAccept(QuicheConfig quicheConfig, QuicheConnection.TokenValidator tokenValidator, ByteBuffer packetRead, SocketAddress local, SocketAddress peer) throws IOException Fully consumes thepacketRead
buffer if the connection was accepted.- Returns:
- an established connection if accept succeeded, null if accept failed and negotiation should be tried.
- Throws:
IOException
-
enableQlog
- Throws:
IOException
-
getPeerCertificate
public byte[] getPeerCertificate()- Specified by:
getPeerCertificate
in classQuicheConnection
-
iterableStreamIds
- Specified by:
iterableStreamIds
in classQuicheConnection
-
feedCipherBytes
public int feedCipherBytes(ByteBuffer buffer, SocketAddress local, SocketAddress peer) throws IOException Description copied from class:QuicheConnection
Read the buffer of cipher text coming from the network.- Specified by:
feedCipherBytes
in classQuicheConnection
- 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
Fill the given buffer with cipher text to be sent.- Specified by:
drainCipherBytes
in classQuicheConnection
- Parameters:
buffer
- the buffer to fill.- Returns:
- how many bytes were added to the buffer.
- Throws:
IOException
-
isConnectionClosed
public boolean isConnectionClosed()- Specified by:
isConnectionClosed
in classQuicheConnection
-
isConnectionEstablished
public boolean isConnectionEstablished()- Specified by:
isConnectionEstablished
in classQuicheConnection
-
isConnectionInEarlyData
public boolean isConnectionInEarlyData() -
nextTimeout
public long nextTimeout()- Specified by:
nextTimeout
in classQuicheConnection
-
onTimeout
public void onTimeout()- Specified by:
onTimeout
in classQuicheConnection
-
getNegotiatedProtocol
- Specified by:
getNegotiatedProtocol
in classQuicheConnection
-
close
- Specified by:
close
in classQuicheConnection
-
dispose
public void dispose()- Specified by:
dispose
in classQuicheConnection
-
isDraining
public boolean isDraining()- Specified by:
isDraining
in classQuicheConnection
-
maxLocalStreams
public int maxLocalStreams()- Specified by:
maxLocalStreams
in classQuicheConnection
-
windowCapacity
public long windowCapacity()- Specified by:
windowCapacity
in classQuicheConnection
-
windowCapacity
- Specified by:
windowCapacity
in classQuicheConnection
- Throws:
IOException
-
shutdownStream
- Specified by:
shutdownStream
in classQuicheConnection
- Throws:
IOException
-
feedClearBytesForStream
public int feedClearBytesForStream(long streamId, ByteBuffer buffer, boolean last) throws IOException - Specified by:
feedClearBytesForStream
in classQuicheConnection
- Throws:
IOException
-
drainClearBytesForStream
- Specified by:
drainClearBytesForStream
in classQuicheConnection
- Throws:
IOException
-
isStreamFinished
public boolean isStreamFinished(long streamId) - Specified by:
isStreamFinished
in classQuicheConnection
-
getRemoteCloseInfo
- Specified by:
getRemoteCloseInfo
in classQuicheConnection
-
getLocalCloseInfo
- Specified by:
getLocalCloseInfo
in classQuicheConnection
-