#include <ngtcp2/ngtcp2_crypto_picotls.h>

int ngtcp2_crypto_picotls_configure_client_session(ngtcp2_crypto_picotls_ctx *cptls, ngtcp2_conn *conn)

ngtcp2_crypto_picotls_configure_client_session() configures cptls for client side QUIC connection. It performs the following modifications:

  • Set handshake_properties.max_early_data_size to a pointer to uint32_t, which is allocated dynamically by this function.

  • Set handshake_properties.collect_extension to ngtcp2_crypto_picotls_collect_extension().

  • Set handshake_properties.collected_extensions to ngtcp2_crypto_picotls_collected_extensions().

  • Set handshake_properties.additional_extensions[0].data to the dynamically allocated buffer which contains QUIC Transport Parameters TLS extension. An application must allocate at least 2 elements for handshake_properties.additional_extensions.

The callbacks set by this function only handle QUIC Transport Parameters TLS extension. If an application needs to handle the other TLS extensions, set its own callbacks and call ngtcp2_crypto_picotls_collect_extension() and ngtcp2_crypto_picotls_collected_extensions() form them.

Call ngtcp2_crypto_picotls_deconfigure_session() to free up the resources.

Application must set a pointer to ngtcp2_crypto_conn_ref to ptls_t object by assigning the pointer using ptls_get_data_ptr, and ngtcp2_crypto_conn_ref object must have ngtcp2_crypto_conn_ref.get_conn field assigned to get ngtcp2_conn.

It returns 0 if it succeeds, or -1.