5 BIO_push, BIO_pop, BIO_set_next - add and remove BIOs from a chain
9 #include <openssl/bio.h>
11 BIO *BIO_push(BIO *b, BIO *next);
13 void BIO_set_next(BIO *b, BIO *next);
17 BIO_push() pushes I<b> on I<next>.
18 If I<b> is NULL the function does nothing and returns I<next>.
19 Otherwise it prepends I<b>, which may be a single BIO or a chain of BIOs,
20 to I<next> (unless I<next> is NULL).
21 It then makes a control call on I<b> and returns I<b>.
23 BIO_pop() removes the BIO I<b> from any chain is is part of.
24 If I<b> is NULL the function does nothing and returns NULL.
25 Otherwise it makes a control call on I<b> and
26 returns the next BIO in the chain, or NULL if there is no next BIO.
27 The removed BIO becomes a single BIO with no association with
28 the original chain, it can thus be freed or be made part of a different chain.
30 BIO_set_next() replaces the existing next BIO in a chain with the BIO pointed to
31 by I<next>. The new chain may include some of the same BIOs from the old chain
32 or it may be completely different.
36 The names of these functions are perhaps a little misleading. BIO_push()
37 joins two BIO chains whereas BIO_pop() deletes a single BIO from a chain,
38 the deleted BIO does not need to be at the end of a chain.
40 The process of calling BIO_push() and BIO_pop() on a BIO may have additional
41 consequences (a control call is made to the affected BIOs).
42 Any effects will be noted in the descriptions of individual BIOs.
46 BIO_push() returns the head of the chain,
47 which usually is I<b>, or I<next> if I<b> is NULL.
49 BIO_pop() returns the next BIO in the chain,
50 or NULL if there is no next BIO.
54 For these examples suppose I<md1> and I<md2> are digest BIOs,
55 I<b64> is a base64 BIO and I<f> is a file BIO.
61 is made then the new chain will be I<b64-f>. After making the calls
66 the new chain is I<md1-md2-b64-f>. Data written to I<md1> will be digested
67 by I<md1> and I<md2>, base64 encoded, and finally written to I<f>.
69 It should be noted that reading causes data to pass in the reverse
70 direction, that is data is read from I<f>, base64 decoded,
71 and digested by I<md2> and then I<md1>.
77 will return I<b64> and the new chain will be I<md1-b64-f>.
78 Data can be written to and read from I<md1> as before,
79 except that I<md2> will no more be applied.
87 The BIO_set_next() function was added in OpenSSL 1.1.0.
91 Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.
93 Licensed under the Apache License 2.0 (the "License"). You may not use
94 this file except in compliance with the License. You can obtain a copy
95 in the file LICENSE in the source distribution or at
96 L<https://www.openssl.org/source/license.html>.