![]() |
![]()
| ![]() |
![]()
NAMESSL_poll, SSL_POLL_EVENT_NONE, SSL_POLL_EVENT_F, SSL_POLL_EVENT_EC, SSL_POLL_EVENT_ECD, SSL_POLL_EVENT_ER, SSL_POLL_EVENT_EW, SSL_POLL_EVENT_R, SSL_POLL_EVENT_W, SSL_POLL_EVENT_ISB, SSL_POLL_EVENT_ISU, SSL_POLL_EVENT_OSB, SSL_POLL_EVENT_OSU, SSL_POLL_EVENT_RW, SSL_POLL_EVENT_RE, SSL_POLL_EVENT_WE, SSL_POLL_EVENT_RWE, SSL_POLL_EVENT_E, SSL_POLL_EVENT_IS, SSL_POLL_EVENT_ISE, SSL_POLL_EVENT_I, SSL_POLL_EVENT_OS, SSL_POLL_EVENT_OSE, SSL_POLL_FLAG_NO_HANDLE_EVENTS - determine or await readiness conditions for one or more pollable objects SYNOPSIS#include <openssl/ssl.h> #define SSL_POLL_EVENT_NONE 0 #define SSL_POLL_EVENT_F /* F (Failure) */ #define SSL_POLL_EVENT_EC /* EC (Exception on Conn) */ #define SSL_POLL_EVENT_ECD /* ECD (Exception on Conn Drained) */ #define SSL_POLL_EVENT_ER /* ER (Exception on Read) */ #define SSL_POLL_EVENT_EW /* EW (Exception on Write) */ #define SSL_POLL_EVENT_R /* R (Readable) */ #define SSL_POLL_EVENT_W /* W (Writable) */ #define SSL_POLL_EVENT_ISB /* ISB (Incoming Stream: Bidi) */ #define SSL_POLL_EVENT_ISU /* ISU (Incoming Stream: Uni) */ #define SSL_POLL_EVENT_OSB /* OSB (Outgoing Stream: Bidi) */ #define SSL_POLL_EVENT_OSU /* OSU (Outgoing Stream: Uni) */ #define SSL_POLL_EVENT_RW /* R | W */ #define SSL_POLL_EVENT_RE /* R | ER */ #define SSL_POLL_EVENT_WE /* W | EW */ #define SSL_POLL_EVENT_RWE /* RE | WE */ #define SSL_POLL_EVENT_E /* EC | ER | EW */ #define SSL_POLL_EVENT_IS /* ISB | ISU */ #define SSL_POLL_EVENT_ISE /* IS | EC */ #define SSL_POLL_EVENT_I /* IS */ #define SSL_POLL_EVENT_OS /* OSB | OSU */ #define SSL_POLL_EVENT_OSE /* OS | EC */ typedef struct ssl_poll_item_st { BIO_POLL_DESCRIPTOR desc; uint64_t events, revents; } SSL_POLL_ITEM; #define SSL_POLL_FLAG_NO_HANDLE_EVENTS int SSL_poll(SSL_POLL_ITEM *items, size_t num_items, size_t stride, const struct timeval *timeout, uint64_t flags, size_t *result_count); DESCRIPTIONSSL_poll() allows the readiness conditions of the resources represented by one or more BIO_POLL_DESCRIPTOR structures to be determined. In particular, it can be used to query for readiness conditions on QUIC connection SSL objects and QUIC stream SSL objects in a single call. It can also be used to block until at least one of the given resources is ready. A call to SSL_poll() specifies an array of SSL_POLL_ITEM structures, each of which designates a resource which is being polled for readiness, and a set of event flags which indicate the specific readiness events which the caller is interested in in relation to the specified resource. The fields of SSL_POLL_ITEM are as follows:
To use SSL_poll(), call it with an array of SSL_POLL_ITEM structures. The array need remain allocated only for the duration of the call. num_items must be set to the number of entries in the array, and stride must be set to sizeof(SSL_POLL_ITEM). The timeout argument specifies the timeout to use, and, implicitly, whether to use SSL_poll() in blocking or nonblocking mode:
The present implementation of SSL_poll() is a subset of the functionality which will eventually be available. For more information, see "LIMITATIONS". The following flags are currently defined for the flags argument:
The result_count argument is optional. If it is non-NULL, it is used to output the number of entries in the array which have nonzero revents fields when the call to SSL_poll() returns; see "RETURN VALUES" for details. EVENT TYPESThe SSL_poll() interface reports zero or more event types on a given resource, represented by a bit mask. All of the event types are level triggered and represent a readiness or permanent exception condition; as such, after an event has been reported by SSL_poll() for a resource, it will continue to be reported in future SSL_poll() calls until the condition ceases to be in effect. A caller must mask the given event type bit in future SSL_poll() calls if it does not wish to receive repeated notifications and has not caused the underlying readiness condition (for example, consuming all available data using SSL_read_ex(3) after SSL_POLL_EVENT_R is reported) to be deasserted. Some event types do not make sense on a given kind of resource. In this case, specifying that event type in events is a no-op and will be ignored, and the given event will never be reported in revents. Failure of the polling mechanism itself is considered distinct from an exception condition on a resource which was successfully polled. See SSL_POLL_EVENT_F and "RETURN VALUES" for details. In general, an application should always listen for the event types corresponding to exception conditions if it is listening to the corresponding non-exception event types (e.g. SSL_POLL_EVENT_EC and SSL_POLL_EVENT_ER for SSL_POLL_EVENT_R), as not doing so is unlikely to be a sound design. Some event types are non-maskable and may be reported in revents regardless of whether they were requested in events. The following event types are supported:
LIMITATIONSSSL_poll() as presently implemented has the following limitation:
This limitation may be revised in a future release of OpenSSL. RETURN VALUESSSL_poll() returns 1 on success and 0 on failure. Unless the items pointer itself is invalid, SSL_poll() will always initialise the revents fields of all items in the input array upon returning, even if it returns failure. If result_count is non-NULL, it is always written with the number of items in the array with nonzero revents fields, even if the SSL_poll() call returns failure. It is possible for result_count to be written as 0 even if the SSL_poll() call returns success, namely if no events were output but the polling process was successful (e.g. in nonblocking usage) or timed out. It is possible for result_count to be written as a nonzero value if the SSL_poll() call returns failure, for example due to SSL_POLL_EVENT_F events, or because some events were detected and output before encountering a failure condition while processing a subsequent entry in the items array. If at least one SSL_POLL_EVENT_F event is output, SSL_poll() is guaranteed to return 0 and guaranteed to place at least one ERR on the error stack describing the first SSL_POLL_EVENT_F output. Detailed information on any additional SSL_POLL_EVENT_F events is not available. SSL_poll() may or may not return more than one SSL_POLL_EVENT_F event at once. "Normal" events representing exceptional I/O conditions which do not constitute a failure of the SSL_poll() mechanism itself are not considered errors by SSL_poll() and are instead represented using their own event type; see "EVENT TYPES" for details. The caller can establish the meaning of the SSL_poll() return and output values as follows:
SEE ALSOBIO_get_rpoll_descriptor(3), BIO_get_wpoll_descriptor(3), SSL_get_rpoll_descriptor(3), SSL_get_wpoll_descriptor(3) HISTORYSSL_poll() was added in OpenSSL 3.3. Before 3.5, SSL_poll() did not support blocking operation and would fail if called with a NULL timeout parameter or a timeout parameter pointing to a struct timeval which was not zero. Before 3.5, the SSL_POLL_EVENT_EL and SSL_POLL_EVENT_IC event types were not present. COPYRIGHTCopyright 2024-2025 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
|