summaryrefslogtreecommitdiff
path: root/src/lib/libtls/man/tls_accept_socket.3
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libtls/man/tls_accept_socket.3')
-rw-r--r--src/lib/libtls/man/tls_accept_socket.384
1 files changed, 84 insertions, 0 deletions
diff --git a/src/lib/libtls/man/tls_accept_socket.3 b/src/lib/libtls/man/tls_accept_socket.3
new file mode 100644
index 0000000000..8ea2b03714
--- /dev/null
+++ b/src/lib/libtls/man/tls_accept_socket.3
@@ -0,0 +1,84 @@
1.\" $OpenBSD: tls_accept_socket.3,v 1.1 2017/01/25 23:53:18 schwarze Exp $
2.\"
3.\" Copyright (c) 2014 Ted Unangst <tedu@openbsd.org>
4.\"
5.\" Permission to use, copy, modify, and distribute this software for any
6.\" purpose with or without fee is hereby granted, provided that the above
7.\" copyright notice and this permission notice appear in all copies.
8.\"
9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\"
17.Dd $Mdocdate: January 25 2017 $
18.Dt TLS_ACCEPT_SOCKET 3
19.Os
20.Sh NAME
21.Nm tls_accept_socket ,
22.Nm tls_accept_fds ,
23.Nm tls_accept_cbs
24.Nd accept an incoming client connection in a TLS server
25.Sh SYNOPSIS
26.In tls.h
27.Ft int
28.Fo tls_accept_socket
29.Fa "struct tls *tls"
30.Fa "struct tls **cctx"
31.Fa "int socket"
32.Fc
33.Ft int
34.Fo tls_accept_fds
35.Fa "struct tls *tls"
36.Fa "struct tls **cctx"
37.Fa "int fd_read"
38.Fa "int fd_write"
39.Fc
40.Ft int
41.Fo tls_accept_cbs
42.Fa "struct tls *tls"
43.Fa "struct tls **cctx"
44.Fa "ssize_t (*tls_read_cb)(struct tls *ctx,\
45 void *buf, size_t buflen, void *cb_arg)"
46.Fa "ssize_t (*tls_write_cb)(struct tls *ctx,\
47 const void *buf, size_t buflen, void *cb_arg)"
48.Fa "void *cb_arg"
49.Fc
50.Sh DESCRIPTION
51After creating a TLS server context
52.Fa tls
53with
54.Xr tls_server 3
55and configuring it with
56.Xr tls_configure 3 ,
57a server can accept a new client connection by calling
58.Fn tls_accept_socket
59on an already established socket connection.
60.Pp
61Alternatively, a new client connection can be accepted over a pair of existing
62file descriptors by calling
63.Fn tls_accept_fds .
64.Pp
65Calling
66.Fn tls_accept_cbs
67allows read and write callback functions to handle data transfers.
68The specified
69.Fa cb_arg
70parameter is passed back to the functions,
71and can contain a pointer to any caller-specified data.
72.Pp
73All these functions create a new context suitable for reading and writing
74and return it in
75.Fa *cctx .
76.Sh RETURN VALUES
77These functions return 0 on success or -1 on error.
78.Sh SEE ALSO
79.Xr tls_close 3 ,
80.Xr tls_config_set_session_id 3 ,
81.Xr tls_configure 3 ,
82.Xr tls_connect 3 ,
83.Xr tls_init 3 ,
84.Xr tls_server 3