xref: /openssl/doc/man3/SSL_get_stream_id.pod (revision 016a80dc)
1=pod
2
3=head1 NAME
4
5SSL_get_stream_id, SSL_get_stream_type, SSL_STREAM_TYPE_NONE,
6SSL_STREAM_TYPE_READ, SSL_STREAM_TYPE_WRITE, SSL_STREAM_TYPE_BIDI,
7SSL_is_stream_local - get QUIC stream ID and stream type information
8
9=head1 SYNOPSIS
10
11 #include <openssl/ssl.h>
12
13 uint64_t SSL_get_stream_id(SSL *ssl);
14
15 #define SSL_STREAM_TYPE_NONE
16 #define SSL_STREAM_TYPE_BIDI
17 #define SSL_STREAM_TYPE_READ
18 #define SSL_STREAM_TYPE_WRITE
19 int SSL_get_stream_type(SSL *ssl);
20
21 int SSL_is_stream_local(SSL *ssl);
22
23=head1 DESCRIPTION
24
25The SSL_get_stream_id() function returns the QUIC stream ID for a QUIC stream
26SSL object, or for a QUIC connection SSL object which has a default stream
27attached.
28
29The SSL_get_stream_type() function identifies what operations can be performed
30on the stream, and returns one of the following values:
31
32=over 4
33
34=item B<SSL_STREAM_TYPE_NONE>
35
36The SSL object is a QUIC connection SSL object without a default stream
37attached.
38
39=item B<SSL_STREAM_TYPE_BIDI>
40
41The SSL object is a non-QUIC SSL object, or is a QUIC stream object (or QUIC
42connection SSL object with a default stream attached), and that stream is a
43bidirectional QUIC stream.
44
45=item B<SSL_STREAM_TYPE_READ>
46
47The SSL object is a QUIC stream object (or QUIC connection SSL object with a
48default stream attached), and that stream is a unidirectional QUIC stream which
49was initiated by the remote peer; thus, it can be read from, but not written to.
50
51=item B<SSL_STREAM_TYPE_WRITE>
52
53The SSL object is a QUIC stream object (or QUIC connection SSL object with a
54default stream attached), and that stream is a unidirectional QUIC stream which
55was initiated by the local application; thus, it can be written to, but not read
56from.
57
58=back
59
60The SSL_is_stream_local() function determines whether a stream was locally
61created.
62
63=head1 NOTES
64
65While QUICv1 assigns specific meaning to the low two bits of a QUIC stream ID,
66QUIC stream IDs in future versions of QUIC are not required to have the same
67semantics. Do not determine stream properties using these bits. Instead, use
68SSL_get_stream_type() to determine the stream type and SSL_get_stream_is_local()
69to determine the stream initiator.
70
71The SSL_get_stream_type() identifies the type of a QUIC stream based on its
72identity, and does not indicate whether an operation can currently be
73successfully performed on a stream. For example, you might locally initiate a
74unidirectional stream, write to it, and then conclude the stream using
75L<SSL_stream_conclude(3)>, meaning that it can no longer be written to, but
76SSL_get_stream_type() would still return B<SSL_STREAM_TYPE_WRITE>. The value
77returned by SSL_get_stream_type() does not vary over the lifespan of a stream.
78
79=head1 RETURN VALUES
80
81SSL_get_stream_id() returns a QUIC stream ID, or B<UINT64_MAX> if called on an
82SSL object which is not a QUIC SSL object, or if called on a QUIC connection SSL
83object without a default stream attached. Note that valid QUIC stream IDs are
84always below 2**62.
85
86SSL_get_stream_type() returns one of the B<SSL_STREAM_TYPE> values.
87
88SSL_is_stream_local() returns 1 if called on a QUIC stream SSL object which
89represents a stream which was locally initiated. It returns 0 if called on a
90QUIC stream SSL object which represents a stream which was remotely initiated by
91a peer, and -1 if called on any other kind of SSL object.
92
93=head1 SEE ALSO
94
95L<SSL_new_stream(3)>, L<SSL_accept_stream(3)>
96
97=head1 HISTORY
98
99These functions were added in OpenSSL 3.2.
100
101=head1 COPYRIGHT
102
103Copyright 2002-2023 The OpenSSL Project Authors. All Rights Reserved.
104
105Licensed under the Apache License 2.0 (the "License").  You may not use
106this file except in compliance with the License.  You can obtain a copy
107in the file LICENSE in the source distribution or at
108L<https://www.openssl.org/source/license.html>.
109
110=cut
111