2
0

BIO_push.pod 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. =pod
  2. =head1 NAME
  3. BIO_push, BIO_pop, BIO_set_next - add and remove BIOs from a chain
  4. =head1 SYNOPSIS
  5. #include <openssl/bio.h>
  6. BIO *BIO_push(BIO *b, BIO *append);
  7. BIO *BIO_pop(BIO *b);
  8. void BIO_set_next(BIO *b, BIO *next);
  9. =head1 DESCRIPTION
  10. The BIO_push() function appends the BIO B<append> to B<b>, it returns
  11. B<b>.
  12. BIO_pop() removes the BIO B<b> from a chain and returns the next BIO
  13. in the chain, or NULL if there is no next BIO. The removed BIO then
  14. becomes a single BIO with no association with the original chain,
  15. it can thus be freed or attached to a different chain.
  16. BIO_set_next() replaces the existing next BIO in a chain with the BIO pointed to
  17. by B<next>. The new chain may include some of the same BIOs from the old chain
  18. or it may be completely different.
  19. =head1 NOTES
  20. The names of these functions are perhaps a little misleading. BIO_push()
  21. joins two BIO chains whereas BIO_pop() deletes a single BIO from a chain,
  22. the deleted BIO does not need to be at the end of a chain.
  23. The process of calling BIO_push() and BIO_pop() on a BIO may have additional
  24. consequences (a control call is made to the affected BIOs) any effects will
  25. be noted in the descriptions of individual BIOs.
  26. =head1 EXAMPLES
  27. For these examples suppose B<md1> and B<md2> are digest BIOs, B<b64> is
  28. a base64 BIO and B<f> is a file BIO.
  29. If the call:
  30. BIO_push(b64, f);
  31. is made then the new chain will be B<b64-f>. After making the calls
  32. BIO_push(md2, b64);
  33. BIO_push(md1, md2);
  34. the new chain is B<md1-md2-b64-f>. Data written to B<md1> will be digested
  35. by B<md1> and B<md2>, B<base64> encoded and written to B<f>.
  36. It should be noted that reading causes data to pass in the reverse
  37. direction, that is data is read from B<f>, base64 B<decoded> and digested
  38. by B<md1> and B<md2>. If the call:
  39. BIO_pop(md2);
  40. The call will return B<b64> and the new chain will be B<md1-b64-f> data can
  41. be written to B<md1> as before.
  42. =head1 RETURN VALUES
  43. BIO_push() returns the end of the chain, B<b>.
  44. BIO_pop() returns the next BIO in the chain, or NULL if there is no next
  45. BIO.
  46. =head1 SEE ALSO
  47. L<bio>
  48. =head1 HISTORY
  49. The BIO_set_next() function was added in OpenSSL 1.1.0.
  50. =head1 COPYRIGHT
  51. Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
  52. Licensed under the OpenSSL license (the "License"). You may not use
  53. this file except in compliance with the License. You can obtain a copy
  54. in the file LICENSE in the source distribution or at
  55. L<https://www.openssl.org/source/license.html>.
  56. =cut