quic-0.2.1: QUIC
Safe HaskellSafe-Inferred
LanguageHaskell2010

Network.QUIC

Description

This main module provides APIs for QUIC.

The -threaded option must be specified to GHC to use this library.

Synopsis

Connection

abortConnection :: Connection -> ApplicationProtocolError -> ReasonPhrase -> IO () Source #

Closing a connection with an application protocol error.

Stream

data Stream Source #

An abstract data type for streams.

Instances

Instances details
Show Stream Source # 
Instance details

Defined in Network.QUIC.Stream.Types

type StreamId = Int Source #

Stream identifier. This should be 62-bit interger. On 32-bit machines, the total number of stream identifiers is limited.

streamId :: Stream -> StreamId Source #

Getting stream identifier.

Category

isClientInitiatedBidirectional :: StreamId -> Bool Source #

Checking if a stream is client-initiated bidirectional.

isServerInitiatedBidirectional :: StreamId -> Bool Source #

Checking if a stream is server-initiated bidirectional.

isClientInitiatedUnidirectional :: StreamId -> Bool Source #

Checking if a stream is client-initiated unidirectional.

isServerInitiatedUnidirectional :: StreamId -> Bool Source #

Checking if a stream is server-initiated unidirectional.

Opening

stream :: Connection -> IO Stream Source #

Creating a bidirectional stream.

unidirectionalStream :: Connection -> IO Stream Source #

Creating a unidirectional stream.

acceptStream :: Connection -> IO Stream Source #

Accepting a stream initiated by the peer.

Closing

closeStream :: Stream -> IO () Source #

Closing a stream without an error. This sends FIN if necessary.

shutdownStream :: Stream -> IO () Source #

Sending FIN in a stream. closeStream should be called later.

resetStream :: Stream -> ApplicationProtocolError -> IO () Source #

Closing a stream with an error code. This sends RESET_STREAM to the peer. This is an alternative of closeStream.

stopStream :: Stream -> ApplicationProtocolError -> IO () Source #

Asking the peer to stop sending. This sends STOP_SENDING to the peer and it will send RESET_STREAM back. closeStream should be called later.

IO

recvStream :: Stream -> Int -> IO ByteString Source #

Receiving data in the stream. In the case where a FIN is received an empty bytestring is returned.

sendStream :: Stream -> ByteString -> IO () Source #

Sending data in the stream.

sendStreamMany :: Stream -> [ByteString] -> IO () Source #

Sending a list of data in the stream.

Information

data ConnectionInfo Source #

Information about a connection.

Instances

Instances details
Show ConnectionInfo Source # 
Instance details

Defined in Network.QUIC.Types.Info

getConnectionInfo :: Connection -> IO ConnectionInfo Source #

Getting information about a connection.

Statistics

data ConnectionStats Source #

Statistics of a connection.

Instances

Instances details
Show ConnectionStats Source # 
Instance details

Defined in Network.QUIC.Info

Eq ConnectionStats Source # 
Instance details

Defined in Network.QUIC.Info

getConnectionStats :: Connection -> IO ConnectionStats Source #

Getting statistics of a connection.

Synchronization

wait0RTTReady :: Connection -> IO () Source #

Waiting until 0-RTT data can be sent.

wait1RTTReady :: Connection -> IO () Source #

Waiting until 1-RTT data can be sent.

waitEstablished :: Connection -> IO () Source #

For clients, waiting until HANDSHAKE_DONE is received. For servers, waiting until a TLS stack reports that the handshake is complete.

Exceptions and Errors

cryptoError :: AlertDescription -> TransportError Source #

Converting a TLS alert to a corresponding transport error.