1 | =pod
|
---|
2 |
|
---|
3 | =head1 NAME
|
---|
4 |
|
---|
5 | SSL_get_stream_read_state, SSL_get_stream_write_state,
|
---|
6 | SSL_get_stream_read_error_code, SSL_get_stream_write_error_code,
|
---|
7 | SSL_STREAM_STATE_NONE, SSL_STREAM_STATE_OK, SSL_STREAM_STATE_WRONG_DIR,
|
---|
8 | SSL_STREAM_STATE_FINISHED, SSL_STREAM_STATE_RESET_LOCAL,
|
---|
9 | SSL_STREAM_STATE_RESET_REMOTE, SSL_STREAM_STATE_CONN_CLOSED - get QUIC stream
|
---|
10 | state
|
---|
11 |
|
---|
12 | =head1 SYNOPSIS
|
---|
13 |
|
---|
14 | #include <openssl/ssl.h>
|
---|
15 |
|
---|
16 | #define SSL_STREAM_STATE_NONE
|
---|
17 | #define SSL_STREAM_STATE_OK
|
---|
18 | #define SSL_STREAM_STATE_WRONG_DIR
|
---|
19 | #define SSL_STREAM_STATE_FINISHED
|
---|
20 | #define SSL_STREAM_STATE_RESET_LOCAL
|
---|
21 | #define SSL_STREAM_STATE_RESET_REMOTE
|
---|
22 | #define SSL_STREAM_STATE_CONN_CLOSED
|
---|
23 |
|
---|
24 | int SSL_get_stream_read_state(SSL *ssl);
|
---|
25 | int SSL_get_stream_write_state(SSL *ssl);
|
---|
26 |
|
---|
27 | int SSL_get_stream_read_error_code(SSL *ssl, uint64_t *app_error_code);
|
---|
28 | int SSL_get_stream_write_error_code(SSL *ssl, uint64_t *app_error_code);
|
---|
29 |
|
---|
30 | =head1 DESCRIPTION
|
---|
31 |
|
---|
32 | SSL_get_stream_read_state() and SSL_get_stream_write_state() retrieve the
|
---|
33 | overall state of the receiving and sending parts of a QUIC stream, respectively.
|
---|
34 |
|
---|
35 | They both return one of the following values:
|
---|
36 |
|
---|
37 | =over 4
|
---|
38 |
|
---|
39 | =item B<SSL_STREAM_STATE_NONE>
|
---|
40 |
|
---|
41 | This value is returned if called on a non-QUIC SSL object, or on a QUIC
|
---|
42 | connection SSL object without a default stream attached.
|
---|
43 |
|
---|
44 | =item B<SSL_STREAM_STATE_OK>
|
---|
45 |
|
---|
46 | This value is returned on a stream which has not been concluded and remains
|
---|
47 | healthy.
|
---|
48 |
|
---|
49 | =item B<SSL_STREAM_STATE_WRONG_DIR>
|
---|
50 |
|
---|
51 | This value is returned if SSL_get_stream_read_state() is called on a
|
---|
52 | locally-initiated (and thus send-only) unidirectional stream, or, conversely, if
|
---|
53 | SSL_get_stream_write_state() is called on a remotely-initiated (and thus
|
---|
54 | receive-only) unidirectional stream.
|
---|
55 |
|
---|
56 | =item B<SSL_STREAM_STATE_FINISHED>
|
---|
57 |
|
---|
58 | For SSL_get_stream_read_state(), this value is returned when the remote peer has
|
---|
59 | signalled the end of the receiving part of the stream. Note that there may still
|
---|
60 | be residual data available to read via L<SSL_read(3)> when this state is
|
---|
61 | returned.
|
---|
62 |
|
---|
63 | For SSL_get_stream_write_state(), this value is returned when the local
|
---|
64 | application has concluded the stream using L<SSL_stream_conclude(3)>. Future
|
---|
65 | L<SSL_write(3)> calls will not succeed.
|
---|
66 |
|
---|
67 | =item B<SSL_STREAM_STATE_RESET_LOCAL>
|
---|
68 |
|
---|
69 | This value is returned when the applicable stream part was reset by the local
|
---|
70 | application.
|
---|
71 |
|
---|
72 | For SSL_get_stream_read_state(), this means that the receiving part of the
|
---|
73 | stream was aborted using a locally transmitted QUIC B<STOP_SENDING> frame. It
|
---|
74 | may or may not still be possible to obtain any residual data which remains to be
|
---|
75 | read by calling L<SSL_read(3)>.
|
---|
76 |
|
---|
77 | For SSL_get_stream_write_state(), this means that the sending part of the stream
|
---|
78 | was aborted, for example because the application called L<SSL_stream_reset(3)>,
|
---|
79 | or because a QUIC stream SSL object with an un-concluded sending part was freed
|
---|
80 | using L<SSL_free(3)>. Calls to L<SSL_write(3)> will fail.
|
---|
81 |
|
---|
82 | When this value is returned, the application error code which was signalled can
|
---|
83 | be obtained by calling SSL_get_stream_read_error_code() or
|
---|
84 | SSL_get_stream_write_error_code() as appropriate.
|
---|
85 |
|
---|
86 | =item B<SSL_STREAM_STATE_RESET_REMOTE>
|
---|
87 |
|
---|
88 | This value is returned when the applicable stream part was reset by the remote
|
---|
89 | peer.
|
---|
90 |
|
---|
91 | For SSL_get_stream_read_state(), this means that the peer sent a QUIC
|
---|
92 | B<RESET_STREAM> frame for the receiving part of the stream; the receiving part
|
---|
93 | of the stream was logically aborted by the peer.
|
---|
94 |
|
---|
95 | For SSL_get_stream_write_state(), this means that the peer sent a QUIC
|
---|
96 | B<STOP_SENDING> frame for the sending part of the stream; the peer has indicated
|
---|
97 | that it does not wish to receive further data on the sending part of the stream.
|
---|
98 | Calls to L<SSL_write(3)> will fail.
|
---|
99 |
|
---|
100 | When this value is returned, the application error code which was signalled can
|
---|
101 | be obtained by calling SSL_get_stream_read_error_code() or
|
---|
102 | SSL_get_stream_write_error_code() as appropriate.
|
---|
103 |
|
---|
104 | =item B<SSL_STREAM_STATE_CONN_CLOSED>
|
---|
105 |
|
---|
106 | The QUIC connection to which the stream belongs was closed. You can obtain
|
---|
107 | information about the circumstances of this closure using
|
---|
108 | L<SSL_get_conn_close_info(3)>. There may still be residual data available to
|
---|
109 | read via L<SSL_read(3)> when this state is returned. Calls to L<SSL_write(3)>
|
---|
110 | will fail. SSL_get_stream_read_state() will return this state if and only if
|
---|
111 | SSL_get_stream_write_state() will also return this state.
|
---|
112 |
|
---|
113 | =back
|
---|
114 |
|
---|
115 | SSL_get_stream_read_error_code() and SSL_get_stream_write_error_code() provide
|
---|
116 | the application error code which was signalled during non-normal termination of
|
---|
117 | the receiving or sending parts of a stream, respectively. On success, the
|
---|
118 | application error code is written to I<*app_error_code>.
|
---|
119 |
|
---|
120 | =head1 NOTES
|
---|
121 |
|
---|
122 | If a QUIC connection is closed, the stream state for all streams transitions to
|
---|
123 | B<SSL_STREAM_STATE_CONN_CLOSED>, but no application error code can be retrieved
|
---|
124 | using SSL_get_stream_read_error_code() or SSL_get_stream_write_error_code(), as
|
---|
125 | the QUIC connection closure process does not cause an application error code to
|
---|
126 | be associated with each individual stream still existing at the time of
|
---|
127 | connection closure. However, you can obtain the overall error code associated
|
---|
128 | with the connection closure using L<SSL_get_conn_close_info(3)>.
|
---|
129 |
|
---|
130 | =head1 RETURN VALUES
|
---|
131 |
|
---|
132 | SSL_get_stream_read_state() and SSL_get_stream_write_state() return one of the
|
---|
133 | B<SSL_STREAM_STATE> values. If called on a non-QUIC SSL object, or a QUIC
|
---|
134 | connection SSL object without a default stream, B<SSL_STREAM_STATE_NONE> is
|
---|
135 | returned.
|
---|
136 |
|
---|
137 | SSL_get_stream_read_error_code() and SSL_get_stream_write_error_code() return 1
|
---|
138 | on success and 0 if the stream was terminated normally. They return -1 on error,
|
---|
139 | for example if the stream is still healthy, was still healthy at the time of
|
---|
140 | connection closure, if called on a stream for which the respective stream part
|
---|
141 | does not exist (e.g. on a unidirectional stream), or if called on a non-QUIC
|
---|
142 | object or a QUIC connection SSL object without a default stream attached.
|
---|
143 |
|
---|
144 | =head1 SEE ALSO
|
---|
145 |
|
---|
146 | L<SSL_stream_conclude(3)>, L<SSL_stream_reset(3)>, L<SSL_new_stream(3)>,
|
---|
147 | L<SSL_accept_stream(3)>, L<SSL_get_conn_close_info(3)>
|
---|
148 |
|
---|
149 | =head1 HISTORY
|
---|
150 |
|
---|
151 | These functions were added in OpenSSL 3.2.
|
---|
152 |
|
---|
153 | =head1 COPYRIGHT
|
---|
154 |
|
---|
155 | Copyright 2002-2023 The OpenSSL Project Authors. All Rights Reserved.
|
---|
156 |
|
---|
157 | Licensed under the Apache License 2.0 (the "License"). You may not use
|
---|
158 | this file except in compliance with the License. You can obtain a copy
|
---|
159 | in the file LICENSE in the source distribution or at
|
---|
160 | L<https://www.openssl.org/source/license.html>.
|
---|
161 |
|
---|
162 | =cut
|
---|