2
0

SSL_set_fd.pod 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. =pod
  2. =head1 NAME
  3. SSL_set_fd, SSL_set_rfd, SSL_set_wfd - connect the SSL object with a file descriptor
  4. =head1 SYNOPSIS
  5. #include <openssl/ssl.h>
  6. int SSL_set_fd(SSL *ssl, int fd);
  7. int SSL_set_rfd(SSL *ssl, int fd);
  8. int SSL_set_wfd(SSL *ssl, int fd);
  9. =head1 DESCRIPTION
  10. SSL_set_fd() sets the file descriptor B<fd> as the input/output facility
  11. for the TLS/SSL (encrypted) side of B<ssl>. B<fd> will typically be the
  12. socket file descriptor of a network connection.
  13. When performing the operation, a B<socket BIO> is automatically created to
  14. interface between the B<ssl> and B<fd>. The BIO and hence the SSL engine
  15. inherit the behaviour of B<fd>. If B<fd> is nonblocking, the B<ssl> will
  16. also have nonblocking behaviour.
  17. When used on a QUIC connection SSL object, a B<datagram BIO> is automatically
  18. created instead of a B<socket BIO>. These functions fail if called
  19. on a QUIC stream SSL object.
  20. If there was already a BIO connected to B<ssl>, BIO_free() will be called
  21. (for both the reading and writing side, if different).
  22. SSL_set_rfd() and SSL_set_wfd() perform the respective action, but only
  23. for the read channel or the write channel, which can be set independently.
  24. =head1 RETURN VALUES
  25. The following return values can occur:
  26. =over 4
  27. =item Z<>0
  28. The operation failed. Check the error stack to find out why.
  29. =item Z<>1
  30. The operation succeeded.
  31. =back
  32. =head1 NOTES
  33. On Windows, a socket handle is a 64-bit data type (UINT_PTR), which leads to a
  34. compiler warning (conversion from 'SOCKET' to 'int', possible loss of data) when
  35. passing the socket handle to SSL_set_*fd(). For the time being, this warning can
  36. safely be ignored, because although the Microsoft documentation claims that the
  37. upper limit is INVALID_SOCKET-1 (2^64 - 2), in practice the current socket()
  38. implementation returns an index into the kernel handle table, the size of which
  39. is limited to 2^24.
  40. =head1 SEE ALSO
  41. L<SSL_get_fd(3)>, L<SSL_set_bio(3)>,
  42. L<SSL_connect(3)>, L<SSL_accept(3)>,
  43. L<SSL_shutdown(3)>, L<ssl(7)> , L<bio(7)>
  44. =head1 COPYRIGHT
  45. Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.
  46. Licensed under the Apache License 2.0 (the "License"). You may not use
  47. this file except in compliance with the License. You can obtain a copy
  48. in the file LICENSE in the source distribution or at
  49. L<https://www.openssl.org/source/license.html>.
  50. =cut