.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "SSL_POLL 3ossl" .TH SSL_POLL 3ossl "2024-09-03" "3.3.2" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" SSL_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 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& #include \& \& #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); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\fBSSL_poll()\fR allows the readiness conditions of the resources represented by one or more \s-1BIO_POLL_DESCRIPTOR\s0 structures to be determined. In particular, it can be used to query for readiness conditions on \s-1QUIC\s0 connection \s-1SSL\s0 objects and \&\s-1QUIC\s0 stream \s-1SSL\s0 objects in a single call. .PP A call to \fBSSL_poll()\fR specifies an array of \fB\s-1SSL_POLL_ITEM\s0\fR 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. .PP The fields of \fB\s-1SSL_POLL_ITEM\s0\fR are as follows: .IP "\fIdesc\fR" 4 .IX Item "desc" The resource being polled for readiness, as represented by a \&\fB\s-1BIO_POLL_DESCRIPTOR\s0\fR. Currently, this must be a poll descriptor of type \&\fB\s-1BIO_POLL_DESCRIPTOR_TYPE_SSL\s0\fR, representing a \s-1SSL\s0 object pointer, and the \s-1SSL\s0 object must be a \s-1QUIC\s0 connection \s-1SSL\s0 object or \s-1QUIC\s0 stream \s-1SSL\s0 object. .Sp If a \fB\s-1SSL_POLL_ITEM\s0\fR has a poll descriptor type of \&\fB\s-1BIO_POLL_DESCRIPTOR_TYPE_NONE\s0\fR, or the \s-1SSL\s0 object pointer is \s-1NULL,\s0 the \&\fB\s-1SSL_POLL_ITEM\s0\fR array entry is ignored and \fIrevents\fR will be set to 0 on return. .IP "\fIevents\fR" 4 .IX Item "events" This is the set of zero or more events which the caller is interested in learning about in relation to the resource described by \fIdesc\fR. It is a collection of zero or more \fB\s-1SSL_POLL_EVENT\s0\fR flags. See \*(L"\s-1EVENT TYPES\*(R"\s0 for a description of each of the event types. .IP "\fIrevents\fR" 4 .IX Item "revents" After \fBSSL_poll()\fR returns, this is the set of zero or more events which are actually applicable to the resource described by \fIdesc\fR. As for \fIevents\fR, it is a collection of zero or more \fB\s-1SSL_POLL_EVENT\s0\fR flags. .Sp \&\fIrevents\fR need not be a subset of the events specified in \fIevents\fR, as some event types are defined as always being enabled (non-maskable). See \*(L"\s-1EVENT TYPES\*(R"\s0 for more information. .PP To use \fBSSL_poll()\fR, call it with an array of \fB\s-1SSL_POLL_ITEM\s0\fR structures. The array need remain allocated only for the duration of the call. \fInum_items\fR must be set to the number of entries in the array, and \fIstride\fR must be set to \&\f(CW\*(C`sizeof(SSL_POLL_ITEM)\*(C'\fR. .PP The present implementation of \fBSSL_poll()\fR is a subset of the functionality which will eventually be available. Only a nonblocking mode of operation is available at this time, where \fBSSL_poll()\fR always returns immediately. As such, \fItimeout\fR must point to a valid \fBstruct timeval\fR and that structure must be set to zero. In future, other inputs to the \fItimeout\fR argument will result in a blocking mode of operation, which is not currently supported. For more information, see \&\*(L"\s-1LIMITATIONS\*(R"\s0. .PP The following flags are currently defined for the \fIflags\fR argument: .IP "\fB\s-1SSL_POLL_FLAG_NO_HANDLE_EVENTS\s0\fR" 4 .IX Item "SSL_POLL_FLAG_NO_HANDLE_EVENTS" This flag indicates that internal state machine processing should not be performed in an attempt to generate new readiness events. Only existing readiness events will be reported. .PP The \fIresult_count\fR argument is optional. If it is non-NULL, it is used to output the number of entries in the array which have nonzero \fIrevents\fR fields when the call to \fBSSL_poll()\fR returns; see \*(L"\s-1RETURN VALUES\*(R"\s0 for details. .SH "EVENT TYPES" .IX Header "EVENT TYPES" The \fBSSL_poll()\fR interface reports zero or more event types on a given resource, represented by a bit mask. .PP 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 \&\fBSSL_poll()\fR for a resource, it will continue to be reported in future \fBSSL_poll()\fR calls until the condition ceases to be in effect. A caller must mask the given event type bit in future \fBSSL_poll()\fR 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 \fBSSL_read_ex\fR\|(3) after \&\fB\s-1SSL_POLL_EVENT_R\s0\fR is reported) to be deasserted. .PP Some event types do not make sense on a given kind of resource. In this case, specifying that event type in \fIevents\fR is a no-op and will be ignored, and the given event will never be reported in \fIrevents\fR. .PP Failure of the polling mechanism itself is considered distinct from an exception condition on a resource which was successfully polled. See \fB\s-1SSL_POLL_EVENT_F\s0\fR and \*(L"\s-1RETURN VALUES\*(R"\s0 for details. .PP 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. \fB\s-1SSL_POLL_EVENT_EC\s0\fR and \fB\s-1SSL_POLL_EVENT_ER\s0\fR for \fB\s-1SSL_POLL_EVENT_R\s0\fR), as not doing so is unlikely to be a sound design. .PP Some event types are non-maskable and may be reported in \fIrevents\fR regardless of whether they were requested in \fIevents\fR. .PP The following event types are supported: .IP "\fB\s-1SSL_POLL_EVENT_F\s0\fR" 4 .IX Item "SSL_POLL_EVENT_F" Polling failure. This event is raised when a resource could not be polled. It is distinct from an exception condition reported on a resource which was successfully polled and represents a failure of the polling process itself in relation to a resource. This may mean that \fBSSL_poll()\fR does not support the kind of resource specified. .Sp Where this event is raised on at least one item in \fIitems\fR, \fBSSL_poll()\fR will return 0 and the \s-1ERR\s0 stack will contain information pertaining to the first item in \fIitems\fR with \fB\s-1SSL_POLL_EVENT_F\s0\fR set. See \*(L"\s-1RETURN VALUES\*(R"\s0 for more information. .Sp This event type may be raised even if it was not requested in \fIevents\fR; specifying this event type in \fIevents\fR does nothing. .IP "\fB\s-1SSL_POLL_EVENT_EC\s0\fR" 4 .IX Item "SSL_POLL_EVENT_EC" Error at connection level. This event is raised when a connection has failed. In particular, it is raised when a connection begins terminating. .Sp This event is never raised on objects which are not connections. .IP "\fB\s-1SSL_POLL_EVENT_DCD\s0\fR" 4 .IX Item "SSL_POLL_EVENT_DCD" Error at connection level (drained). This event is raised when a connection has finished terminating, and has reached the terminated state. This event will generally occur after an interval of time passes after the \fB\s-1SSL_POLL_EVENT_EC\s0\fR event is raised on a connection. .Sp This event is never raised on objects which are not connections. .IP "\fB\s-1SSL_POLL_EVENT_ER\s0\fR" 4 .IX Item "SSL_POLL_EVENT_ER" Error in read direction. For \s-1QUIC,\s0 this is raised only in the event that a stream has a read part and that read part has been reset by the peer (for example, using a \fB\s-1RESET_STREAM\s0\fR frame). .IP "\fB\s-1SSL_POLL_EVENT_EW\s0\fR" 4 .IX Item "SSL_POLL_EVENT_EW" Error in write direction. For \s-1QUIC,\s0 this is raised only in the event that a stream has a write part and that write part has been reset by the peer using a \&\fB\s-1STOP_SENDING\s0\fR frame. .IP "\fB\s-1SSL_POLL_EVENT_R\s0\fR" 4 .IX Item "SSL_POLL_EVENT_R" Readable. This event is raised when a \s-1QUIC\s0 stream \s-1SSL\s0 object (or a \s-1QUIC\s0 connection \s-1SSL\s0 object with a default stream attached) has application data waiting to be read using \fBSSL_read_ex\fR\|(3), or a \s-1FIN\s0 event as represented by \&\fB\s-1SSL_ERROR_ZERO_RETURN\s0\fR waiting to be read. .Sp It is not raised in the event of the receiving part of the \s-1QUIC\s0 stream being reset by the peer; see \fB\s-1SSL_POLL_EVENT_ER\s0\fR. .IP "\fB\s-1SSL_POLL_EVENT_W\s0\fR" 4 .IX Item "SSL_POLL_EVENT_W" Writable. This event is raised when a \s-1QUIC\s0 stream \s-1SSL\s0 object (or a \s-1QUIC\s0 connection \s-1SSL\s0 object with a default stream attached) could accept more application data using \fBSSL_write_ex\fR\|(3). .Sp This event is never raised by a receive-only stream. .Sp This event is never raised by a stream which has had its send part concluded normally (as with \fBSSL_stream_conclude\fR\|(3)) or locally reset (as with \&\fBSSL_stream_reset\fR\|(3)). .Sp This event does not guarantee that a subsequent call to \fBSSL_write_ex\fR\|(3) will succeed. .IP "\fB\s-1SSL_POLL_EVENT_ISB\s0\fR" 4 .IX Item "SSL_POLL_EVENT_ISB" This event, which is only raised by a \s-1QUIC\s0 connection \s-1SSL\s0 object, is raised when one or more incoming bidirectional streams are available to be accepted using \&\fBSSL_accept_stream\fR\|(3). .IP "\fB\s-1SSL_POLL_EVENT_ISU\s0\fR" 4 .IX Item "SSL_POLL_EVENT_ISU" This event, which is only raised by a \s-1QUIC\s0 connection \s-1SSL\s0 object, is raised when one or more incoming unidirectional streams are available to be accepted using \&\fBSSL_accept_stream\fR\|(3). .IP "\fB\s-1SSL_POLL_EVENT_OSB\s0\fR" 4 .IX Item "SSL_POLL_EVENT_OSB" This event, which is only raised by a \s-1QUIC\s0 connection \s-1SSL\s0 object, is raised when \&\s-1QUIC\s0 stream creation flow control currently permits at least one additional bidirectional stream to be locally created. .IP "\fB\s-1SSL_POLL_EVENT_OSU\s0\fR" 4 .IX Item "SSL_POLL_EVENT_OSU" This event, which is only raised by a \s-1QUIC\s0 connection \s-1SSL\s0 object, is raised when \&\s-1QUIC\s0 stream creation flow control currently permits at least one additional unidirectional stream to be locally created. .SH "LIMITATIONS" .IX Header "LIMITATIONS" \&\fBSSL_poll()\fR as presently implemented has the following limitations: .IP "\(bu" 4 The implementation of \fBSSL_poll()\fR only supports nonblocking operation and therefore requires the \fItimeout\fR argument be used to specify a zero timeout. Calls to \fBSSL_poll()\fR which specify another value, or which pass \fItimeout\fR as \&\s-1NULL,\s0 will fail. This does not allow waiting, but does allow multiple \s-1QUIC SSL\s0 objects to be queried for their readiness state in a single call. .Sp Future releases will remove this limitation and support blocking \fBSSL_poll()\fR. .IP "\(bu" 4 Only \fB\s-1BIO_POLL_DESCRIPTOR\s0\fR structures with type \&\fB\s-1BIO_POLL_DESCRIPTOR_TYPE_SSL\s0\fR, referencing \s-1QUIC\s0 connection \s-1SSL\s0 objects or \s-1QUIC\s0 stream \s-1SSL\s0 objects, are supported. .PP These limitations will be revised in a future release of OpenSSL. .SH "RETURN VALUES" .IX Header "RETURN VALUES" \&\fBSSL_poll()\fR returns 1 on success and 0 on failure. .PP Unless the \fIitems\fR pointer itself is invalid, \fBSSL_poll()\fR will always initialise the \fIrevents\fR fields of all items in the input array upon returning, even if it returns failure. .PP If \fIresult_count\fR is non-NULL, it is always written with the number of items in the array with nonzero \fIrevents\fR fields, even if the \fBSSL_poll()\fR call returns failure. .PP It is possible for \fIresult_count\fR to be written as 0 even if the \fBSSL_poll()\fR call returns success, namely if no events were output but the polling process was successful (e.g. in nonblocking usage) or timed out. .PP It is possible for \fIresult_count\fR to be written as a nonzero value if the \&\fBSSL_poll()\fR call returns failure, for example due to \fB\s-1SSL_POLL_EVENT_F\s0\fR events, or because some events were detected and output before encountering a failure condition while processing a subsequent entry in the \fIitems\fR array. .PP If at least one \fB\s-1SSL_POLL_EVENT_F\s0\fR event is output, \fBSSL_poll()\fR is guaranteed to return 0 and guaranteed to place at least one \s-1ERR\s0 on the error stack describing the first \fB\s-1SSL_POLL_EVENT_F\s0\fR output. Detailed information on any additional \fB\s-1SSL_POLL_EVENT_F\s0\fR events is not available. \fBSSL_poll()\fR may or may not return more than one \fB\s-1SSL_POLL_EVENT_F\s0\fR event at once. .PP \&\*(L"Normal\*(R" events representing exceptional I/O conditions which do not constitute a failure of the \fBSSL_poll()\fR mechanism itself are not considered errors by \fBSSL_poll()\fR and are instead represented using their own event type; see \&\*(L"\s-1EVENT TYPES\*(R"\s0 for details. .PP The caller can establish the meaning of the \fBSSL_poll()\fR return and output values as follows: .IP "\(bu" 4 If \fBSSL_poll()\fR returns 1 and \fIresult_count\fR is zero, the operation timed out before any resource was ready. .IP "\(bu" 4 If \fBSSL_poll()\fR returns 1 and \fIresult_count\fR is nonzero, that many events were output. .IP "\(bu" 4 If \fBSSL_poll()\fR returns 0 and \fIresult_count\fR is zero, the caller has made a basic usage error; check the \s-1ERR\s0 stack for details. .IP "\(bu" 4 If \fBSSL_poll()\fR returns 0 and \fIresult_count\fR is nonzero, inspect the \fIitems\fR array for \fB\s-1SSL_POLL_ITEM\s0\fR structures with the \fB\s-1SSL_POLL_EVENT_F\s0\fR event type raised in \fIrevents\fR. The entries added to the \s-1ERR\s0 stack (of which there is guaranteed to be at least one) reflect the cause of the failure of the first item in \fIitems\fR with \fB\s-1SSL_POLL_EVENT_F\s0\fR raised. Note that there may be events other than \fI\s-1SSL_POLL_EVENT_F\s0\fR output for items which come before the first item with \fB\s-1SSL_POLL_EVENT_F\s0\fR raised, and additional \fB\s-1SSL_POLL_EVENT_F\s0\fR events may or may not have been output, both of which which will be reflected in \&\fIresult_count\fR. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBBIO_get_rpoll_descriptor\fR\|(3), \fBBIO_get_wpoll_descriptor\fR\|(3), \&\fBSSL_get_rpoll_descriptor\fR\|(3), \fBSSL_get_wpoll_descriptor\fR\|(3) .SH "HISTORY" .IX Header "HISTORY" \&\fBSSL_poll()\fR was added in OpenSSL 3.3. .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright 2024 The OpenSSL Project Authors. All Rights Reserved. .PP Licensed under the Apache License 2.0 (the \*(L"License\*(R"). You may not use this file except in compliance with the License. You can obtain a copy in the file \s-1LICENSE\s0 in the source distribution or at .