BIO_GET_DATA(3)

NAME
BIO_set_data, BIO_get_data, BIO_set_init, BIO_set_shutdown, BIO_get_shutdown - manage BIO state information

SYNOPSIS
#include <openssl/bio.h>
void
BIO_set_data(BIO *a, void *ptr);
void *
BIO_get_data(BIO *a);
void
BIO_set_init(BIO *a, int init);
void
BIO_set_shutdown(BIO *a, int shutdown);
int
BIO_get_shutdown(BIO *a);

DESCRIPTION
These functions are mainly useful when implementing a custom BIO.

The BIO_set_data() function associates the custom data pointed to by ptr with the BIO a. This data can subsequently be retrieved via a call to BIO_get_data(). This can be used by custom BIOs for storing implementation specific information.

The BIO_set_init() function sets the init flag in a to the specified value. A non-zero value indicates that initialisation is complete, whilst zero indicates that it is not. Often initialisation will complete during initial construction of the BIO. For some BIOs however, initialisation may not be complete until additional steps have been taken, for example through calling custom ctrls.

The BIO_set_shutdown() and BIO_get_shutdown() functions are low-level interfaces to forcefully set and get the shutdown flag of a, circumventing type-dependent sanity checks, exclusively intended for implementing a new BIO type. The shutdown argument must be either BIO_CLOSE or BIO_NOCLOSE. When merely using a BIO object, call BIO_set_close(3) and BIO_get_close(3) instead.

RETURN VALUES
BIO_get_data() returns a pointer to the implementation specific custom data associated with a, or NULL if none is set.

BIO_get_shutdown() returns the value previously set with BIO_set_shutdown() or with BIO_set_close(3).

SEE ALSO
BIO_meth_new(3), BIO_new(3), BIO_set_close(3)

HISTORY
These functions first appeared in OpenSSL 1.1.0 and have been available since OpenBSD 6.3.