1e71b7053SJung-uk Kim=pod 2e71b7053SJung-uk Kim 3e71b7053SJung-uk Kim=head1 NAME 4e71b7053SJung-uk Kim 5e71b7053SJung-uk KimBIO_push, BIO_pop, BIO_set_next - add and remove BIOs from a chain 6e71b7053SJung-uk Kim 7e71b7053SJung-uk Kim=head1 SYNOPSIS 8e71b7053SJung-uk Kim 9e71b7053SJung-uk Kim #include <openssl/bio.h> 10e71b7053SJung-uk Kim 11e71b7053SJung-uk Kim BIO *BIO_push(BIO *b, BIO *append); 12e71b7053SJung-uk Kim BIO *BIO_pop(BIO *b); 13e71b7053SJung-uk Kim void BIO_set_next(BIO *b, BIO *next); 14e71b7053SJung-uk Kim 15e71b7053SJung-uk Kim=head1 DESCRIPTION 16e71b7053SJung-uk Kim 17e71b7053SJung-uk KimThe BIO_push() function appends the BIO B<append> to B<b>, it returns 18e71b7053SJung-uk KimB<b>. 19e71b7053SJung-uk Kim 20e71b7053SJung-uk KimBIO_pop() removes the BIO B<b> from a chain and returns the next BIO 21e71b7053SJung-uk Kimin the chain, or NULL if there is no next BIO. The removed BIO then 22e71b7053SJung-uk Kimbecomes a single BIO with no association with the original chain, 23e71b7053SJung-uk Kimit can thus be freed or attached to a different chain. 24e71b7053SJung-uk Kim 25e71b7053SJung-uk KimBIO_set_next() replaces the existing next BIO in a chain with the BIO pointed to 26e71b7053SJung-uk Kimby B<next>. The new chain may include some of the same BIOs from the old chain 27e71b7053SJung-uk Kimor it may be completely different. 28e71b7053SJung-uk Kim 29e71b7053SJung-uk Kim=head1 NOTES 30e71b7053SJung-uk Kim 31e71b7053SJung-uk KimThe names of these functions are perhaps a little misleading. BIO_push() 32e71b7053SJung-uk Kimjoins two BIO chains whereas BIO_pop() deletes a single BIO from a chain, 33e71b7053SJung-uk Kimthe deleted BIO does not need to be at the end of a chain. 34e71b7053SJung-uk Kim 35e71b7053SJung-uk KimThe process of calling BIO_push() and BIO_pop() on a BIO may have additional 36e71b7053SJung-uk Kimconsequences (a control call is made to the affected BIOs) any effects will 37e71b7053SJung-uk Kimbe noted in the descriptions of individual BIOs. 38e71b7053SJung-uk Kim 39*610a21fdSJung-uk Kim=head1 RETURN VALUES 40*610a21fdSJung-uk Kim 41*610a21fdSJung-uk KimBIO_push() returns the end of the chain, B<b>. 42*610a21fdSJung-uk Kim 43*610a21fdSJung-uk KimBIO_pop() returns the next BIO in the chain, or NULL if there is no next 44*610a21fdSJung-uk KimBIO. 45*610a21fdSJung-uk Kim 46e71b7053SJung-uk Kim=head1 EXAMPLES 47e71b7053SJung-uk Kim 48e71b7053SJung-uk KimFor these examples suppose B<md1> and B<md2> are digest BIOs, B<b64> is 49e71b7053SJung-uk Kima base64 BIO and B<f> is a file BIO. 50e71b7053SJung-uk Kim 51e71b7053SJung-uk KimIf the call: 52e71b7053SJung-uk Kim 53e71b7053SJung-uk Kim BIO_push(b64, f); 54e71b7053SJung-uk Kim 55e71b7053SJung-uk Kimis made then the new chain will be B<b64-f>. After making the calls 56e71b7053SJung-uk Kim 57e71b7053SJung-uk Kim BIO_push(md2, b64); 58e71b7053SJung-uk Kim BIO_push(md1, md2); 59e71b7053SJung-uk Kim 60e71b7053SJung-uk Kimthe new chain is B<md1-md2-b64-f>. Data written to B<md1> will be digested 61e71b7053SJung-uk Kimby B<md1> and B<md2>, B<base64> encoded and written to B<f>. 62e71b7053SJung-uk Kim 63e71b7053SJung-uk KimIt should be noted that reading causes data to pass in the reverse 64e71b7053SJung-uk Kimdirection, that is data is read from B<f>, base64 B<decoded> and digested 65e71b7053SJung-uk Kimby B<md1> and B<md2>. If the call: 66e71b7053SJung-uk Kim 67e71b7053SJung-uk Kim BIO_pop(md2); 68e71b7053SJung-uk Kim 69e71b7053SJung-uk KimThe call will return B<b64> and the new chain will be B<md1-b64-f> data can 70e71b7053SJung-uk Kimbe written to B<md1> as before. 71e71b7053SJung-uk Kim 72e71b7053SJung-uk Kim=head1 SEE ALSO 73e71b7053SJung-uk Kim 74e71b7053SJung-uk KimL<bio> 75e71b7053SJung-uk Kim 76e71b7053SJung-uk Kim=head1 HISTORY 77e71b7053SJung-uk Kim 78e71b7053SJung-uk KimThe BIO_set_next() function was added in OpenSSL 1.1.0. 79e71b7053SJung-uk Kim 80e71b7053SJung-uk Kim=head1 COPYRIGHT 81e71b7053SJung-uk Kim 82*610a21fdSJung-uk KimCopyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved. 83e71b7053SJung-uk Kim 84e71b7053SJung-uk KimLicensed under the OpenSSL license (the "License"). You may not use 85e71b7053SJung-uk Kimthis file except in compliance with the License. You can obtain a copy 86e71b7053SJung-uk Kimin the file LICENSE in the source distribution or at 87e71b7053SJung-uk KimL<https://www.openssl.org/source/license.html>. 88e71b7053SJung-uk Kim 89e71b7053SJung-uk Kim=cut 90