summaryrefslogtreecommitdiffstats
path: root/upstream/debian-unstable/man3/BIO_get_rpoll_descriptor.3ssl
blob: 8722381f2a25594249a6d9a1dbd8b2a187a55658 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
.\" -*- mode: troff; coding: utf-8 -*-
.\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43)
.\"
.\" 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-04-04 3.2.2-dev 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 <openssl/bio.h>
\&
\& 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
<https://www.openssl.org/source/license.html>.