Sortix cross-volatile manual
This manual documents Sortix cross-volatile. You can instead view this document in the latest official manual.
NAME
BIO_s_bio, BIO_make_bio_pair, BIO_destroy_bio_pair, BIO_shutdown_wr, BIO_set_write_buf_size, BIO_get_write_buf_size, BIO_new_bio_pair, BIO_get_write_guarantee, BIO_ctrl_get_write_guarantee, BIO_get_read_request, BIO_ctrl_get_read_request, BIO_ctrl_reset_read_request — BIO pair BIOSYNOPSIS
#include <openssl/bio.h>BIO_s_bio(void);
BIO_make_bio_pair(BIO *b1, BIO *b2);
BIO_destroy_bio_pair(BIO *b);
BIO_shutdown_wr(BIO *b);
BIO_set_write_buf_size(BIO *b, long size);
BIO_get_write_buf_size(BIO *b, long size);
BIO_new_bio_pair(BIO **bio1, size_t writebuf1, BIO **bio2, size_t writebuf2);
BIO_get_write_guarantee(BIO *b);
BIO_ctrl_get_write_guarantee(BIO *b);
BIO_get_read_request(BIO *b);
BIO_ctrl_get_read_request(BIO *b);
BIO_ctrl_reset_read_request(BIO *b);
DESCRIPTION
BIO_s_bio() returns the method for a BIO pair. A BIO pair is a pair of source/sink BIOs where data written to either half of the pair is buffered and can be read from the other half. Both halves must usually be handled by the same application thread since no locking is done on the internal data structures.
cmd constant |
corresponding macro |
BIO_C_DESTROY_BIO_PAIR | BIO_destroy_bio_pair() |
BIO_C_GET_READ_REQUEST | BIO_get_read_request() |
BIO_C_GET_WRITE_BUF_SIZE | BIO_get_write_buf_size() |
BIO_C_GET_WRITE_GUARANTEE | BIO_get_write_guarantee() |
BIO_C_MAKE_BIO_PAIR | BIO_make_bio_pair() |
BIO_C_RESET_READ_REQUEST | BIO_ctrl_reset_read_request() |
BIO_C_SET_WRITE_BUF_SIZE | BIO_set_write_buf_size() |
BIO_C_SHUTDOWN_WR | BIO_shutdown_wr() |
BIO_CTRL_EOF | BIO_eof(3) |
BIO_CTRL_GET_CLOSE | BIO_get_close(3) |
BIO_CTRL_PENDING | BIO_pending(3) |
BIO_CTRL_RESET | BIO_reset(3) |
BIO_CTRL_SET_CLOSE | BIO_set_close(3) |
BIO_CTRL_WPENDING | BIO_wpending(3) |
RETURN VALUES
BIO_new_bio_pair() returns 1 on success, with the new BIOs available in bio1 and bio2, or 0 on failure, with NULL pointers stored into the locations for bio1 and bio2. Check the error stack for more information.EXAMPLES
The BIO pair can be used to have full control over the network access of an application. The application can call select(2) on the socket as required without having to go through the SSL interface.BIO *internal_bio, *network_bio; ... BIO_new_bio_pair(&internal_bio, 0, &network_bio, 0); SSL_set_bio(ssl, internal_bio, internal_bio); SSL_operations(); /* e.g. SSL_read() and SSL_write() */ ... application | TLS-engine | | +----------> SSL_operations() | /\ || | || \/ | BIO-pair (internal_bio) | BIO-pair (network_bio) | || /\ | \/ || +-----------< BIO_operations() | | socket | ... SSL_free(ssl); /* implicitly frees internal_bio */ BIO_free(network_bio); ...