Blame doc/man3/BIO_push.pod

Packit c4476c
=pod
Packit c4476c
Packit c4476c
=head1 NAME
Packit c4476c
Packit c4476c
BIO_push, BIO_pop, BIO_set_next - add and remove BIOs from a chain
Packit c4476c
Packit c4476c
=head1 SYNOPSIS
Packit c4476c
Packit c4476c
 #include <openssl/bio.h>
Packit c4476c
Packit c4476c
 BIO *BIO_push(BIO *b, BIO *append);
Packit c4476c
 BIO *BIO_pop(BIO *b);
Packit c4476c
 void BIO_set_next(BIO *b, BIO *next);
Packit c4476c
Packit c4476c
=head1 DESCRIPTION
Packit c4476c
Packit c4476c
The BIO_push() function appends the BIO B<append> to B, it returns
Packit c4476c
B.
Packit c4476c
Packit c4476c
BIO_pop() removes the BIO B from a chain and returns the next BIO
Packit c4476c
in the chain, or NULL if there is no next BIO. The removed BIO then
Packit c4476c
becomes a single BIO with no association with the original chain,
Packit c4476c
it can thus be freed or attached to a different chain.
Packit c4476c
Packit c4476c
BIO_set_next() replaces the existing next BIO in a chain with the BIO pointed to
Packit c4476c
by B<next>. The new chain may include some of the same BIOs from the old chain
Packit c4476c
or it may be completely different.
Packit c4476c
Packit c4476c
=head1 NOTES
Packit c4476c
Packit c4476c
The names of these functions are perhaps a little misleading. BIO_push()
Packit c4476c
joins two BIO chains whereas BIO_pop() deletes a single BIO from a chain,
Packit c4476c
the deleted BIO does not need to be at the end of a chain.
Packit c4476c
Packit c4476c
The process of calling BIO_push() and BIO_pop() on a BIO may have additional
Packit c4476c
consequences (a control call is made to the affected BIOs) any effects will
Packit c4476c
be noted in the descriptions of individual BIOs.
Packit c4476c
Packit c4476c
=head1 RETURN VALUES
Packit c4476c
Packit c4476c
BIO_push() returns the end of the chain, B.
Packit c4476c
Packit c4476c
BIO_pop() returns the next BIO in the chain, or NULL if there is no next
Packit c4476c
BIO.
Packit c4476c
Packit c4476c
=head1 EXAMPLES
Packit c4476c
Packit c4476c
For these examples suppose B<md1> and B<md2> are digest BIOs, B<b64> is
Packit c4476c
a base64 BIO and B<f> is a file BIO.
Packit c4476c
Packit c4476c
If the call:
Packit c4476c
Packit c4476c
 BIO_push(b64, f);
Packit c4476c
Packit c4476c
is made then the new chain will be B<b64-f>. After making the calls
Packit c4476c
Packit c4476c
 BIO_push(md2, b64);
Packit c4476c
 BIO_push(md1, md2);
Packit c4476c
Packit c4476c
the new chain is B<md1-md2-b64-f>. Data written to B<md1> will be digested
Packit c4476c
by B<md1> and B<md2>, B<base64> encoded and written to B<f>.
Packit c4476c
Packit c4476c
It should be noted that reading causes data to pass in the reverse
Packit c4476c
direction, that is data is read from B<f>, base64 B<decoded> and digested
Packit c4476c
by B<md1> and B<md2>. If the call:
Packit c4476c
Packit c4476c
 BIO_pop(md2);
Packit c4476c
Packit c4476c
The call will return B<b64> and the new chain will be B<md1-b64-f> data can
Packit c4476c
be written to B<md1> as before.
Packit c4476c
Packit c4476c
=head1 SEE ALSO
Packit c4476c
Packit c4476c
L<bio>
Packit c4476c
Packit c4476c
=head1 HISTORY
Packit c4476c
Packit c4476c
The BIO_set_next() function was added in OpenSSL 1.1.0.
Packit c4476c
Packit c4476c
=head1 COPYRIGHT
Packit c4476c
Packit c4476c
Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved.
Packit c4476c
Packit c4476c
Licensed under the OpenSSL license (the "License").  You may not use
Packit c4476c
this file except in compliance with the License.  You can obtain a copy
Packit c4476c
in the file LICENSE in the source distribution or at
Packit c4476c
L<https://www.openssl.org/source/license.html>.
Packit c4476c
Packit c4476c
=cut