73#if defined(XTC_TLS_BACKEND_OPENSSL) || \
74 defined(XTC_TLS_BACKEND_MBEDTLS) || \
75 defined(XTC_TLS_BACKEND_GNUTLS) || \
76 defined(XTC_TLS_BACKEND_WOLFSSL) || \
77 defined(XTC_TLS_BACKEND_SCHANNEL)
78#define XTC_TLS_ENABLED 1
97typedef struct xtc_tls_ctx xtc_tls_ctx_t;
105typedef struct xtc_tls xtc_tls_t;
111typedef enum xtc_tls_role {
120#define XTC_TLS_VER_12 0x0303
121#define XTC_TLS_VER_13 0x0304
160typedef struct xtc_tls_opts {
161 const char *cert_file;
162 const char *key_file;
165 const char *alpn_protos;
195int xtc_tls_ctx_create(xtc_tls_role_t role,
197 xtc_tls_ctx_t **out);
205void xtc_tls_ctx_destroy(xtc_tls_ctx_t *ctx);
234int xtc_tls_create(xtc_tls_ctx_t *ctx,
int fd, xtc_tls_t **out);
243void xtc_tls_destroy(xtc_tls_t *tls);
269int xtc_tls_handshake(xtc_tls_t *tls);
289int xtc_tls_read(xtc_tls_t *tls,
void *buf,
size_t buflen,
size_t *out_n);
300int xtc_tls_write(xtc_tls_t *tls,
const void *buf,
size_t buflen,
313int xtc_tls_wants_read(
const xtc_tls_t *tls);
321int xtc_tls_wants_write(
const xtc_tls_t *tls);
342int xtc_tls_shutdown(xtc_tls_t *tls);