1 | =pod
|
---|
2 |
|
---|
3 | =head1 NAME
|
---|
4 |
|
---|
5 | BIO_push, BIO_pop, BIO_set_next - add and remove BIOs from a chain
|
---|
6 |
|
---|
7 | =head1 SYNOPSIS
|
---|
8 |
|
---|
9 | #include <openssl/bio.h>
|
---|
10 |
|
---|
11 | BIO *BIO_push(BIO *b, BIO *next);
|
---|
12 | BIO *BIO_pop(BIO *b);
|
---|
13 | void BIO_set_next(BIO *b, BIO *next);
|
---|
14 |
|
---|
15 | =head1 DESCRIPTION
|
---|
16 |
|
---|
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>.
|
---|
22 |
|
---|
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.
|
---|
29 |
|
---|
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.
|
---|
33 |
|
---|
34 | =head1 NOTES
|
---|
35 |
|
---|
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.
|
---|
39 |
|
---|
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.
|
---|
43 |
|
---|
44 | =head1 RETURN VALUES
|
---|
45 |
|
---|
46 | BIO_push() returns the head of the chain,
|
---|
47 | which usually is I<b>, or I<next> if I<b> is NULL.
|
---|
48 |
|
---|
49 | BIO_pop() returns the next BIO in the chain,
|
---|
50 | or NULL if there is no next BIO.
|
---|
51 |
|
---|
52 | =head1 EXAMPLES
|
---|
53 |
|
---|
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.
|
---|
56 |
|
---|
57 | If the call:
|
---|
58 |
|
---|
59 | BIO_push(b64, f);
|
---|
60 |
|
---|
61 | is made then the new chain will be I<b64-f>. After making the calls
|
---|
62 |
|
---|
63 | BIO_push(md2, b64);
|
---|
64 | BIO_push(md1, md2);
|
---|
65 |
|
---|
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>.
|
---|
68 |
|
---|
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>.
|
---|
72 |
|
---|
73 | The call:
|
---|
74 |
|
---|
75 | BIO_pop(md2);
|
---|
76 |
|
---|
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.
|
---|
80 |
|
---|
81 | =head1 SEE ALSO
|
---|
82 |
|
---|
83 | L<bio(7)>
|
---|
84 |
|
---|
85 | =head1 HISTORY
|
---|
86 |
|
---|
87 | The BIO_set_next() function was added in OpenSSL 1.1.0.
|
---|
88 |
|
---|
89 | =head1 COPYRIGHT
|
---|
90 |
|
---|
91 | Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.
|
---|
92 |
|
---|
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>.
|
---|
97 |
|
---|
98 | =cut
|
---|