1SSL_PENDING(3ossl)                  OpenSSL                 SSL_PENDING(3ossl)
2
3
4

NAME

6       SSL_pending, SSL_has_pending - check for readable bytes buffered in an
7       SSL object
8

SYNOPSIS

10        #include <openssl/ssl.h>
11
12        int SSL_pending(const SSL *ssl);
13        int SSL_has_pending(const SSL *s);
14

DESCRIPTION

16       Data is received in whole blocks known as records from the peer. A
17       whole record is processed (e.g. decrypted) in one go and is buffered by
18       OpenSSL until it is read by the application via a call to
19       SSL_read_ex(3) or SSL_read(3).
20
21       SSL_pending() returns the number of bytes which have been processed,
22       buffered and are available inside ssl for immediate read.
23
24       If the SSL object's read_ahead flag is set (see
25       SSL_CTX_set_read_ahead(3)), additional protocol bytes (beyond the
26       current record) may have been read containing more TLS/SSL records.
27       This also applies to DTLS and pipelining (see
28       SSL_CTX_set_split_send_fragment(3)). These additional bytes will be
29       buffered by OpenSSL but will remain unprocessed until they are needed.
30       As these bytes are still in an unprocessed state SSL_pending() will
31       ignore them. Therefore, it is possible for no more bytes to be readable
32       from the underlying BIO (because OpenSSL has already read them) and for
33       SSL_pending() to return 0, even though readable application data bytes
34       are available (because the data is in unprocessed buffered records).
35
36       SSL_has_pending() returns 1 if s has buffered data (whether processed
37       or unprocessed) and 0 otherwise. Note that it is possible for
38       SSL_has_pending() to return 1, and then a subsequent call to
39       SSL_read_ex() or SSL_read() to return no data because the unprocessed
40       buffered data when processed yielded no application data (for example
41       this can happen during renegotiation). It is also possible in this
42       scenario for SSL_has_pending() to continue to return 1 even after an
43       SSL_read_ex() or SSL_read() call because the buffered and unprocessed
44       data is not yet processable (e.g. because OpenSSL has only received a
45       partial record so far).
46

RETURN VALUES

48       SSL_pending() returns the number of buffered and processed application
49       data bytes that are pending and are available for immediate read.
50       SSL_has_pending() returns 1 if there is buffered record data in the SSL
51       object and 0 otherwise.
52

SEE ALSO

54       SSL_read_ex(3), SSL_read(3), SSL_CTX_set_read_ahead(3),
55       SSL_CTX_set_split_send_fragment(3), ssl(7)
56

HISTORY

58       The SSL_has_pending() function was added in OpenSSL 1.1.0.
59
61       Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.
62
63       Licensed under the Apache License 2.0 (the "License").  You may not use
64       this file except in compliance with the License.  You can obtain a copy
65       in the file LICENSE in the source distribution or at
66       <https://www.openssl.org/source/license.html>.
67
68
69
703.1.1                             2023-08-31                SSL_PENDING(3ossl)
Impressum