SSL_GET_STREAM_ID(3ossl)
π SSL_GET_STREAM_ID π β the 3ossl manual, but make it make sense
okay bestie, gather round, because we're talking about the OpenSSL family of functions that hand you QUIC stream tea: SSL_get_stream_id, SSL_get_stream_type, and SSL_is_stream_local β plus the little squad of constants SSL_STREAM_TYPE_NONE, SSL_STREAM_TYPE_READ, SSL_STREAM_TYPE_WRITE, and SSL_STREAM_TYPE_BIDI. their whole job? getting QUIC stream ID and stream type information. iconic behavior honestly. β¨
πΈ SYNOPSIS πΈ
like, here's the shape of it, no cap:
#include <openssl/ssl.h>
uint64_t SSL_get_stream_id(SSL *ssl);
#define SSL_STREAM_TYPE_NONE
#define SSL_STREAM_TYPE_BIDI
#define SSL_STREAM_TYPE_READ
#define SSL_STREAM_TYPE_WRITE
int SSL_get_stream_type(SSL *ssl);
int SSL_is_stream_local(SSL *ssl);
π¦ DESCRIPTION π¦
so SSL_get_stream_id() is the one that just... gives you the QUIC stream ID. π
it works on a QUIC stream SSL object, OR on a QUIC connection SSL object that has a default stream attached. that's it, that's the whole vibe.
then there's SSL_get_stream_type() β she's the one who tells you what operations you can actually perform on the stream, and she'll hand back one of these values:
SSL_STREAM_TYPE_NONEβ the SSL object is a QUIC connection SSL object with no default stream attached. it's giving "nothing here yet bestie".SSL_STREAM_TYPE_BIDIβ the SSL object is a non-QUIC SSL object, OR it's a QUIC stream object (or a QUIC connection SSL object with a default stream attached) and that stream is a bidirectional QUIC stream. two-way communication, main character energy, we love to see it. π«ΆSSL_STREAM_TYPE_READβ the SSL object is a QUIC stream object (or a QUIC connection SSL object with a default stream attached), and that stream is a unidirectional QUIC stream that the remote peer started. so like... you can read from it, but you cannot write to it. read-only era. πSSL_STREAM_TYPE_WRITEβ the SSL object is a QUIC stream object (or a QUIC connection SSL object with a default stream attached), and that stream is a unidirectional QUIC stream that your local application started. so you can write to it, but you cannot read from it. you're the author of this story, you don't get to peek back. π
and finally SSL_is_stream_local() β she determines whether a stream was locally created. simple as that.
β NOTES β
okay so here's the thing, and listen closely because this is important:
while QUICv1 assigns specific meaning to the low two bits of a QUIC stream ID, QUIC stream IDs in future versions of QUIC are not required to have the same semantics. so like, do NOT determine stream properties using these bits. π instead, use SSL_get_stream_type() to determine the stream type and SSL_get_stream_is_local() to determine the stream initiator. that's the assignment, bestie.
also: SSL_get_stream_type() identifies the type of a QUIC stream based on its identity, and it does not indicate whether an operation can currently be successfully performed on a stream. for example β and this is the example, fr fr β you might locally initiate a unidirectional stream, write to it, and then conclude the stream using SSL_stream_conclude(3), meaning that it can no longer be written to, but SSL_get_stream_type() would still return SSL_STREAM_TYPE_WRITE. she doesn't change her mind. the value returned by SSL_get_stream_type() does not vary over the lifespan of a stream. periodt. β¨
π RETURN VALUES π
SSL_get_stream_id()returns a QUIC stream ID, orUINT64_MAXif it's called on an SSL object which is not a QUIC SSL object, or if it's called on a QUIC connection SSL object without a default stream attached. also heads up: valid QUIC stream IDs are always below2**62. πSSL_get_stream_type()returns one of theSSL_STREAM_TYPEvalues.SSL_is_stream_local()returns1if it's called on a QUIC stream SSL object which represents a stream which was locally initiated. it returns0if it's called on a QUIC stream SSL object which represents a stream which was remotely initiated by a peer, and-1if it's called on any other kind of SSL object.
π SEE ALSO π
go read these next, iykyk:
π HISTORY π
these functions were added in OpenSSL 3.2. baby girl is relatively new, show her some love. πΈ
π COPYRIGHT π
Copyright 2002-2023 The OpenSSL Project Authors. All Rights Reserved.
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>.
and that's the whole page, bestie β this was OpenSSL 3.5.9, dated 2026-09-29, and honestly? she ate. mwah π
π
π¦ where this page comes from
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms