6#ifndef __CWIST_HTTPS_H__
7#define __CWIST_HTTPS_H__
15#define HTTPS_THREAD_POOL_SIZE HTTP_THREAD_POOL_SIZE
102 const char *key_path);
110 const char *cert_path,
const char *key_path,
mbedTLS TLS backend: error queue subset.
cwist_http_request * cwist_https_receive_request(cwist_https_connection *conn)
Read from the TLS stream until a full HTTP request has been assembled.
cwist_error_t cwist_https_accept(cwist_https_context *ctx, int client_fd, cwist_https_connection **conn)
cwist_error_t cwist_https_server_loop(int server_fd, cwist_https_context *ctx, void(*handler)(cwist_https_connection *conn, void *), void *user_ctx)
cwist_error_t cwist_https_send_response(cwist_https_connection *conn, cwist_http_response *res)
Serialize an HTTP response and send it over an active TLS connection.
cwist_error_t cwist_https_init_context(cwist_https_context **ctx, const char *cert_path, const char *key_path)
struct cwist_https_connection cwist_https_connection
void cwist_https_close_connection(cwist_https_connection *conn)
void cwist_https_destroy_context(cwist_https_context *ctx)
Free an HTTPS context and release its OpenSSL resources.
struct cwist_https_context cwist_https_context
HTTP Protocol Definitions and Helpers.
long cwist_https_tls_ciphers_aes128_gcm_total(void)
Handshakes negotiated with TLS_AES_128_GCM_SHA256.
void https_pool_submit_conn(cwist_https_connection *conn, cwist_https_context *ctx, void(*handler)(cwist_https_connection *, void *), void *user_ctx)
Submit an established connection back to the worker pool (e.g. keep-alive re-arm after async defer)....
@ CWIST_HTTPS_PROTOCOL_HTTP3
@ CWIST_HTTPS_PROTOCOL_HTTP2
@ CWIST_HTTPS_PROTOCOL_HTTP11
@ CWIST_HTTPS_PROTOCOL_NONE
void https_pool_destroy(void)
Shut down the global HTTPS thread pool: signal workers to exit, join them, close any connections stil...
cwist_https_protocol cwist_https_connection_protocol(const cwist_https_connection *conn)
cwist_error_t cwist_https_reload_context(cwist_https_context *ctx, const char *cert_path, const char *key_path, cwist_app *app)
Hot-reload the certificate chain and key of a live HTTPS context.
int https_pool_init(void)
Create the worker threads, mutex, and condition variables of the global HTTPS thread pool....
long cwist_https_tls_handshakes_total(void)
Total TLS handshakes that completed (full + resumed).
long cwist_https_tls_ciphers_other_total(void)
Handshakes negotiated with any other cipher.
uint64_t cwist_https_idle_timeout_ms(void)
Idle keep-alive budget for parked HTTP/1.1 TLS connections, in ms. CWIST_HTTPS_IDLE_TIMEOUT_MS overri...
cwist_error_t cwist_https_send_response_head(cwist_https_connection *conn, cwist_http_response *res)
long cwist_https_tls_handshakes_tls12_total(void)
Handshakes that negotiated TLS 1.2.
long cwist_https_tls_ciphers_chacha20_total(void)
Handshakes negotiated with TLS_CHACHA20_POLY1305_SHA256.
cwist_error_t cwist_https_init_context_with_options(cwist_https_context **ctx, const char *cert_path, const char *key_path, const cwist_https_options *options, cwist_app *app)
bool cwist_https_conn_idle(cwist_https_connection *conn)
True when conn has no buffered TLS bytes and nothing readable.
long cwist_https_pending_handshakes(void)
Number of TLS handshakes currently parked in the shepherd.
long cwist_https_tls_handshakes_resumed_total(void)
TLS handshakes completed via session resumption/ticket.
bool cwist_https_connection_uses_http2(const cwist_https_connection *conn)
Gracefully close an HTTPS connection and free its buffers.
long cwist_https_tls_handshakes_tls13_total(void)
Handshakes that negotiated TLS 1.3.
bool cwist_https_park(cwist_https_connection *conn, uint64_t idle_ms, cwist_https_park_class cls)
Hand an idle connection back to the HTTPS pool's park set.
long cwist_https_tls_connections_active(void)
Currently established TLS connections (wrap minus teardown).
void cwist_https_dispatch(int client_fd, cwist_https_context *ctx, void(*handler)(cwist_https_connection *, void *), void *user_ctx)
Accept a TLS connection without parking a worker on the handshake. Completes the handshake inline whe...
void https_pool_submit(int client_fd, cwist_https_context *ctx, void(*handler)(cwist_https_connection *, void *), void *user_ctx)
Queue a freshly accepted client socket whose TLS handshake still needs to run in a pool worker.
long cwist_https_tls_ciphers_aes256_gcm_total(void)
Handshakes negotiated with TLS_AES_256_GCM_SHA384.
mbedTLS TLS backend: OpenSSL-shaped seam over the CWIST TLS subset.
struct cwist_mtls_ssl SSL
struct cwist_mtls_ctx SSL_CTX
Main Application Context.
Integrated error structure used throughout the system.
HTTP Response Object. Supports standard string body or Zero-Copy pointer body.
void(* proto_state_free)(void *state)
struct cwist_https_context * pool_ctx
bool http2_sequenced_data
cwist_https_protocol negotiated_protocol
void(* pool_handler)(struct cwist_https_connection *, void *)
void * ticket_key
Shared session-ticket key material (forked workers inherit it)
pthread_rwlock_t ctx_lock
Unified error code and type definitions for the CWIST system layer.