6#ifndef __CWIST_HTTP3_H__
7#define __CWIST_HTTP3_H__
95 const char *key_path);
127 const char *key_path);
232 void (*cb)(
const void *data,
size_t len,
void *user_ctx),
313 void (*handler)(
void *stream,
void *user_ctx),
void(* cwist_webtransport_handler_func)(cwist_http_request *req, cwist_http_response *res, void *stream)
Callback function type for handling WebTransport sessions over HTTP/3.
void cwist_http3_set_early_data_guard(cwist_http3_context *ctx, int enabled)
Enable or disable the 0-RTT replay guard (default ON when early data is enabled).
void cwist_http3_set_webtransport_handler(cwist_http3_context *ctx, cwist_webtransport_handler_func handler)
Register a WebTransport session handler on the given HTTP/3 context.
void cwist_http3_destroy_context(cwist_http3_context *ctx)
Destroy an HTTP/3 context.
cwist_error_t cwist_http3_init_context(cwist_http3_context **ctx, const char *cert_path, const char *key_path)
Callback function type for handling WebTransport sessions over HTTP/3.
void cwist_http3_set_datagram_callback(cwist_http3_context *ctx, void(*cb)(const void *data, size_t len, void *user_ctx), void *user_ctx)
Register a callback for incoming QUIC datagrams.
void cwist_http3_set_idle_timeout(cwist_http3_context *ctx, int ms)
Set the idle timeout for QUIC connections.
size_t cwist_webtransport_max_datagram_size(void *session)
Return the current maximum WebTransport datagram payload size.
void cwist_http3_set_handshake_timeout(cwist_http3_context *ctx, int ms)
Set the handshake timeout.
ssize_t cwist_webtransport_send_datagram(void *session, const void *data, size_t len)
Send an unreliable WebTransport datagram in session context.
int cwist_webtransport_close_session(void *session, uint64_t code, const char *reason)
Close a WebTransport session with an application error code.
int cwist_webtransport_open_uni_stream(void *session)
Request a new server-initiated unidirectional WebTransport stream.
cwist_error_t cwist_http3_reload_context(cwist_http3_context *ctx, const char *cert_path, const char *key_path)
Hot-reload the certificate chain and key of a live HTTP/3 context.
ssize_t cwist_webtransport_read(void *stream, void *buf, size_t len)
Read data from a WebTransport stream.
void cwist_http3_set_early_data(cwist_http3_context *ctx, bool enabled)
Enable or disable server-side 0-RTT early data on the given context.
int cwist_webtransport_open_bidi_stream(void *session)
Request a new server-initiated bidirectional WebTransport stream.
cwist_error_t cwist_http3_server_loop(int udp_fd, cwist_http3_context *ctx, cwist_http3_request_handler_func handler, void *user_ctx)
Run the HTTP/3 server event loop.
void cwist_webtransport_set_new_stream_handler(cwist_http3_context *ctx, void(*handler)(void *stream, void *user_ctx), void *user_ctx)
Register a callback for newly created WebTransport data streams.
int cwist_http3_send_datagram(void *conn, const void *data, size_t len)
Send an unreliable datagram over the given QUIC connection.
int cwist_webtransport_flush(void *stream)
Flush any buffered data on a WebTransport stream.
ssize_t cwist_webtransport_write(void *stream, const void *data, size_t len)
Write data to a WebTransport stream.
void cwist_http3_set_datagram_enabled(cwist_http3_context *ctx, int enabled)
Enable or disable QUIC datagram extension on the given context.
void(* cwist_http3_request_handler_func)(void *user_ctx, cwist_http_request *req, cwist_http_response *res)
Callback function type for handling HTTP/3 requests.
void cwist_http3_set_push_enabled(cwist_http3_context *ctx, int enabled)
Enable or disable HTTP/3 server push on the given context.
void cwist_http3_set_ping_period(cwist_http3_context *ctx, int ms)
Set the keep-alive PING period.
void cwist_http3_set_noprogress_timeout(cwist_http3_context *ctx, int ms)
Set the no-progress timeout.
int cwist_http3_set_stream_priority(cwist_http_request *req, unsigned priority)
Set stream priority for the current response.
int cwist_webtransport_close_stream(void *stream)
Close a WebTransport stream.
int cwist_http3_push_resource(cwist_http_request *req, const char *path, const char *content_type)
Push a resource to the client.
cwist_error_t cwist_http3_init_context_ephemeral(cwist_http3_context **ctx)
Initialize an HTTP/3 context with an ephemeral self-signed certificate.
HTTP Protocol Definitions and Helpers.
mbedTLS TLS backend: OpenSSL-shaped seam over the CWIST TLS subset.
struct cwist_mtls_ctx SSL_CTX
Integrated error structure used throughout the system.
HTTP/3 server context encapsulating lsquic/BoringSSL settings.
cwist_webtransport_handler_func wt_handler
int noprogress_timeout_ms
void(* wt_new_stream_handler)(void *stream, void *user_ctx)
void(* handler)(void *user_ctx, cwist_http_request *req, cwist_http_response *res)
pthread_rwlock_t ssl_ctx_lock
SSL_CTX * ssl_ctx_handout
void(* datagram_cb)(const void *data, size_t len, void *user_ctx)
HTTP Response Object. Supports standard string body or Zero-Copy pointer body.
Unified error code and type definitions for the CWIST system layer.