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, or UINT64_MAX if 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 below 2**62. πŸ“
  • SSL_get_stream_type() returns one of the SSL_STREAM_TYPE values.
  • SSL_is_stream_local() returns 1 if it's called on a QUIC stream SSL object which represents a stream which was locally initiated. it returns 0 if it's called on a QUIC stream SSL object which represents a stream which was remotely initiated by a peer, and -1 if 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 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