1TLS_ACCEPT_SOCKET(3) BSD Library Functions Manual TLS_ACCEPT_SOCKET(3)
2
4 tls_accept_socket, tls_accept_fds, tls_accept_cbs — accept an incoming
5 client connection in a TLS server
6
8 #include <tls.h>
9
10 int
11 tls_accept_socket(struct tls *tls, struct tls **cctx, int socket);
12
13 int
14 tls_accept_fds(struct tls *tls, struct tls **cctx, int fd_read,
15 int fd_write);
16
17 int
18 tls_accept_cbs(struct tls *tls, struct tls **cctx,
19 ssize_t (*tls_read_cb)(struct tls *ctx, void *buf, size_t buflen, void *cb_arg),
20 ssize_t (*tls_write_cb)(struct tls *ctx, const void *buf, size_t buflen, void *cb_arg),
21 void *cb_arg);
22
24 After creating a TLS server context tls with tls_server(3) and configur‐
25 ing it with tls_configure(3), a server can accept a new client connection
26 by calling tls_accept_socket() on an already established socket connec‐
27 tion.
28
29 Alternatively, a new client connection can be accepted over a pair of
30 existing file descriptors by calling tls_accept_fds().
31
32 Calling tls_accept_cbs() allows read and write callback functions to han‐
33 dle data transfers. The specified cb_arg parameter is passed back to the
34 functions, and can contain a pointer to any caller-specified data.
35
36 All these functions create a new context suitable for reading and writing
37 and return it in *cctx.
38
40 These functions return 0 on success or -1 on error.
41
43 tls_close(3), tls_config_set_session_id(3), tls_configure(3),
44 tls_connect(3), tls_init(3), tls_server(3)
45
47 tls_accept_socket() appeared in OpenBSD 5.6 and got its final name in
48 OpenBSD 5.7.
49
50 tls_accept_fds() appeared in OpenBSD 5.8 and tls_accept_cbs() in
51 OpenBSD 6.1.
52
54 Joel Sing <jsing@openbsd.org>
55
56 tls_accept_cbs() was written by Tobias Pape <tobias@netshed.de>.
57
58BSD May 26, 2018 BSD