SSL_set_bio.pod 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. =pod
  2. =head1 NAME
  3. SSL_set_bio, SSL_set0_rbio, SSL_set0_wbio - connect the SSL object with a BIO
  4. =head1 SYNOPSIS
  5. #include <openssl/ssl.h>
  6. void SSL_set_bio(SSL *ssl, BIO *rbio, BIO *wbio);
  7. void SSL_set0_rbio(SSL *s, BIO *rbio);
  8. void SSL_set0_wbio(SSL *s, BIO *wbio);
  9. =head1 DESCRIPTION
  10. SSL_set0_rbio() connects the BIO B<rbio> for the read operations of the B<ssl>
  11. object. The SSL engine inherits the behaviour of B<rbio>. If the BIO is
  12. non-blocking then the B<ssl> object will also have non-blocking behaviour. This
  13. function transfers ownership of B<rbio> to B<ssl>. It will be automatically
  14. freed using L<BIO_free_all(3)> when the B<ssl> is freed. On calling this
  15. function, any existing B<rbio> that was previously set will also be freed via a
  16. call to L<BIO_free_all(3)> (this includes the case where the B<rbio> is set to
  17. the same value as previously).
  18. SSL_set0_wbio() works in the same as SSL_set0_rbio() except that it connects
  19. the BIO B<wbio> for the write operations of the B<ssl> object. Note that if the
  20. rbio and wbio are the same then SSL_set0_rbio() and SSL_set0_wbio() each take
  21. ownership of one reference. Therefore it may be necessary to increment the
  22. number of references available using L<BIO_up_ref(3)> before calling the set0
  23. functions.
  24. SSL_set_bio() is similar to SSL_set0_rbio() and SSL_set0_wbio() except
  25. that it connects both the B<rbio> and the B<wbio> at the same time, and
  26. transfers the ownership of B<rbio> and B<wbio> to B<ssl> according to
  27. the following set of rules:
  28. =over 2
  29. =item *
  30. If neither the B<rbio> or B<wbio> have changed from their previous values
  31. then nothing is done.
  32. =item *
  33. If the B<rbio> and B<wbio> parameters are different and both are different
  34. to their
  35. previously set values then one reference is consumed for the rbio and one
  36. reference is consumed for the wbio.
  37. =item *
  38. If the B<rbio> and B<wbio> parameters are the same and the B<rbio> is not
  39. the same as the previously set value then one reference is consumed.
  40. =item *
  41. If the B<rbio> and B<wbio> parameters are the same and the B<rbio> is the
  42. same as the previously set value, then no additional references are consumed.
  43. =item *
  44. If the B<rbio> and B<wbio> parameters are different and the B<rbio> is the
  45. same as the
  46. previously set value then one reference is consumed for the B<wbio> and no
  47. references are consumed for the B<rbio>.
  48. =item *
  49. If the B<rbio> and B<wbio> parameters are different and the B<wbio> is the
  50. same as the previously set value and the old B<rbio> and B<wbio> values
  51. were the same as each other then one reference is consumed for the B<rbio>
  52. and no references are consumed for the B<wbio>.
  53. =item *
  54. If the B<rbio> and B<wbio> parameters are different and the B<wbio>
  55. is the same as the
  56. previously set value and the old B<rbio> and B<wbio> values were different
  57. to each
  58. other then one reference is consumed for the B<rbio> and one reference
  59. is consumed
  60. for the B<wbio>.
  61. =back
  62. Because of this complexity, this function should be avoided;
  63. use SSL_set0_rbio() and SSL_set0_wbio() instead.
  64. =head1 RETURN VALUES
  65. SSL_set_bio(), SSL_set_rbio() and SSL_set_wbio() cannot fail.
  66. =head1 SEE ALSO
  67. L<SSL_get_rbio(3)>,
  68. L<SSL_connect(3)>, L<SSL_accept(3)>,
  69. L<SSL_shutdown(3)>, L<ssl(7)>, L<bio(7)>
  70. =head1 HISTORY
  71. SSL_set0_rbio() and SSL_set0_wbio() were added in OpenSSL 1.1.0.
  72. =head1 COPYRIGHT
  73. Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.
  74. Licensed under the OpenSSL license (the "License"). You may not use
  75. this file except in compliance with the License. You can obtain a copy
  76. in the file LICENSE in the source distribution or at
  77. L<https://www.openssl.org/source/license.html>.
  78. =cut