Scroll to navigation

TLS_ACCEPT_SOCKET(3) Library Functions Manual TLS_ACCEPT_SOCKET(3)

NAME

tls_accept_socket,tls_accept_fds,tls_accept_cbsaccept an incoming client connection in a TLS server

SYNOPSIS

#include<tls.h>

int
tls_accept_socket(struct tls *tls,struct tls **cctx,int socket);

int
tls_accept_fds(struct tls *tls,struct tls **cctx,int fd_read,int fd_write);

int
tls_accept_cbs(struct tls *tls,struct tls **cctx,ssize_t (*tls_read_cb)(struct tls *ctx, void *buf, size_t buflen, void *cb_arg),ssize_t (*tls_write_cb)(struct tls *ctx, const void *buf, size_t buflen, void *cb_arg),void *cb_arg);

DESCRIPTION

After creating a TLS server contexttlswithtls_server(3)and configuring it withtls_configure(3),a server can accept a new client connection by calling()on an already established socket connection.

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

Calling()allows read and write callback functions to handle data transfers.The specifiedcb_argparameter 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 writingand return it in*cctx.

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)

HISTORY

tls_accept_socket()appeared inOpenBSD5.6and got its final name inOpenBSD5.7.

tls_accept_fds()appeared inOpenBSD5.8andtls_accept_cbs()inOpenBSD6.1.

AUTHORS

Joel Sing<jsing@openbsd.org>

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

May 26, 2018 Debian