DragonFly On-Line Manual Pages
BIO(3) DragonFly Library Functions Manual BIO(3)
NAME
BIO -- I/O abstraction
SYNOPSIS
#include <openssl/bio.h>
DESCRIPTION
A BIO is an I/O abstraction, it hides many of the underlying I/O details
from an application. If an application uses a BIO for its I/O, it can
transparently handle SSL connections, unencrypted network connections and
file I/O.
There are two types of BIO, a source/sink BIO and a filter BIO.
As its name implies, a source/sink BIO is a source and/or sink of data,
examples include a socket BIO and a file BIO.
A filter BIO takes data from one BIO and passes it through to another, or
to the application. The data may be left unmodified (for example a mes-
sage digest BIO) or translated (for example an encryption BIO). The
effect of a filter BIO may change according to the I/O operation it is
performing: for example an encryption BIO will encrypt data if it is
being written to and decrypt data if it is being read from.
BIOs can be joined together to form a chain (a single BIO is a chain with
one component). A chain normally consist of one source/sink BIO and one
or more filter BIOs. Data read from or written to the first BIO then
traverses the chain to the end (normally a source/sink BIO).
SEE ALSO
BIO_ctrl(3), BIO_f_base64(3), BIO_f_buffer(3), BIO_f_cipher(3),
BIO_f_md(3), BIO_f_null(3), BIO_f_ssl(3), BIO_find_type(3), BIO_new(3),
BIO_new_bio_pair(3), BIO_push(3), BIO_read(3), BIO_s_accept(3),
BIO_s_bio(3), BIO_s_connect(3), BIO_s_fd(3), BIO_s_file(3), BIO_s_mem(3),
BIO_s_null(3), BIO_s_socket(3), BIO_set_callback(3), BIO_should_retry(3)
DragonFly 4.7 July 17, 2014 DragonFly 4.7
BIO_push(3) OpenSSL BIO_push(3)
NAME
BIO_push, BIO_pop - add and remove BIOs from a chain.
SYNOPSIS
#include <openssl/bio.h>
BIO * BIO_push(BIO *b,BIO *append);
BIO * BIO_pop(BIO *b);
DESCRIPTION
The BIO_push() function appends the BIO append to b, it returns b.
BIO_pop() removes the BIO b from a chain and returns the next BIO in
the chain, or NULL if there is no next BIO. The removed BIO then
becomes a single BIO with no association with the original chain, it
can thus be freed or attached to a different chain.
NOTES
The names of these functions are perhaps a little misleading.
BIO_push() joins two BIO chains whereas BIO_pop() deletes a single BIO
from a chain, the deleted BIO does not need to be at the end of a
chain.
The process of calling BIO_push() and BIO_pop() on a BIO may have
additional consequences (a control call is made to the affected BIOs)
any effects will be noted in the descriptions of individual BIOs.
EXAMPLES
For these examples suppose md1 and md2 are digest BIOs, b64 is a base64
BIO and f is a file BIO.
If the call:
BIO_push(b64, f);
is made then the new chain will be b64-f. After making the calls
BIO_push(md2, b64);
BIO_push(md1, md2);
the new chain is md1-md2-b64-f. Data written to md1 will be digested by
md1 and md2, base64 encoded and written to f.
It should be noted that reading causes data to pass in the reverse
direction, that is data is read from f, base64 decoded and digested by
md1 and md2. If the call:
BIO_pop(md2);
The call will return b64 and the new chain will be md1-b64-f data can
be written to md1 as before.
RETURN VALUES
BIO_push() returns the end of the chain, b.
BIO_pop() returns the next BIO in the chain, or NULL if there is no
next BIO.
SEE ALSO
TBA
1.0.2h 2016-05-03 BIO_push(3)