1BIO_PUSH(3)                         OpenSSL                        BIO_PUSH(3)
2
3
4

NAME

6       BIO_push, BIO_pop, BIO_set_next - add and remove BIOs from a chain
7

SYNOPSIS

9        #include <openssl/bio.h>
10
11        BIO *BIO_push(BIO *b, BIO *append);
12        BIO *BIO_pop(BIO *b);
13        void BIO_set_next(BIO *b, BIO *next);
14

DESCRIPTION

16       The BIO_push() function appends the BIO append to b, it returns b.
17
18       BIO_pop() removes the BIO b from a chain and returns the next BIO in
19       the chain, or NULL if there is no next BIO. The removed BIO then
20       becomes a single BIO with no association with the original chain, it
21       can thus be freed or attached to a different chain.
22
23       BIO_set_next() replaces the existing next BIO in a chain with the BIO
24       pointed to by next. The new chain may include some of the same BIOs
25       from the old chain or it may be completely different.
26

NOTES

28       The names of these functions are perhaps a little misleading.
29       BIO_push() joins two BIO chains whereas BIO_pop() deletes a single BIO
30       from a chain, the deleted BIO does not need to be at the end of a
31       chain.
32
33       The process of calling BIO_push() and BIO_pop() on a BIO may have
34       additional consequences (a control call is made to the affected BIOs)
35       any effects will be noted in the descriptions of individual BIOs.
36

RETURN VALUES

38       BIO_push() returns the end of the chain, b.
39
40       BIO_pop() returns the next BIO in the chain, or NULL if there is no
41       next BIO.
42

EXAMPLES

44       For these examples suppose md1 and md2 are digest BIOs, b64 is a base64
45       BIO and f is a file BIO.
46
47       If the call:
48
49        BIO_push(b64, f);
50
51       is made then the new chain will be b64-f. After making the calls
52
53        BIO_push(md2, b64);
54        BIO_push(md1, md2);
55
56       the new chain is md1-md2-b64-f. Data written to md1 will be digested by
57       md1 and md2, base64 encoded and written to f.
58
59       It should be noted that reading causes data to pass in the reverse
60       direction, that is data is read from f, base64 decoded and digested by
61       md2 and md1. If the call:
62
63        BIO_pop(md2);
64
65       The call will return b64 and the new chain will be md1-b64-f data can
66       be written to md1 as before.
67

SEE ALSO

69       bio
70

HISTORY

72       The BIO_set_next() function was added in OpenSSL 1.1.0.
73
75       Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.
76
77       Licensed under the OpenSSL license (the "License").  You may not use
78       this file except in compliance with the License.  You can obtain a copy
79       in the file LICENSE in the source distribution or at
80       <https://www.openssl.org/source/license.html>.
81
82
83
841.1.1l                            2021-09-15                       BIO_PUSH(3)
Impressum