Module s2n_quic_tls::callbacks

source ·
Expand description

Utilities to handle passing Rust code to s2n-tls’s C callbacks.

s2n-tls uses callbacks to temporarily return control to the application and allow the application to execute custom code.

To use a callback in your application, just implement the trait for the target callback type and pass your implementation to the appropriate connection or config method. For example, you can implement ClientHelloCallback and pass that implementation to config::Builder::set_client_hello_callback() in order to execute custom logic after an s2n-tls server receives a client hello.

s2n-tls callbacks come in two flavors:

  • “sync” callbacks return an immediate result and will block the task performing the handshake until they return success or failure. See VerifyHostNameCallback as an example.
  • “async” callbacks return a Poll and should not block the task performing the handshake. They will be polled until they return Poll::Ready. Connection::waker() can be used to register the task for wakeup. See ClientHelloCallback as an example.

Structs§

Enums§

Traits§