SSL_poll.3ossl 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471
  1. .\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42)
  2. .\"
  3. .\" Standard preamble:
  4. .\" ========================================================================
  5. .de Sp \" Vertical space (when we can't use .PP)
  6. .if t .sp .5v
  7. .if n .sp
  8. ..
  9. .de Vb \" Begin verbatim text
  10. .ft CW
  11. .nf
  12. .ne \\$1
  13. ..
  14. .de Ve \" End verbatim text
  15. .ft R
  16. .fi
  17. ..
  18. .\" Set up some character translations and predefined strings. \*(-- will
  19. .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
  20. .\" double quote, and \*(R" will give a right double quote. \*(C+ will
  21. .\" give a nicer C++. Capital omega is used to do unbreakable dashes and
  22. .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
  23. .\" nothing in troff, for use with C<>.
  24. .tr \(*W-
  25. .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
  26. .ie n \{\
  27. . ds -- \(*W-
  28. . ds PI pi
  29. . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
  30. . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
  31. . ds L" ""
  32. . ds R" ""
  33. . ds C` ""
  34. . ds C' ""
  35. 'br\}
  36. .el\{\
  37. . ds -- \|\(em\|
  38. . ds PI \(*p
  39. . ds L" ``
  40. . ds R" ''
  41. . ds C`
  42. . ds C'
  43. 'br\}
  44. .\"
  45. .\" Escape single quotes in literal strings from groff's Unicode transform.
  46. .ie \n(.g .ds Aq \(aq
  47. .el .ds Aq '
  48. .\"
  49. .\" If the F register is >0, we'll generate index entries on stderr for
  50. .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
  51. .\" entries marked with X<> in POD. Of course, you'll have to process the
  52. .\" output yourself in some meaningful fashion.
  53. .\"
  54. .\" Avoid warning from groff about undefined register 'F'.
  55. .de IX
  56. ..
  57. .nr rF 0
  58. .if \n(.g .if rF .nr rF 1
  59. .if (\n(rF:(\n(.g==0)) \{\
  60. . if \nF \{\
  61. . de IX
  62. . tm Index:\\$1\t\\n%\t"\\$2"
  63. ..
  64. . if !\nF==2 \{\
  65. . nr % 0
  66. . nr F 2
  67. . \}
  68. . \}
  69. .\}
  70. .rr rF
  71. .\"
  72. .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
  73. .\" Fear. Run. Save yourself. No user-serviceable parts.
  74. . \" fudge factors for nroff and troff
  75. .if n \{\
  76. . ds #H 0
  77. . ds #V .8m
  78. . ds #F .3m
  79. . ds #[ \f1
  80. . ds #] \fP
  81. .\}
  82. .if t \{\
  83. . ds #H ((1u-(\\\\n(.fu%2u))*.13m)
  84. . ds #V .6m
  85. . ds #F 0
  86. . ds #[ \&
  87. . ds #] \&
  88. .\}
  89. . \" simple accents for nroff and troff
  90. .if n \{\
  91. . ds ' \&
  92. . ds ` \&
  93. . ds ^ \&
  94. . ds , \&
  95. . ds ~ ~
  96. . ds /
  97. .\}
  98. .if t \{\
  99. . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
  100. . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
  101. . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
  102. . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
  103. . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
  104. . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
  105. .\}
  106. . \" troff and (daisy-wheel) nroff accents
  107. .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
  108. .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
  109. .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
  110. .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
  111. .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
  112. .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
  113. .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
  114. .ds ae a\h'-(\w'a'u*4/10)'e
  115. .ds Ae A\h'-(\w'A'u*4/10)'E
  116. . \" corrections for vroff
  117. .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
  118. .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
  119. . \" for low resolution devices (crt and lpr)
  120. .if \n(.H>23 .if \n(.V>19 \
  121. \{\
  122. . ds : e
  123. . ds 8 ss
  124. . ds o a
  125. . ds d- d\h'-1'\(ga
  126. . ds D- D\h'-1'\(hy
  127. . ds th \o'bp'
  128. . ds Th \o'LP'
  129. . ds ae ae
  130. . ds Ae AE
  131. .\}
  132. .rm #[ #] #H #V #F C
  133. .\" ========================================================================
  134. .\"
  135. .IX Title "SSL_POLL 3ossl"
  136. .TH SSL_POLL 3ossl "2024-09-03" "3.3.2" "OpenSSL"
  137. .\" For nroff, turn off justification. Always turn off hyphenation; it makes
  138. .\" way too many mistakes in technical documents.
  139. .if n .ad l
  140. .nh
  141. .SH "NAME"
  142. SSL_poll,
  143. SSL_POLL_EVENT_NONE,
  144. SSL_POLL_EVENT_F,
  145. SSL_POLL_EVENT_EC,
  146. SSL_POLL_EVENT_ECD,
  147. SSL_POLL_EVENT_ER,
  148. SSL_POLL_EVENT_EW,
  149. SSL_POLL_EVENT_R,
  150. SSL_POLL_EVENT_W,
  151. SSL_POLL_EVENT_ISB,
  152. SSL_POLL_EVENT_ISU,
  153. SSL_POLL_EVENT_OSB,
  154. SSL_POLL_EVENT_OSU,
  155. SSL_POLL_EVENT_RW,
  156. SSL_POLL_EVENT_RE,
  157. SSL_POLL_EVENT_WE,
  158. SSL_POLL_EVENT_RWE,
  159. SSL_POLL_EVENT_E,
  160. SSL_POLL_EVENT_IS,
  161. SSL_POLL_EVENT_ISE,
  162. SSL_POLL_EVENT_I,
  163. SSL_POLL_EVENT_OS,
  164. SSL_POLL_EVENT_OSE,
  165. SSL_POLL_FLAG_NO_HANDLE_EVENTS
  166. \&\- determine or await readiness conditions for one or more pollable objects
  167. .SH "SYNOPSIS"
  168. .IX Header "SYNOPSIS"
  169. .Vb 1
  170. \& #include <openssl/ssl.h>
  171. \&
  172. \& #define SSL_POLL_EVENT_NONE 0
  173. \&
  174. \& #define SSL_POLL_EVENT_F /* F (Failure) */
  175. \& #define SSL_POLL_EVENT_EC /* EC (Exception on Conn) */
  176. \& #define SSL_POLL_EVENT_ECD /* ECD (Exception on Conn Drained) */
  177. \& #define SSL_POLL_EVENT_ER /* ER (Exception on Read) */
  178. \& #define SSL_POLL_EVENT_EW /* EW (Exception on Write) */
  179. \& #define SSL_POLL_EVENT_R /* R (Readable) */
  180. \& #define SSL_POLL_EVENT_W /* W (Writable) */
  181. \& #define SSL_POLL_EVENT_ISB /* ISB (Incoming Stream: Bidi) */
  182. \& #define SSL_POLL_EVENT_ISU /* ISU (Incoming Stream: Uni) */
  183. \& #define SSL_POLL_EVENT_OSB /* OSB (Outgoing Stream: Bidi) */
  184. \& #define SSL_POLL_EVENT_OSU /* OSU (Outgoing Stream: Uni) */
  185. \&
  186. \& #define SSL_POLL_EVENT_RW /* R | W */
  187. \& #define SSL_POLL_EVENT_RE /* R | ER */
  188. \& #define SSL_POLL_EVENT_WE /* W | EW */
  189. \& #define SSL_POLL_EVENT_RWE /* RE | WE */
  190. \& #define SSL_POLL_EVENT_E /* EC | ER | EW */
  191. \& #define SSL_POLL_EVENT_IS /* ISB | ISU */
  192. \& #define SSL_POLL_EVENT_ISE /* IS | EC */
  193. \& #define SSL_POLL_EVENT_I /* IS */
  194. \& #define SSL_POLL_EVENT_OS /* OSB | OSU */
  195. \& #define SSL_POLL_EVENT_OSE /* OS | EC */
  196. \&
  197. \& typedef struct ssl_poll_item_st {
  198. \& BIO_POLL_DESCRIPTOR desc;
  199. \& uint64_t events, revents;
  200. \& } SSL_POLL_ITEM;
  201. \&
  202. \& #define SSL_POLL_FLAG_NO_HANDLE_EVENTS
  203. \&
  204. \& int SSL_poll(SSL_POLL_ITEM *items,
  205. \& size_t num_items,
  206. \& size_t stride,
  207. \& const struct timeval *timeout,
  208. \& uint64_t flags,
  209. \& size_t *result_count);
  210. .Ve
  211. .SH "DESCRIPTION"
  212. .IX Header "DESCRIPTION"
  213. \&\fBSSL_poll()\fR allows the readiness conditions of the resources represented by one
  214. or more \s-1BIO_POLL_DESCRIPTOR\s0 structures to be determined. In particular, it can
  215. be used to query for readiness conditions on \s-1QUIC\s0 connection \s-1SSL\s0 objects and
  216. \&\s-1QUIC\s0 stream \s-1SSL\s0 objects in a single call.
  217. .PP
  218. A call to \fBSSL_poll()\fR specifies an array of \fB\s-1SSL_POLL_ITEM\s0\fR structures, each of
  219. which designates a resource which is being polled for readiness, and a set of
  220. event flags which indicate the specific readiness events which the caller is
  221. interested in in relation to the specified resource.
  222. .PP
  223. The fields of \fB\s-1SSL_POLL_ITEM\s0\fR are as follows:
  224. .IP "\fIdesc\fR" 4
  225. .IX Item "desc"
  226. The resource being polled for readiness, as represented by a
  227. \&\fB\s-1BIO_POLL_DESCRIPTOR\s0\fR. Currently, this must be a poll descriptor of type
  228. \&\fB\s-1BIO_POLL_DESCRIPTOR_TYPE_SSL\s0\fR, representing a \s-1SSL\s0 object pointer, and the \s-1SSL\s0
  229. object must be a \s-1QUIC\s0 connection \s-1SSL\s0 object or \s-1QUIC\s0 stream \s-1SSL\s0 object.
  230. .Sp
  231. If a \fB\s-1SSL_POLL_ITEM\s0\fR has a poll descriptor type of
  232. \&\fB\s-1BIO_POLL_DESCRIPTOR_TYPE_NONE\s0\fR, or the \s-1SSL\s0 object pointer is \s-1NULL,\s0 the
  233. \&\fB\s-1SSL_POLL_ITEM\s0\fR array entry is ignored and \fIrevents\fR will be set to 0 on
  234. return.
  235. .IP "\fIevents\fR" 4
  236. .IX Item "events"
  237. This is the set of zero or more events which the caller is interested in
  238. learning about in relation to the resource described by \fIdesc\fR. It is a
  239. collection of zero or more \fB\s-1SSL_POLL_EVENT\s0\fR flags. See \*(L"\s-1EVENT TYPES\*(R"\s0 for a
  240. description of each of the event types.
  241. .IP "\fIrevents\fR" 4
  242. .IX Item "revents"
  243. After \fBSSL_poll()\fR returns, this is the set of zero or more events which are
  244. actually applicable to the resource described by \fIdesc\fR. As for \fIevents\fR,
  245. it is a collection of zero or more \fB\s-1SSL_POLL_EVENT\s0\fR flags.
  246. .Sp
  247. \&\fIrevents\fR need not be a subset of the events specified in \fIevents\fR, as some
  248. event types are defined as always being enabled (non-maskable). See \*(L"\s-1EVENT
  249. TYPES\*(R"\s0 for more information.
  250. .PP
  251. To use \fBSSL_poll()\fR, call it with an array of \fB\s-1SSL_POLL_ITEM\s0\fR structures. The
  252. array need remain allocated only for the duration of the call. \fInum_items\fR must
  253. be set to the number of entries in the array, and \fIstride\fR must be set to
  254. \&\f(CW\*(C`sizeof(SSL_POLL_ITEM)\*(C'\fR.
  255. .PP
  256. The present implementation of \fBSSL_poll()\fR is a subset of the functionality which
  257. will eventually be available. Only a nonblocking mode of operation is available
  258. at this time, where \fBSSL_poll()\fR always returns immediately. As such, \fItimeout\fR
  259. must point to a valid \fBstruct timeval\fR and that structure must be set to zero.
  260. In future, other inputs to the \fItimeout\fR argument will result in a blocking
  261. mode of operation, which is not currently supported. For more information, see
  262. \&\*(L"\s-1LIMITATIONS\*(R"\s0.
  263. .PP
  264. The following flags are currently defined for the \fIflags\fR argument:
  265. .IP "\fB\s-1SSL_POLL_FLAG_NO_HANDLE_EVENTS\s0\fR" 4
  266. .IX Item "SSL_POLL_FLAG_NO_HANDLE_EVENTS"
  267. This flag indicates that internal state machine processing should not be
  268. performed in an attempt to generate new readiness events. Only existing
  269. readiness events will be reported.
  270. .PP
  271. The \fIresult_count\fR argument is optional. If it is non-NULL, it is used to
  272. output the number of entries in the array which have nonzero \fIrevents\fR fields
  273. when the call to \fBSSL_poll()\fR returns; see \*(L"\s-1RETURN VALUES\*(R"\s0 for details.
  274. .SH "EVENT TYPES"
  275. .IX Header "EVENT TYPES"
  276. The \fBSSL_poll()\fR interface reports zero or more event types on a given resource,
  277. represented by a bit mask.
  278. .PP
  279. All of the event types are level triggered and represent a readiness or
  280. permanent exception condition; as such, after an event has been reported by
  281. \&\fBSSL_poll()\fR for a resource, it will continue to be reported in future \fBSSL_poll()\fR
  282. calls until the condition ceases to be in effect. A caller must mask the given
  283. event type bit in future \fBSSL_poll()\fR calls if it does not wish to receive
  284. repeated notifications and has not caused the underlying readiness condition
  285. (for example, consuming all available data using \fBSSL_read_ex\fR\|(3) after
  286. \&\fB\s-1SSL_POLL_EVENT_R\s0\fR is reported) to be deasserted.
  287. .PP
  288. Some event types do not make sense on a given kind of resource. In this case,
  289. specifying that event type in \fIevents\fR is a no-op and will be ignored, and the
  290. given event will never be reported in \fIrevents\fR.
  291. .PP
  292. Failure of the polling mechanism itself is considered distinct from an exception
  293. condition on a resource which was successfully polled. See \fB\s-1SSL_POLL_EVENT_F\s0\fR
  294. and \*(L"\s-1RETURN VALUES\*(R"\s0 for details.
  295. .PP
  296. In general, an application should always listen for the event types
  297. corresponding to exception conditions if it is listening to the corresponding
  298. non-exception event types (e.g. \fB\s-1SSL_POLL_EVENT_EC\s0\fR and \fB\s-1SSL_POLL_EVENT_ER\s0\fR
  299. for \fB\s-1SSL_POLL_EVENT_R\s0\fR), as not doing so is unlikely to be a sound design.
  300. .PP
  301. Some event types are non-maskable and may be reported in \fIrevents\fR regardless
  302. of whether they were requested in \fIevents\fR.
  303. .PP
  304. The following event types are supported:
  305. .IP "\fB\s-1SSL_POLL_EVENT_F\s0\fR" 4
  306. .IX Item "SSL_POLL_EVENT_F"
  307. Polling failure. This event is raised when a resource could not be polled. It is
  308. distinct from an exception condition reported on a resource which was
  309. successfully polled and represents a failure of the polling process itself in
  310. relation to a resource. This may mean that \fBSSL_poll()\fR does not support the kind
  311. of resource specified.
  312. .Sp
  313. Where this event is raised on at least one item in \fIitems\fR, \fBSSL_poll()\fR will
  314. return 0 and the \s-1ERR\s0 stack will contain information pertaining to the first item
  315. in \fIitems\fR with \fB\s-1SSL_POLL_EVENT_F\s0\fR set. See \*(L"\s-1RETURN VALUES\*(R"\s0 for more
  316. information.
  317. .Sp
  318. This event type may be raised even if it was not requested in \fIevents\fR;
  319. specifying this event type in \fIevents\fR does nothing.
  320. .IP "\fB\s-1SSL_POLL_EVENT_EC\s0\fR" 4
  321. .IX Item "SSL_POLL_EVENT_EC"
  322. Error at connection level. This event is raised when a connection has failed.
  323. In particular, it is raised when a connection begins terminating.
  324. .Sp
  325. This event is never raised on objects which are not connections.
  326. .IP "\fB\s-1SSL_POLL_EVENT_DCD\s0\fR" 4
  327. .IX Item "SSL_POLL_EVENT_DCD"
  328. Error at connection level (drained). This event is raised when a connection has
  329. finished terminating, and has reached the terminated state. This event will
  330. generally occur after an interval of time passes after the \fB\s-1SSL_POLL_EVENT_EC\s0\fR
  331. event is raised on a connection.
  332. .Sp
  333. This event is never raised on objects which are not connections.
  334. .IP "\fB\s-1SSL_POLL_EVENT_ER\s0\fR" 4
  335. .IX Item "SSL_POLL_EVENT_ER"
  336. Error in read direction. For \s-1QUIC,\s0 this is raised only in the event that a
  337. stream has a read part and that read part has been reset by the peer (for
  338. example, using a \fB\s-1RESET_STREAM\s0\fR frame).
  339. .IP "\fB\s-1SSL_POLL_EVENT_EW\s0\fR" 4
  340. .IX Item "SSL_POLL_EVENT_EW"
  341. Error in write direction. For \s-1QUIC,\s0 this is raised only in the event that a
  342. stream has a write part and that write part has been reset by the peer using a
  343. \&\fB\s-1STOP_SENDING\s0\fR frame.
  344. .IP "\fB\s-1SSL_POLL_EVENT_R\s0\fR" 4
  345. .IX Item "SSL_POLL_EVENT_R"
  346. Readable. This event is raised when a \s-1QUIC\s0 stream \s-1SSL\s0 object (or a \s-1QUIC\s0
  347. connection \s-1SSL\s0 object with a default stream attached) has application data
  348. waiting to be read using \fBSSL_read_ex\fR\|(3), or a \s-1FIN\s0 event as represented by
  349. \&\fB\s-1SSL_ERROR_ZERO_RETURN\s0\fR waiting to be read.
  350. .Sp
  351. It is not raised in the event of the receiving part of the \s-1QUIC\s0 stream being
  352. reset by the peer; see \fB\s-1SSL_POLL_EVENT_ER\s0\fR.
  353. .IP "\fB\s-1SSL_POLL_EVENT_W\s0\fR" 4
  354. .IX Item "SSL_POLL_EVENT_W"
  355. Writable. This event is raised when a \s-1QUIC\s0 stream \s-1SSL\s0 object (or a \s-1QUIC\s0
  356. connection \s-1SSL\s0 object with a default stream attached) could accept more
  357. application data using \fBSSL_write_ex\fR\|(3).
  358. .Sp
  359. This event is never raised by a receive-only stream.
  360. .Sp
  361. This event is never raised by a stream which has had its send part concluded
  362. normally (as with \fBSSL_stream_conclude\fR\|(3)) or locally reset (as with
  363. \&\fBSSL_stream_reset\fR\|(3)).
  364. .Sp
  365. This event does not guarantee that a subsequent call to \fBSSL_write_ex\fR\|(3) will
  366. succeed.
  367. .IP "\fB\s-1SSL_POLL_EVENT_ISB\s0\fR" 4
  368. .IX Item "SSL_POLL_EVENT_ISB"
  369. This event, which is only raised by a \s-1QUIC\s0 connection \s-1SSL\s0 object, is raised when
  370. one or more incoming bidirectional streams are available to be accepted using
  371. \&\fBSSL_accept_stream\fR\|(3).
  372. .IP "\fB\s-1SSL_POLL_EVENT_ISU\s0\fR" 4
  373. .IX Item "SSL_POLL_EVENT_ISU"
  374. This event, which is only raised by a \s-1QUIC\s0 connection \s-1SSL\s0 object, is raised when
  375. one or more incoming unidirectional streams are available to be accepted using
  376. \&\fBSSL_accept_stream\fR\|(3).
  377. .IP "\fB\s-1SSL_POLL_EVENT_OSB\s0\fR" 4
  378. .IX Item "SSL_POLL_EVENT_OSB"
  379. This event, which is only raised by a \s-1QUIC\s0 connection \s-1SSL\s0 object, is raised when
  380. \&\s-1QUIC\s0 stream creation flow control currently permits at least one additional
  381. bidirectional stream to be locally created.
  382. .IP "\fB\s-1SSL_POLL_EVENT_OSU\s0\fR" 4
  383. .IX Item "SSL_POLL_EVENT_OSU"
  384. This event, which is only raised by a \s-1QUIC\s0 connection \s-1SSL\s0 object, is raised when
  385. \&\s-1QUIC\s0 stream creation flow control currently permits at least one additional
  386. unidirectional stream to be locally created.
  387. .SH "LIMITATIONS"
  388. .IX Header "LIMITATIONS"
  389. \&\fBSSL_poll()\fR as presently implemented has the following limitations:
  390. .IP "\(bu" 4
  391. The implementation of \fBSSL_poll()\fR only supports nonblocking operation and
  392. therefore requires the \fItimeout\fR argument be used to specify a zero timeout.
  393. Calls to \fBSSL_poll()\fR which specify another value, or which pass \fItimeout\fR as
  394. \&\s-1NULL,\s0 will fail. This does not allow waiting, but does allow multiple \s-1QUIC SSL\s0
  395. objects to be queried for their readiness state in a single call.
  396. .Sp
  397. Future releases will remove this limitation and support blocking \fBSSL_poll()\fR.
  398. .IP "\(bu" 4
  399. Only \fB\s-1BIO_POLL_DESCRIPTOR\s0\fR structures with type
  400. \&\fB\s-1BIO_POLL_DESCRIPTOR_TYPE_SSL\s0\fR, referencing \s-1QUIC\s0 connection \s-1SSL\s0 objects or \s-1QUIC\s0
  401. stream \s-1SSL\s0 objects, are supported.
  402. .PP
  403. These limitations will be revised in a future release of OpenSSL.
  404. .SH "RETURN VALUES"
  405. .IX Header "RETURN VALUES"
  406. \&\fBSSL_poll()\fR returns 1 on success and 0 on failure.
  407. .PP
  408. Unless the \fIitems\fR pointer itself is invalid, \fBSSL_poll()\fR will always initialise
  409. the \fIrevents\fR fields of all items in the input array upon returning, even if it
  410. returns failure.
  411. .PP
  412. If \fIresult_count\fR is non-NULL, it is always written with the number of items in
  413. the array with nonzero \fIrevents\fR fields, even if the \fBSSL_poll()\fR call returns
  414. failure.
  415. .PP
  416. It is possible for \fIresult_count\fR to be written as 0 even if the \fBSSL_poll()\fR
  417. call returns success, namely if no events were output but the polling process
  418. was successful (e.g. in nonblocking usage) or timed out.
  419. .PP
  420. It is possible for \fIresult_count\fR to be written as a nonzero value if the
  421. \&\fBSSL_poll()\fR call returns failure, for example due to \fB\s-1SSL_POLL_EVENT_F\s0\fR events,
  422. or because some events were detected and output before encountering a failure
  423. condition while processing a subsequent entry in the \fIitems\fR array.
  424. .PP
  425. If at least one \fB\s-1SSL_POLL_EVENT_F\s0\fR event is output, \fBSSL_poll()\fR is guaranteed
  426. to return 0 and guaranteed to place at least one \s-1ERR\s0 on the error stack
  427. describing the first \fB\s-1SSL_POLL_EVENT_F\s0\fR output. Detailed information on any
  428. additional \fB\s-1SSL_POLL_EVENT_F\s0\fR events is not available. \fBSSL_poll()\fR may or may
  429. not return more than one \fB\s-1SSL_POLL_EVENT_F\s0\fR event at once.
  430. .PP
  431. \&\*(L"Normal\*(R" events representing exceptional I/O conditions which do not
  432. constitute a failure of the \fBSSL_poll()\fR mechanism itself are not considered
  433. errors by \fBSSL_poll()\fR and are instead represented using their own event type; see
  434. \&\*(L"\s-1EVENT TYPES\*(R"\s0 for details.
  435. .PP
  436. The caller can establish the meaning of the \fBSSL_poll()\fR return and output values
  437. as follows:
  438. .IP "\(bu" 4
  439. If \fBSSL_poll()\fR returns 1 and \fIresult_count\fR is zero, the operation timed out
  440. before any resource was ready.
  441. .IP "\(bu" 4
  442. If \fBSSL_poll()\fR returns 1 and \fIresult_count\fR is nonzero, that many events were
  443. output.
  444. .IP "\(bu" 4
  445. If \fBSSL_poll()\fR returns 0 and \fIresult_count\fR is zero, the caller has made a basic
  446. usage error; check the \s-1ERR\s0 stack for details.
  447. .IP "\(bu" 4
  448. If \fBSSL_poll()\fR returns 0 and \fIresult_count\fR is nonzero, inspect the \fIitems\fR
  449. array for \fB\s-1SSL_POLL_ITEM\s0\fR structures with the \fB\s-1SSL_POLL_EVENT_F\s0\fR event type
  450. raised in \fIrevents\fR. The entries added to the \s-1ERR\s0 stack (of which there is
  451. guaranteed to be at least one) reflect the cause of the failure of the first
  452. item in \fIitems\fR with \fB\s-1SSL_POLL_EVENT_F\s0\fR raised. Note that there may be events
  453. other than \fI\s-1SSL_POLL_EVENT_F\s0\fR output for items which come before the first
  454. item with \fB\s-1SSL_POLL_EVENT_F\s0\fR raised, and additional \fB\s-1SSL_POLL_EVENT_F\s0\fR
  455. events may or may not have been output, both of which which will be reflected in
  456. \&\fIresult_count\fR.
  457. .SH "SEE ALSO"
  458. .IX Header "SEE ALSO"
  459. \&\fBBIO_get_rpoll_descriptor\fR\|(3), \fBBIO_get_wpoll_descriptor\fR\|(3),
  460. \&\fBSSL_get_rpoll_descriptor\fR\|(3), \fBSSL_get_wpoll_descriptor\fR\|(3)
  461. .SH "HISTORY"
  462. .IX Header "HISTORY"
  463. \&\fBSSL_poll()\fR was added in OpenSSL 3.3.
  464. .SH "COPYRIGHT"
  465. .IX Header "COPYRIGHT"
  466. Copyright 2024 The OpenSSL Project Authors. All Rights Reserved.
  467. .PP
  468. Licensed under the Apache License 2.0 (the \*(L"License\*(R"). You may not use
  469. this file except in compliance with the License. You can obtain a copy
  470. in the file \s-1LICENSE\s0 in the source distribution or at
  471. <https://www.openssl.org/source/license.html>.