Library guide · API index and notation
This page is generated from the bundled library in this checkout. Signatures and adjacent source comments are reproduced below; the linked guide explains usage, storage, failures, and platform support.
import "std/quic/openssl"
Names used in signatures
Unqualified names denote this package’s types (including other source files in the same package), language built-ins, or generic parameters such as T. Qualified names use the import aliases below. These aliases belong to the library source; import a dependency yourself to use its alias in your program.
| Alias | Package | Source file |
|---|---|---|
io |
std/io |
openssl.dodo |
native |
std/quic/native |
openssl.dodo |
net |
std/net |
openssl.dodo |
option |
core/option |
openssl.dodo |
ptr |
core/ptr |
openssl.dodo |
quic |
std/quic |
openssl.dodo |
Config
Struct · Source
All configuration bytes are copied/parsed during construction. PEM key bytes remain the caller’s secret and must be wiped by the caller when appropriate.
pub struct Config {
pub hostname: &[u8]
// RFC 7301 wire format: one-byte length followed by protocol bytes. QUIC
// requires ALPN, so the list must be nonempty.
pub alpn: &[u8]
pub trust_pem: &[u8]
pub certificate_pem: &[u8]
pub private_key_pem: &[u8]
pub system_roots: bool
pub require_client_certificate: bool
// -1 uses the backend's platform wall clock; >=0 is explicit Unix seconds.
pub verification_time: i64
// Client-requested idle timeout; 0 keeps OpenSSL's 30 s default. The peers
// use the smaller nonzero value. OpenSSL 3.5 listeners cannot set it.
pub idle_timeout_ms: u64
}
Config.client
Function · Source
pub fn client(hostname: &[u8], alpn: &[u8]) -> Config from(hostname, alpn)
Config.server
Function · Source
pub fn server(certificate: &[u8], key: &[u8], alpn: &[u8]) -> Config from(certificate, key, alpn)
Listener
Struct · Source
A QUIC server endpoint: owns the bound UDP socket, the TLS context and every connection that has not yet been accepted. Accepted connections and their streams share its socket and event processing; processing events on any of them advances all of them. Deliberately not Send/Sync.
pub struct Listener {
// Private implementation fields omitted.
}
Listener.bind
Function · Source
pub fn bind(config: &Config, address: &net.SocketAddress) -> Listener!quic.Error
Listener.accept
Function · Source
A connection may still be completing its handshake; drive handshake() until Ready before trusting its peer.
pub fn accept(&mut self) -> Option<Connection>!quic.Error
Listener.local_address
Function · Source
pub fn local_address(&self) -> net.SocketAddress!quic.Error
Listener.process
Function · Source
Process received datagrams and expired timers without waiting.
pub fn process(&mut self) -> void!quic.Error
Listener.timeout_ms
Function · Source
Milliseconds until the next protocol timer; none when no timer is armed.
pub fn timeout_ms(&self) -> Option<u64>
Listener.wait
Function · Source
Wait for socket readiness up to
milliseconds(capped at 60 s) or the next protocol timer, whichever is earlier, then process events.
pub fn wait(&mut self, milliseconds: u32) -> void!quic.Error
Listener.abort
Function · Source
Immediate release without notifying peers. Idempotent.
pub fn abort(&mut self)
Connection
Struct · Source
One QUIC connection. A client connection owns its connected UDP socket.
pub struct Connection {
// Private implementation fields omitted.
}
Connection.connect
Function · Source
Starts a nonblocking client handshake toward an already resolved address.
config.hostnameis verified independently of the address.
pub fn connect(config: &Config, address: &net.SocketAddress) -> Connection!quic.Error
Connection.handshake
Function · Source
Ready once the handshake and peer verification have completed.
pub fn handshake(&mut self) -> quic.State!quic.Error
Connection.handshake_until
Function · Source
Caller supplies monotonic time/deadline and cancellation observation. Deadline is inclusive. Timeout or cancellation aborts the connection.
pub fn handshake_until(&mut self, now: u64, deadline: u64, cancelled: bool) -> quic.State!quic.Error
Connection.open_bidirectional
Function · Source
None while the handshake is incomplete or the peer’s stream limit is exhausted; process events and retry.
pub fn open_bidirectional(&mut self) -> Option<Stream>!quic.Error
Connection.open_unidirectional
Function · Source
pub fn open_unidirectional(&mut self) -> Option<Stream>!quic.Error
Connection.accept_stream
Function · Source
The next stream the peer opened, if any.
pub fn accept_stream(&mut self) -> Option<Stream>!quic.Error
Connection.close
Function · Source
Graceful CONNECTION_CLOSE carrying an application error code, after concluded streams have been flushed. Repeat until Finished.
pub fn close(&mut self, code: u64) -> quic.State!quic.Error
Connection.close_info
Function · Source
Present once the connection has terminated for any reason.
pub fn close_info(&self) -> Option<quic.CloseInfo>
Connection.selected_alpn
Function · Source
pub fn selected_alpn(&self, destination: &mut[u8]) -> usize!quic.Error
Connection.local_address
Function · Source
The local socket address; accepted connections report the address of the listener socket they share.
pub fn local_address(&self) -> net.SocketAddress!quic.Error
Connection.process
Function · Source
pub fn process(&mut self) -> void!quic.Error
Connection.timeout_ms
Function · Source
pub fn timeout_ms(&self) -> Option<u64>
Connection.wait
Function · Source
pub fn wait(&mut self, milliseconds: u32) -> void!quic.Error
Connection.abort
Function · Source
Immediate release without sending CONNECTION_CLOSE; the peer observes only its idle timeout. Idempotent. Live streams keep the connection’s native state until they are released too.
pub fn abort(&mut self)
Stream
Struct · Source
One QUIC stream. Bidirectional streams read and write; a unidirectional stream only writes when opened locally and only reads when accepted.
pub struct Stream {
// Private implementation fields omitted.
}
Stream.id
Function · Source
QUIC stream ID; bit 0 marks server-initiated, bit 1 unidirectional.
pub fn id(&self) -> u64
Stream.readable
Function · Source
pub fn readable(&self) -> bool
Stream.writable
Function · Source
pub fn writable(&self) -> bool
Stream.local
Function · Source
pub fn local(&self) -> bool
Stream.receive
Function · Source
Copies an initialized prefix. Pending means no data yet; Finished means the peer concluded the stream and every byte has been read.
pub fn receive(&mut self, destination: &mut[u8]) -> quic.Progress!quic.Error
Stream.send
Function · Source
Accepts a prefix into OpenSSL’s stream send buffer; accepted bytes are no longer borrowed. Pending means the buffer or flow-control window is full.
pub fn send(&mut self, source: &[u8]) -> quic.Progress!quic.Error
Stream.conclude
Function · Source
Send FIN after every accepted byte. Idempotent; later sends fail Closed.
pub fn conclude(&mut self) -> void!quic.Error
Stream.reset
Function · Source
Abandon the sending part with RESET_STREAM; unsent bytes are discarded.
pub fn reset(&mut self, code: u64) -> void!quic.Error
Stream.take_error
Function · Source
std/io adapters. Pending becomes WouldBlock; take_error() preserves the typed QUIC cause, including a peer’s reset code.
pub fn take_error(&mut self) -> Option<quic.Error>
Stream.poll_read
Function · Source
pub fn poll_read(&mut self, destination: &mut[u8]) -> io.Poll!io.Error
Stream.poll_write
Function · Source
pub fn poll_write(&mut self, source: &[u8]) -> io.Poll!io.Error
Stream.read
Function · Source
pub fn read(&mut self, destination: &mut[u8]) -> usize!io.Error
Stream.write
Function · Source
pub fn write(&mut self, source: &[u8]) -> usize!io.Error
Stream.abort
Function · Source
Release the stream object. A stream that was neither concluded nor reset is reset by OpenSSL; a concluded stream keeps delivering buffered bytes.
pub fn abort(&mut self)