![]() | ![]() | |||||||||||||||||
| ||||||||||||||||||
| BIO_new_bio_pair(3)
NAMEBIO_new_bio_pair - create a new BIO pair
SYNOPSIS#include <openssl/bio.h> int BIO_new_bio_pair(BIO **bio1, size_t writebuf1, BIO **bio2, size_t writebuf2);
DESCRIPTION
The two new BIOs bio1 and bio2 are symmetric with respect to their functionality. The size of their buffers is determined by writebuf1 and writebuf2. If the size give is 0, the default size is used.
The two BIOs, even though forming a BIO pair and must be
EXAMPLE
The BIO pair can be used to have full control over the network access of an
application. The application can call 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(); ... application | TLS-engine
| |
+----------> SSL_operations()
| /\ ||
| || \/
| BIO-pair (internal_bio)
+----------< BIO-pair (network_bio)
| |
socket |
... SSL_free(ssl); /* implicitly frees internal_bio */ BIO_free(network_bio); ... As the BIO pair will only buffer the data and never directly access the connection, it behaves non-blocking and will return as soon as the write buffer is full or the read buffer is drained. Then the application has to flush the write buffer and/or fill the read buffer.
Use the
WARNING
As the data is buffered,
RETURN VALUESThe following return values can occur:
SEE ALSOSSL_set_bio(3), ssl(3), bio(3), BIO_ctrl_pending(3), BIO_ctrl_get_read_request(3) | |||||||||||||||||