.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45) .\" .\" 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 .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . 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 .\" ======================================================================== .\" .IX Title "BIO_GET_RPOLL_DESCRIPTOR 3ssl" .TH BIO_GET_RPOLL_DESCRIPTOR 3ssl 2024-10-23 3.4.0 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 BIO_get_rpoll_descriptor, BIO_get_wpoll_descriptor \- obtain a structure which can be used to determine when a BIO object can next be read or written .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& #include \& \& typedef struct bio_poll_descriptor_st { \& uint32_t type; \& union { \& int fd; \& void *custom; \& uintptr_t custom_ui; \& } value; \& } BIO_POLL_DESCRIPTOR; \& \& int BIO_get_rpoll_descriptor(BIO *b, BIO_POLL_DESCRIPTOR *desc); \& int BIO_get_wpoll_descriptor(BIO *b, BIO_POLL_DESCRIPTOR *desc); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" \&\fBBIO_get_rpoll_descriptor()\fR and \fBBIO_get_wpoll_descriptor()\fR, on success, fill \&\fI*desc\fR with a poll descriptor. A poll descriptor is a tagged union structure which represents some kind of OS or non-OS resource which can be used to synchronise on I/O availability events. .PP \&\fBBIO_get_rpoll_descriptor()\fR outputs a descriptor which can be used to determine when the BIO can (potentially) next be read, and \fBBIO_get_wpoll_descriptor()\fR outputs a descriptor which can be used to determine when the BIO can (potentially) next be written. .PP It is permissible for \fBBIO_get_rpoll_descriptor()\fR and \fBBIO_get_wpoll_descriptor()\fR to output the same descriptor. .PP Poll descriptors can represent different kinds of information. A typical kind of resource which might be represented by a poll descriptor is an OS file descriptor which can be used with APIs such as \fBselect()\fR. .PP The kinds of poll descriptor defined by OpenSSL are: .IP BIO_POLL_DESCRIPTOR_TYPE_NONE 4 .IX Item "BIO_POLL_DESCRIPTOR_TYPE_NONE" Represents the absence of a valid poll descriptor. It may be used by \&\fBBIO_get_rpoll_descriptor()\fR or \fBBIO_get_wpoll_descriptor()\fR to indicate that the BIO is not pollable for readability or writeability respectively. .Sp For this type, no field within the \fIvalue\fR field of the \fBBIO_POLL_DESCRIPTOR\fR is valid. .IP BIO_POLL_DESCRIPTOR_TYPE_SOCK_FD 4 .IX Item "BIO_POLL_DESCRIPTOR_TYPE_SOCK_FD" The poll descriptor represents an OS socket resource. The field \fIvalue.fd\fR in the \fBBIO_POLL_DESCRIPTOR\fR is valid if it is not set to \-1. .Sp The resource is whatever kind of handle is used by a given OS to represent sockets, which may vary by OS. For example, on Windows, the value is a \fBSOCKET\fR for use with the Winsock API. On POSIX-like platforms, it is a file descriptor. .Sp Where a poll descriptor of this type is output by \fBBIO_get_rpoll_descriptor()\fR, it should be polled for readability to determine when the BIO might next be able to successfully complete a \fBBIO_read()\fR operation; likewise, where a poll descriptor of this type is output by \fBBIO_get_wpoll_descriptor()\fR, it should be polled for writeability to determine when the BIO might next be able to successfully complete a \fBBIO_write()\fR operation. .IP BIO_POLL_DESCRIPTOR_CUSTOM_START 4 .IX Item "BIO_POLL_DESCRIPTOR_CUSTOM_START" Type values beginning with this value (inclusive) are reserved for application allocation for custom poll descriptor types. Any of the definitions in the union field \fIvalue\fR can be used by the application arbitrarily as opaque values. .PP Because poll descriptors are a tagged union structure, they can represent different kinds of information. New types of poll descriptor may be defined, including by applications, according to their needs. .SH "RETURN VALUES" .IX Header "RETURN VALUES" The functions \fBBIO_get_rpoll_descriptor()\fR and \fBBIO_get_wpoll_descriptor()\fR return 1 on success and 0 on failure. .PP These functions are permitted to succeed and initialise \fI*desc\fR with a poll descriptor of type \fBBIO_POLL_DESCRIPTOR_TYPE_NONE\fR to indicate that the BIO is not pollable for readability or writeability respectively. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBSSL_handle_events\fR\|(3), \fBSSL_get_event_timeout\fR\|(3), \fBSSL_get_rpoll_descriptor\fR\|(3), \&\fBSSL_get_wpoll_descriptor\fR\|(3), \fBbio\fR\|(7) .SH HISTORY .IX Header "HISTORY" The \fBSSL_get_rpoll_descriptor()\fR and \fBSSL_get_wpoll_descriptor()\fR functions were added in OpenSSL 3.2. .SH COPYRIGHT .IX Header "COPYRIGHT" Copyright 2022\-2023 The OpenSSL Project Authors. All Rights Reserved. .PP 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 .