SSL_FP(3)

NAME
ssl_fdopen, ssl_log - SSL utility routines

LIBRARY
PDEL Library (libpdel, -lpdel)

SYNOPSIS
#include <sys/types.h>
#include <openssl/ssl.h>
#include <pdel/io/ssl_fp.h>
FILE *
ssl_fdopen(SSL_CTX *ssl_ctx, int fd, int server, const char *mtype, ssl_logger_t *logger, void *logarg, u_int timeout);
void
ssl_log(ssl_logger_t *logger, void *arg);

DESCRIPTION
ssl_fdopen() converts an encrypted SSL file descriptor into an unencrypted stream. When the returned stream is closed via fclose(3), so too is the underlying file descriptor.

ssl_ctx is the SSL context. fd is the original file descriptor, over which the SSL protocol is spoken. server should be non-zero if the local side is the server. The stream's private state is allocated with typed_mem(3) type mtype. An idle timeout may be specified by setting timeout to the number of seconds.

logger, if not NULL, is a pointer to a logging function having this type:

    typedef void ssl_logger_t(void *arg, int sev, const char *fmt, ...);

The logarg is passed to logger() as arg. sev is a syslog(3) severity level, and fmt is a printf(3) like format string with subsequent arguments.

ssl_log() is a routine for logging any SSL error. It takes a logger and arg as specified above.

RETURN VALUES
ssl_fdopen() returns NULL if an error occurs, with errno set appropriately.

SEE ALSO
libpdel(3), syslog(3), typed_mem(3)

HISTORY
The PDEL library was developed at Packet Design, LLC. http://www.packetdesign.com/

AUTHORS
Archie Cobbs <archie@packetdesign.com>