macula_quic (macula v0.7.29)

View Source

Main API module for Macula QUIC transport. Provides a simplified wrapper around the quicer library.

Summary

Functions

Accept an incoming connection on a listener. After accepting, the connection needs handshake to complete.

Accept an incoming stream on a connection.

Send data on a stream asynchronously (non-blocking). This returns immediately without waiting for QUIC flow control.

Close a listener, connection, or stream.

Connect to a QUIC server. Options: {alpn, [Protocol]} - List of ALPN protocols {verify, none | verify_peer} - Certificate verification mode

Start a QUIC listener on the specified port. Options: {cert, CertFile} - Path to PEM certificate file {key, KeyFile} - Path to PEM private key file {alpn, [Protocol]} - List of ALPN protocols (e.g., ["macula"]) {peer_unidi_stream_count, N} - Max unidirectional streams {peer_bidi_stream_count, N} - Max bidirectional streams

Open a new bidirectional stream on a connection.

Receive data from a stream (blocking).

Send data on a stream (blocking).

Functions

accept(ListenerPid, Timeout)

-spec accept(pid(), timeout()) -> {ok, pid()} | {error, term()}.

Accept an incoming connection on a listener. After accepting, the connection needs handshake to complete.

accept_stream(ConnPid, Timeout)

-spec accept_stream(pid(), timeout()) -> {ok, pid()} | {error, term()}.

Accept an incoming stream on a connection.

async_send(StreamPid, Data)

-spec async_send(pid(), binary()) -> ok | {error, term()}.

Send data on a stream asynchronously (non-blocking). This returns immediately without waiting for QUIC flow control.

close(Pid)

-spec close(pid()) -> ok.

Close a listener, connection, or stream.

connect(Host, Port, Opts, Timeout)

-spec connect(string() | inet:ip_address(), inet:port_number(), list(), timeout()) ->
                 {ok, pid()} | {error, term()}.

Connect to a QUIC server. Options: {alpn, [Protocol]} - List of ALPN protocols {verify, none | verify_peer} - Certificate verification mode

listen(Port, Opts)

-spec listen(inet:port_number(), list()) -> {ok, pid()} | {error, term()}.

Start a QUIC listener on the specified port. Options: {cert, CertFile} - Path to PEM certificate file {key, KeyFile} - Path to PEM private key file {alpn, [Protocol]} - List of ALPN protocols (e.g., ["macula"]) {peer_unidi_stream_count, N} - Max unidirectional streams {peer_bidi_stream_count, N} - Max bidirectional streams

open_stream(ConnPid)

-spec open_stream(pid()) -> {ok, pid()} | {error, term()}.

Open a new bidirectional stream on a connection.

recv(StreamPid, Timeout)

-spec recv(pid(), timeout()) -> {ok, binary()} | {error, term()}.

Receive data from a stream (blocking).

send(StreamPid, Data)

-spec send(pid(), binary()) -> ok | {error, term()}.

Send data on a stream (blocking).