Manual Page Result
0
Command: BIO_meth_new | Section: 3 | Source: OpenBSD | File: BIO_meth_new.3
BIO_METH_NEW(3) FreeBSD Library Functions Manual BIO_METH_NEW(3)
NAME
BIO_get_new_index, BIO_meth_new, BIO_meth_free, BIO_meth_get_write,
BIO_meth_set_write, BIO_meth_get_read, BIO_meth_set_read,
BIO_meth_get_puts, BIO_meth_set_puts, BIO_meth_get_gets,
BIO_meth_set_gets, BIO_meth_get_ctrl, BIO_meth_set_ctrl,
BIO_meth_get_create, BIO_meth_set_create, BIO_meth_get_destroy,
BIO_meth_set_destroy, BIO_meth_get_callback_ctrl,
BIO_meth_set_callback_ctrl - manipulate BIO_METHOD structures
SYNOPSIS
#include <openssl/bio.h>
int
BIO_get_new_index(void);
BIO_METHOD *
BIO_meth_new(int type, const char *name);
void
BIO_meth_free(BIO_METHOD *biom);
int
(*BIO_meth_get_write(const BIO_METHOD *biom))(BIO *, const char *, int);
int
BIO_meth_set_write(BIO_METHOD *biom,
int (*write)(BIO *, const char *, int));
int
(*BIO_meth_get_read(const BIO_METHOD *biom))(BIO *, char *, int);
int
BIO_meth_set_read(BIO_METHOD *biom, int (*read)(BIO *, char *, int));
int
(*BIO_meth_get_puts(const BIO_METHOD *biom))(BIO *, const char *);
int
BIO_meth_set_puts(BIO_METHOD *biom, int (*puts)(BIO *, const char *));
int
(*BIO_meth_get_gets(const BIO_METHOD *biom))(BIO *, char *, int);
int
BIO_meth_set_gets(BIO_METHOD *biom, int (*gets)(BIO *, char *, int));
long
(*BIO_meth_get_ctrl(const BIO_METHOD *biom))(BIO *, int, long, void *);
int
BIO_meth_set_ctrl(BIO_METHOD *biom,
long (*ctrl)(BIO *, int, long, void *));
int
(*BIO_meth_get_create(const BIO_METHOD *biom))(BIO *);
int
BIO_meth_set_create(BIO_METHOD *biom, int (*create)(BIO *));
int
(*BIO_meth_get_destroy(const BIO_METHOD *biom))(BIO *);
int
BIO_meth_set_destroy(BIO_METHOD *biom, int (*destroy)(BIO *));
long
(*BIO_meth_get_callback_ctrl(const BIO_METHOD *biom))(BIO *, int,
BIO_info_cb *);
int
BIO_meth_set_callback_ctrl(BIO_METHOD *biom,
long (*callback_ctrl)(BIO *, int, BIO_info_cb *));
DESCRIPTION
The BIO_METHOD structure stores function pointers implementing a BIO
type. See BIO_new(3) for more information about BIO objects.
BIO_meth_new() creates a new BIO_METHOD structure. It requires a unique
integer type; use BIO_get_new_index() to get the value for type.
Currently, the user can only create up to 127 different BIO types, and
type is limited to the range 129-255. The name pointer is stored in the
structure and will not be freed by BIO_meth_free().
The standard BIO types are listed in <openssl/bio.h>. Some examples
include BIO_TYPE_BUFFER and BIO_TYPE_CIPHER. The type of filter BIOs
should have the BIO_TYPE_FILTER bit set. Source/sink BIOs should have
the BIO_TYPE_SOURCE_SINK bit set. File descriptor based BIOs (e.g.
socket, fd, connect, accept etc.) should additionally have the
BIO_TYPE_DESCRIPTOR bit set. See BIO_find_type(3) for more information.
BIO_meth_free() is an alias for free(3).
BIO_meth_get_write(), BIO_meth_set_write(), BIO_meth_get_read(), and
BIO_meth_set_read() get and set the functions write and read used for
writing and reading arbitrary length data to and from the BIO. These
functions are called from BIO_write(3) and BIO_read(3), respectively.
The parameters and return values of write and read have the same meaning
as for BIO_write(3) and BIO_read(3).
BIO_meth_get_puts() and BIO_meth_set_puts() get and set the function puts
used for writing a NUL-terminated string to the BIO. This function is
called from BIO_puts(3). The parameters and the return value of puts
have the same meaning as for BIO_puts(3).
BIO_meth_get_gets() and BIO_meth_set_gets() get and set the function gets
used for reading a line of data from the BIO. This function is called
from BIO_gets(3). The parameters and the return value of gets have the
same meaning as for BIO_gets(3).
BIO_meth_get_ctrl() and BIO_meth_set_ctrl() get and set the function ctrl
used for processing control messages in the BIO. This function is called
from BIO_ctrl(3). The parameters and return value of ctrl have the same
meaning as for BIO_ctrl(3).
BIO_meth_get_create() and BIO_meth_set_create() get and set a function
create used while initializing a new instance of the BIO. This function
is called from BIO_new(3). The BIO_new(3) function allocates the memory
for the new BIO, and a pointer to this newly allocated structure is
passed as the parameter to create.
BIO_meth_get_destroy() and BIO_meth_set_destroy() get and set a function
destroy used while destroying an instance of a BIO. This function is
called from BIO_free(3). A pointer to the BIO to be destroyed is passed
as the parameter. The destroy function is intended to perform clean-up
specific to the BIO type. The memory for the BIO itself must not be
freed by this function.
BIO_meth_get_callback_ctrl() and BIO_meth_set_callback_ctrl() get and set
the function callback_ctrl used for processing callback control messages
in the BIO. This function is called from BIO_callback_ctrl(3). The
parameters and return value of callback_ctrl have the same meaning as for
BIO_callback_ctrl(3).
RETURN VALUES
BIO_get_new_index() returns the new BIO type value or -1 if an error
occurs.
BIO_meth_new() returns the new BIO_METHOD structure or NULL if an error
occurs.
The BIO_meth_set_*() functions return 1 on success or 0 on error.
Currently, they cannot fail.
The BIO_meth_get_*() functions return function pointers.
SEE ALSO
BIO_ctrl(3), BIO_find_type(3), BIO_new(3), BIO_read(3)
HISTORY
These functions first appeared in OpenSSL 1.1.0 and have been available
since OpenBSD 6.3.
FreeBSD 14.1-RELEASE-p8 July 9, 2018 FreeBSD 14.1-RELEASE-p8