logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

tls_accept_socket, tls_accept_fds, tls_accept_cbs — accept an incoming client connection in a TLS server

Authors

       Joel Sing <jsing@openbsd.org>

       tls_accept_cbs() was written by Tobias Pape <tobias@netshed.de>.

Debian                                            May 26, 2018                              TLS_ACCEPT_SOCKET(3)

Description

       After creating a TLS server context tls with tls_server(3) and configuring it  with  tls_configure(3),  a
       server can accept a new client connection by calling tls_accept_socket() on an already established socket
       connection.

       Alternatively,  a  new  client  connection  can  be  accepted over a pair of existing file descriptors by
       calling tls_accept_fds().

       Calling tls_accept_cbs() allows read  and  write  callback  functions  to  handle  data  transfers.   The
       specified  cb_arg  parameter  is  passed  back to the functions, and can contain a pointer to any caller-
       specified data.

       All these functions create a new context suitable for reading and writing and return it in *cctx.

History

tls_accept_socket() appeared in OpenBSD 5.6 and got its final name in OpenBSD 5.7.

       tls_accept_fds() appeared in OpenBSD 5.8 and tls_accept_cbs() in OpenBSD 6.1.

Name

       tls_accept_socket, tls_accept_fds, tls_accept_cbs — accept an incoming client connection in a TLS server

Return Values

       These functions return 0 on success or -1 on error.

See Also

tls_close(3), tls_config_set_session_id(3), tls_configure(3), tls_connect(3), tls_init(3), tls_server(3)

Synopsis

#include<tls.h>inttls_accept_socket(structtls*tls, structtls**cctx, intsocket);

       inttls_accept_fds(structtls*tls, structtls**cctx, intfd_read, intfd_write);

       inttls_accept_cbs(structtls*tls,                                                        structtls**cctx,
           ssize_t(*tls_read_cb)(structtls*ctx,void*buf,size_tbuflen,void*cb_arg),
           ssize_t(*tls_write_cb)(structtls*ctx,constvoid*buf,size_tbuflen,void*cb_arg),
           void*cb_arg);

See Also