Compy 0.2.0
A lightweight RTSP 1.0 server library for embedded systems
Loading...
Searching...
No Matches
tls.h
Go to the documentation of this file.
1
13#pragma once
14
15#include <compy/writer.h>
16
17#include <stddef.h>
18
19#include <unistd.h>
20
21#include <compy/priv/compiler_attrs.h>
22
26typedef struct {
27 const char *cert_path;
28 const char *key_path;
30
35
47Compy_TlsContext_new(Compy_TlsConfig config) COMPY_PRIV_MUST_USE;
48
53
83
98
103
118Compy_TlsConn_accept(Compy_TlsContext *ctx, int fd) COMPY_PRIV_MUST_USE;
119
130Compy_Writer compy_tls_writer(Compy_TlsConn *conn) COMPY_PRIV_MUST_USE;
131
147ssize_t
148compy_tls_read(Compy_TlsConn *conn, void *buf, size_t len) COMPY_PRIV_MUST_USE;
149
156
TLS configuration.
Definition tls.h:26
const char * key_path
Path to PEM private key file.
Definition tls.h:28
const char * cert_path
Path to PEM certificate file.
Definition tls.h:27
Definition tls.c:57
Definition tls.c:15
Compy_Writer compy_tls_writer(Compy_TlsConn *conn) COMPY_PRIV_MUST_USE
Creates a Compy_Writer backed by a TLS connection.
Definition tls.c:193
int Compy_TlsContext_set_cipher_preference(Compy_TlsContext *ctx, Compy_TlsCipherPreference pref)
Sets the ciphersuite preference for all connections accepted through this context.
Definition tls.c:46
void Compy_TlsConn_free(Compy_TlsConn *conn)
Frees per-connection TLS state.
Definition tls.c:112
ssize_t compy_tls_read(Compy_TlsConn *conn, void *buf, size_t len) COMPY_PRIV_MUST_USE
Reads decrypted data from a TLS connection.
Definition tls.c:89
Compy_TlsCipherPreference
TLS ciphersuite preference presets.
Definition tls.h:63
@ COMPY_TLS_CIPHER_DEFAULT
Backend defaults (typically GCM-first in TLS 1.3).
Definition tls.h:65
@ COMPY_TLS_CIPHER_CHACHA20_ONLY
TLS 1.3: allow only CHACHA20-POLY1305-SHA256.
Definition tls.h:81
Compy_TlsContext * Compy_TlsContext_new(Compy_TlsConfig config) COMPY_PRIV_MUST_USE
Creates a new TLS context from configuration.
Definition tls.c:19
void Compy_TlsContext_free(Compy_TlsContext *ctx)
Frees a TLS context.
Definition tls.c:39
Compy_TlsConn * Compy_TlsConn_accept(Compy_TlsContext *ctx, int fd) COMPY_PRIV_MUST_USE
Performs server-side TLS handshake on fd.
Definition tls.c:63
int compy_tls_shutdown(Compy_TlsConn *conn)
Shuts down the TLS connection gracefully.
Definition tls.c:102
The writer interface.