2
0

BIO_push.pod 2.5 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 RETURN VALUES
  27. BIO_push() returns the end of the chain, B<b>.
  28. BIO_pop() returns the next BIO in the chain, or NULL if there is no next
  29. BIO.
  30. =head1 EXAMPLES
  31. For these examples suppose B<md1> and B<md2> are digest BIOs, B<b64> is
  32. a base64 BIO and B<f> is a file BIO.
  33. If the call:
  34. BIO_push(b64, f);
  35. is made then the new chain will be B<b64-f>. After making the calls
  36. BIO_push(md2, b64);
  37. BIO_push(md1, md2);
  38. the new chain is B<md1-md2-b64-f>. Data written to B<md1> will be digested
  39. by B<md1> and B<md2>, B<base64> encoded and written to B<f>.
  40. It should be noted that reading causes data to pass in the reverse
  41. direction, that is data is read from B<f>, base64 B<decoded> and digested
  42. by B<md1> and B<md2>. If the call:
  43. BIO_pop(md2);
  44. The call will return B<b64> and the new chain will be B<md1-b64-f> data can
  45. be written to B<md1> as before.
  46. =head1 SEE ALSO
  47. L<bio(7)>
  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 Apache License 2.0 (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