1BIO_PUSH(3) OpenSSL BIO_PUSH(3)
2
3
4
6 BIO_push, BIO_pop, BIO_set_next - add and remove BIOs from a chain
7
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
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
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
38 For these examples suppose md1 and md2 are digest BIOs, b64 is a base64
39 BIO and f is a file BIO.
40
41 If the call:
42
43 BIO_push(b64, f);
44
45 is made then the new chain will be b64-f. After making the calls
46
47 BIO_push(md2, b64);
48 BIO_push(md1, md2);
49
50 the new chain is md1-md2-b64-f. Data written to md1 will be digested by
51 md1 and md2, base64 encoded and written to f.
52
53 It should be noted that reading causes data to pass in the reverse
54 direction, that is data is read from f, base64 decoded and digested by
55 md1 and md2. If the call:
56
57 BIO_pop(md2);
58
59 The call will return b64 and the new chain will be md1-b64-f data can
60 be written to md1 as before.
61
63 BIO_push() returns the end of the chain, b.
64
65 BIO_pop() returns the next BIO in the chain, or NULL if there is no
66 next BIO.
67
69 bio
70
72 The BIO_set_next() function was added in OpenSSL 1.1.0.
73
75 Copyright 2000-2016 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.1 2018-09-11 BIO_PUSH(3)