Home | History | Annotate | Line # | Download | only in man3
      1      1.1  christos =pod
      2      1.1  christos 
      3      1.1  christos =head1 NAME
      4      1.1  christos 
      5      1.1  christos BIO_push, BIO_pop, BIO_set_next - add and remove BIOs from a chain
      6      1.1  christos 
      7      1.1  christos =head1 SYNOPSIS
      8      1.1  christos 
      9      1.1  christos  #include <openssl/bio.h>
     10      1.1  christos 
     11  1.1.1.3  christos  BIO *BIO_push(BIO *b, BIO *next);
     12      1.1  christos  BIO *BIO_pop(BIO *b);
     13      1.1  christos  void BIO_set_next(BIO *b, BIO *next);
     14      1.1  christos 
     15      1.1  christos =head1 DESCRIPTION
     16      1.1  christos 
     17  1.1.1.3  christos BIO_push() pushes I<b> on I<next>.
     18  1.1.1.3  christos If I<b> is NULL the function does nothing and returns I<next>.
     19  1.1.1.3  christos Otherwise it prepends I<b>, which may be a single BIO or a chain of BIOs,
     20  1.1.1.3  christos to I<next> (unless I<next> is NULL).
     21  1.1.1.3  christos It then makes a control call on I<b> and returns I<b>.
     22  1.1.1.3  christos 
     23  1.1.1.3  christos BIO_pop() removes the BIO I<b> from any chain is is part of.
     24  1.1.1.3  christos If I<b> is NULL the function does nothing and returns NULL.
     25  1.1.1.3  christos Otherwise it makes a control call on I<b> and
     26  1.1.1.3  christos returns the next BIO in the chain, or NULL if there is no next BIO.
     27  1.1.1.3  christos The removed BIO becomes a single BIO with no association with
     28  1.1.1.3  christos the original chain, it can thus be freed or be made part of a different chain.
     29      1.1  christos 
     30      1.1  christos BIO_set_next() replaces the existing next BIO in a chain with the BIO pointed to
     31  1.1.1.3  christos by I<next>. The new chain may include some of the same BIOs from the old chain
     32      1.1  christos or it may be completely different.
     33      1.1  christos 
     34      1.1  christos =head1 NOTES
     35      1.1  christos 
     36      1.1  christos The names of these functions are perhaps a little misleading. BIO_push()
     37      1.1  christos joins two BIO chains whereas BIO_pop() deletes a single BIO from a chain,
     38      1.1  christos the deleted BIO does not need to be at the end of a chain.
     39      1.1  christos 
     40      1.1  christos The process of calling BIO_push() and BIO_pop() on a BIO may have additional
     41  1.1.1.3  christos consequences (a control call is made to the affected BIOs).
     42  1.1.1.3  christos Any effects will be noted in the descriptions of individual BIOs.
     43      1.1  christos 
     44  1.1.1.2  christos =head1 RETURN VALUES
     45  1.1.1.2  christos 
     46  1.1.1.3  christos BIO_push() returns the head of the chain,
     47  1.1.1.3  christos which usually is I<b>, or I<next> if I<b> is NULL.
     48  1.1.1.2  christos 
     49  1.1.1.3  christos BIO_pop() returns the next BIO in the chain,
     50  1.1.1.3  christos or NULL if there is no next BIO.
     51  1.1.1.2  christos 
     52      1.1  christos =head1 EXAMPLES
     53      1.1  christos 
     54  1.1.1.3  christos For these examples suppose I<md1> and I<md2> are digest BIOs,
     55  1.1.1.3  christos I<b64> is a base64 BIO and I<f> is a file BIO.
     56      1.1  christos 
     57      1.1  christos If the call:
     58      1.1  christos 
     59      1.1  christos  BIO_push(b64, f);
     60      1.1  christos 
     61  1.1.1.3  christos is made then the new chain will be I<b64-f>. After making the calls
     62      1.1  christos 
     63      1.1  christos  BIO_push(md2, b64);
     64      1.1  christos  BIO_push(md1, md2);
     65      1.1  christos 
     66  1.1.1.3  christos the new chain is I<md1-md2-b64-f>. Data written to I<md1> will be digested
     67  1.1.1.3  christos by I<md1> and I<md2>, base64 encoded, and finally written to I<f>.
     68      1.1  christos 
     69      1.1  christos It should be noted that reading causes data to pass in the reverse
     70  1.1.1.3  christos direction, that is data is read from I<f>, base64 decoded,
     71  1.1.1.3  christos and digested by I<md2> and then I<md1>.
     72  1.1.1.3  christos 
     73  1.1.1.3  christos The call:
     74      1.1  christos 
     75      1.1  christos  BIO_pop(md2);
     76      1.1  christos 
     77  1.1.1.3  christos will return I<b64> and the new chain will be I<md1-b64-f>.
     78  1.1.1.3  christos Data can be written to and read from I<md1> as before,
     79  1.1.1.3  christos except that I<md2> will no more be applied.
     80      1.1  christos 
     81      1.1  christos =head1 SEE ALSO
     82      1.1  christos 
     83  1.1.1.4  christos L<bio(7)>
     84      1.1  christos 
     85      1.1  christos =head1 HISTORY
     86      1.1  christos 
     87      1.1  christos The BIO_set_next() function was added in OpenSSL 1.1.0.
     88      1.1  christos 
     89      1.1  christos =head1 COPYRIGHT
     90      1.1  christos 
     91  1.1.1.3  christos Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.
     92      1.1  christos 
     93  1.1.1.4  christos Licensed under the Apache License 2.0 (the "License").  You may not use
     94      1.1  christos this file except in compliance with the License.  You can obtain a copy
     95      1.1  christos in the file LICENSE in the source distribution or at
     96      1.1  christos L<https://www.openssl.org/source/license.html>.
     97      1.1  christos 
     98      1.1  christos =cut
     99