40 ssize_t (*
read)(
KlTls *self,
int fd,
void *buf,
size_t len);
46 ssize_t (*
write)(
KlTls *self,
int fd,
const void *buf,
size_t len);
77 const char *(*alpn_protocol)(
KlTls *self);
Bring-your-own allocator vtable.
Definition allocator.h:12
TLS configuration for KlConfig.
Definition tls.h:108
KlTlsFactory factory
Definition tls.h:110
KlTlsCtx * ctx
Definition tls.h:109
void(* destroy)(KlTls *self)
Free all resources.
Definition tls.h:71
ssize_t(* read)(KlTls *self, int fd, void *buf, size_t len)
Decrypt: read up to len bytes of plaintext into buf.
Definition tls.h:40
KlTlsResult(* shutdown)(KlTls *self, int fd)
Initiate TLS shutdown (close_notify).
Definition tls.h:52
size_t(* pending)(KlTls *self)
Bytes buffered inside TLS that can be read without a syscall.
Definition tls.h:61
int(* set_hostname)(KlTls *self, const char *hostname)
Set the expected server hostname for SNI (client mode). Optional — set to NULL if not supported by th...
Definition tls.h:87
void(* reset)(KlTls *self)
Reset for connection reuse (keep-alive). TLS session persists.
Definition tls.h:66
ssize_t(* write)(KlTls *self, int fd, const void *buf, size_t len)
Encrypt: write up to len bytes of plaintext from buf.
Definition tls.h:46
KlTlsResult(* handshake)(KlTls *self, int fd)
Non-blocking handshake step. Call repeatedly until OK or ERROR.
Definition tls.h:34
KlTlsResult
Result codes for non-blocking TLS operations.
Definition tls.h:11
@ KL_TLS_OK
Definition tls.h:12
@ KL_TLS_WANT_READ
Definition tls.h:13
@ KL_TLS_WANT_WRITE
Definition tls.h:14
@ KL_TLS_ERROR
Definition tls.h:15
struct KlTlsCtx KlTlsCtx
Opaque per-server TLS context (certificates, keys, ciphers). User-owned — KEEL never inspects or modi...
Definition tls.h:94
KlTls *(* KlTlsFactory)(KlTlsCtx *ctx, KlAllocator *alloc)
Factory creates a per-connection KlTls session from the shared context. Called once per connection sl...
Definition tls.h:103