|
KEEL 1.0.0
Minimal C11 HTTP client/server library built on epoll/kqueue/io_uring/poll
|
#include <tls.h>
Data Fields | |
| KlTlsResult(* | handshake )(KlTls *self, int fd) |
| Non-blocking handshake step. Call repeatedly until OK or ERROR. | |
| ssize_t(* | read )(KlTls *self, int fd, void *buf, size_t len) |
| Decrypt: read up to len bytes of plaintext into buf. | |
| ssize_t(* | write )(KlTls *self, int fd, const void *buf, size_t len) |
| Encrypt: write up to len bytes of plaintext from buf. | |
| KlTlsResult(* | shutdown )(KlTls *self, int fd) |
| Initiate TLS shutdown (close_notify). | |
| size_t(* | pending )(KlTls *self) |
| Bytes buffered inside TLS that can be read without a syscall. | |
| void(* | reset )(KlTls *self) |
| Reset for connection reuse (keep-alive). TLS session persists. | |
| void(* | destroy )(KlTls *self) |
| Free all resources. | |
| const char *(* | alpn_protocol )(KlTls *self) |
| Negotiated ALPN protocol, or NULL. Optional — set to NULL if not supported. | |
| 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 the backend. Must be called before handshake(). | |
| KlTlsResult(* KlTls::handshake) (KlTls *self, int fd) |
Non-blocking handshake step. Call repeatedly until OK or ERROR.
| self | TLS session. |
| fd | Socket file descriptor. |
| ssize_t(* KlTls::read) (KlTls *self, int fd, void *buf, size_t len) |
Decrypt: read up to len bytes of plaintext into buf.
| ssize_t(* KlTls::write) (KlTls *self, int fd, const void *buf, size_t len) |
Encrypt: write up to len bytes of plaintext from buf.
| KlTlsResult(* KlTls::shutdown) (KlTls *self, int fd) |
Initiate TLS shutdown (close_notify).
| size_t(* KlTls::pending) (KlTls *self) |
Bytes buffered inside TLS that can be read without a syscall.
Critical for edge-triggered event loops: TLS may decrypt multiple application records in one read. Without pending(), buffered plaintext stalls until the next TCP segment arrives.
| void(* KlTls::reset) (KlTls *self) |
Reset for connection reuse (keep-alive). TLS session persists.
| void(* KlTls::destroy) (KlTls *self) |
Free all resources.
| const char *(* KlTls::alpn_protocol) (KlTls *self) |
Negotiated ALPN protocol, or NULL. Optional — set to NULL if not supported.
| int(* KlTls::set_hostname) (KlTls *self, const char *hostname) |
Set the expected server hostname for SNI (client mode). Optional — set to NULL if not supported by the backend. Must be called before handshake().
| self | TLS session. |
| hostname | Server hostname for SNI and certificate verification. |