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 *next);
12        BIO *BIO_pop(BIO *b);
13        void BIO_set_next(BIO *b, BIO *next);
14

DESCRIPTION

16       BIO_push() pushes b on next.  If b is NULL the function does nothing
17       and returns next.  Otherwise it prepends b, which may be a single BIO
18       or a chain of BIOs, to next (unless next is NULL).  It then makes a
19       control call on b and returns b.
20
21       BIO_pop() removes the BIO b from any chain is is part of.  If b is NULL
22       the function does nothing and returns NULL.  Otherwise it makes a
23       control call on b and returns the next BIO in the chain, or NULL if
24       there is no next BIO.  The removed BIO becomes a single BIO with no
25       association with the original chain, it can thus be freed or be made
26       part of a different chain.
27
28       BIO_set_next() replaces the existing next BIO in a chain with the BIO
29       pointed to by next. The new chain may include some of the same BIOs
30       from the old chain or it may be completely different.
31

NOTES

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

RETURN VALUES

43       BIO_push() returns the head of the chain, which usually is b, or next
44       if b is NULL.
45
46       BIO_pop() returns the next BIO in the chain, or NULL if there is no
47       next BIO.
48

EXAMPLES

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

SEE ALSO

78       bio
79

HISTORY

81       The BIO_set_next() function was added in OpenSSL 1.1.0.
82
84       Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.
85
86       Licensed under the OpenSSL license (the "License").  You may not use
87       this file except in compliance with the License.  You can obtain a copy
88       in the file LICENSE in the source distribution or at
89       <https://www.openssl.org/source/license.html>.
90
91
92
931.1.1q                            2022-07-21                       BIO_PUSH(3)
Impressum