xref: /freebsd/crypto/openssl/doc/man3/SSL_set_blocking_mode.pod (revision e7be843b4a162e68651d3911f0357ed464915629)
1*e7be843bSPierre Pronchery=pod
2*e7be843bSPierre Pronchery
3*e7be843bSPierre Pronchery=head1 NAME
4*e7be843bSPierre Pronchery
5*e7be843bSPierre ProncherySSL_set_blocking_mode, SSL_get_blocking_mode - configure blocking mode for a
6*e7be843bSPierre ProncheryQUIC SSL object
7*e7be843bSPierre Pronchery
8*e7be843bSPierre Pronchery=head1 SYNOPSIS
9*e7be843bSPierre Pronchery
10*e7be843bSPierre Pronchery #include <openssl/ssl.h>
11*e7be843bSPierre Pronchery
12*e7be843bSPierre Pronchery int SSL_set_blocking_mode(SSL *s, int blocking);
13*e7be843bSPierre Pronchery int SSL_get_blocking_mode(SSL *s);
14*e7be843bSPierre Pronchery
15*e7be843bSPierre Pronchery=head1 DESCRIPTION
16*e7be843bSPierre Pronchery
17*e7be843bSPierre ProncherySSL_set_blocking_mode() can be used to enable or disable blocking mode on a QUIC
18*e7be843bSPierre Proncheryconnection SSL object. By default, blocking is enabled, unless the SSL object is
19*e7be843bSPierre Proncheryconfigured to use an underlying read or write BIO which cannot provide a poll
20*e7be843bSPierre Proncherydescriptor (see L<BIO_get_rpoll_descriptor(3)>), as blocking mode cannot be
21*e7be843bSPierre Proncherysupported in this case.
22*e7be843bSPierre Pronchery
23*e7be843bSPierre ProncheryTo enable blocking mode, call SSL_set_blocking_mode() with I<blocking> set to 1;
24*e7be843bSPierre Proncheryto disable it, call SSL_set_blocking_mode() with I<blocking> set to 0.
25*e7be843bSPierre Pronchery
26*e7be843bSPierre ProncheryTo retrieve the current blocking mode, call SSL_get_blocking_mode().
27*e7be843bSPierre Pronchery
28*e7be843bSPierre ProncheryBlocking mode means that calls such as SSL_read() and SSL_write() will block
29*e7be843bSPierre Proncheryuntil the requested operation can be performed. In nonblocking mode, these
30*e7be843bSPierre Proncherycalls will fail if the requested operation cannot be performed immediately; see
31*e7be843bSPierre ProncheryL<SSL_get_error(3)>.
32*e7be843bSPierre Pronchery
33*e7be843bSPierre ProncheryThese functions are only applicable to QUIC connection SSL objects. Other kinds
34*e7be843bSPierre Proncheryof SSL object, such as those for TLS, automatically function in blocking or
35*e7be843bSPierre Proncherynonblocking mode based on whether the underlying network read and write BIOs
36*e7be843bSPierre Proncheryprovided to the SSL object are themselves configured in nonblocking mode.
37*e7be843bSPierre Pronchery
38*e7be843bSPierre ProncheryWhere a QUIC connection SSL object is used in nonblocking mode, an application
39*e7be843bSPierre Proncheryis responsible for ensuring that the SSL object is ticked regularly; see
40*e7be843bSPierre ProncheryL<SSL_handle_events(3)>.
41*e7be843bSPierre Pronchery
42*e7be843bSPierre ProncheryBlocking mode is disabled automatically if the application provides a QUIC
43*e7be843bSPierre Proncheryconnection SSL object with a network BIO which cannot support blocking mode. To
44*e7be843bSPierre Proncheryre-enable blocking mode in this case, an application must set a network BIO
45*e7be843bSPierre Proncherywhich can support blocking mode and explicitly call SSL_set_blocking_mode().
46*e7be843bSPierre Pronchery
47*e7be843bSPierre Pronchery=head1 RETURN VALUES
48*e7be843bSPierre Pronchery
49*e7be843bSPierre ProncherySSL_set_blocking_mode() returns 1 on success and 0 on failure. The function
50*e7be843bSPierre Proncheryfails if called on an SSL object which does not represent a QUIC connection,
51*e7be843bSPierre Proncheryor if blocking mode cannot be used for the given connection.
52*e7be843bSPierre Pronchery
53*e7be843bSPierre ProncherySSL_get_blocking_mode() returns 1 if blocking is currently enabled. It returns
54*e7be843bSPierre Pronchery-1 if called on an unsupported SSL object.
55*e7be843bSPierre Pronchery
56*e7be843bSPierre Pronchery=head1 SEE ALSO
57*e7be843bSPierre Pronchery
58*e7be843bSPierre ProncheryL<SSL_handle_events(3)>, L<SSL_poll(3)>, L<openssl-quic(7)>,
59*e7be843bSPierre ProncheryL<openssl-quic-concurrency(7)>, L<ssl(7)>
60*e7be843bSPierre Pronchery
61*e7be843bSPierre Pronchery=head1 HISTORY
62*e7be843bSPierre Pronchery
63*e7be843bSPierre ProncheryThe SSL_set_blocking_mode() and SSL_get_blocking_mode() functions were added in
64*e7be843bSPierre ProncheryOpenSSL 3.2.
65*e7be843bSPierre Pronchery
66*e7be843bSPierre Pronchery=head1 COPYRIGHT
67*e7be843bSPierre Pronchery
68*e7be843bSPierre ProncheryCopyright 2022-2025 The OpenSSL Project Authors. All Rights Reserved.
69*e7be843bSPierre Pronchery
70*e7be843bSPierre ProncheryLicensed under the Apache License 2.0 (the "License").  You may not use
71*e7be843bSPierre Proncherythis file except in compliance with the License.  You can obtain a copy
72*e7be843bSPierre Proncheryin the file LICENSE in the source distribution or at
73*e7be843bSPierre ProncheryL<https://www.openssl.org/source/license.html>.
74*e7be843bSPierre Pronchery
75*e7be843bSPierre Pronchery=cut
76