SSL_GET_STREAM_READ_STATE(3SSL)
π SSL_GET_STREAM_READ_STATE π β no wait bestie, it's SSL_GET_STREAM_READ_STATE(3SSL) and it's the OpenSSL manual page for peeking at your QUIC stream's state π
okay so. real talk. you ever made a QUIC stream and you're just sitting there like... girl. what are you doing. are you okay. did we finish. did someone reset you. did the WHOLE CONNECTION die π
that's this page. it's the vibe check for your stream. let's go π«Ά
β¨ NAME β¨
SSL_get_stream_read_state, SSL_get_stream_write_state, SSL_get_stream_read_error_code, SSL_get_stream_write_error_code, SSL_STREAM_STATE_NONE, SSL_STREAM_STATE_OK, SSL_STREAM_STATE_WRONG_DIR, SSL_STREAM_STATE_FINISHED, SSL_STREAM_STATE_RESET_LOCAL, SSL_STREAM_STATE_RESET_REMOTE, SSL_STREAM_STATE_CONN_CLOSED β get QUIC stream state π
πΈ SYNOPSIS πΈ
#include <openssl/ssl.h>
#define SSL_STREAM_STATE_NONE
#define SSL_STREAM_STATE_OK
#define SSL_STREAM_STATE_WRONG_DIR
#define SSL_STREAM_STATE_FINISHED
#define SSL_STREAM_STATE_RESET_LOCAL
#define SSL_STREAM_STATE_RESET_REMOTE
#define SSL_STREAM_STATE_CONN_CLOSED
int SSL_get_stream_read_state(SSL *ssl);
int SSL_get_stream_write_state(SSL *ssl);
int SSL_get_stream_read_error_code(SSL *ssl, uint64_t *app_error_code);
int SSL_get_stream_write_error_code(SSL *ssl, uint64_t *app_error_code);
π¦ DESCRIPTION π¦
So SSL_get_stream_read_state() and SSL_get_stream_write_state() are your two little gossips β one tells you about the receiving half of a QUIC stream, the other tells you about the sending half. respectively, obviously π
They both hand you back ONE of these values, and every single one is a whole mood:
SSL_STREAM_STATE_NONEβ bestie you called this on something that is NOT a QUIC SSL object, or on a QUIC connection SSL object that has no default stream attached. nothing to report. empty. void. πSSL_STREAM_STATE_OKβ the stream hasn't been concluded and it's still healthy! thriving! hydrated! β¨SSL_STREAM_STATE_WRONG_DIRβ you asked in the wrong direction, oops π. This comes back ifSSL_get_stream_read_state()gets called on a locally-initiated (and therefore send-only) unidirectional stream, or, flip it, ifSSL_get_stream_write_state()gets called on a remotely-initiated (and therefore receive-only) unidirectional stream. it's giving "ma'am this is a Wendy's".SSL_STREAM_STATE_FINISHEDβ we're done here, periodt.- For
SSL_get_stream_read_state(): the remote peer signalled the end of the receiving part of the stream. β οΈ note that there may still be residual data available to read viaSSL_read(3)even when you get this state back β so don't you dare skip the leftovers. - For
SSL_get_stream_write_state(): your local app concluded the stream usingSSL_stream_conclude(3). FutureSSL_write(3)calls will not succeed. it's over babe.
- For
SSL_STREAM_STATE_RESET_LOCALβ the applicable stream part got reset by the local application. you did this. look at you.- For
SSL_get_stream_read_state(): the receiving part of the stream was aborted using a locally transmitted QUICSTOP_SENDINGframe. It may or may not still be possible to grab any residual data that remains to be read by callingSSL_read(3). - For
SSL_get_stream_write_state(): the sending part of the stream was aborted β for example because the application calledSSL_stream_reset(3), or because a QUIC stream SSL object with an un-concluded sending part was freed usingSSL_free(3). Calls toSSL_write(3)will fail. π - When you get this value, the application error code that was signalled can be obtained by calling
SSL_get_stream_read_error_code()orSSL_get_stream_write_error_code()as appropriate. π
- For
SSL_STREAM_STATE_RESET_REMOTEβ the applicable stream part got reset by the remote peer. not you. them. π«΅- For
SSL_get_stream_read_state(): the peer sent a QUICRESET_STREAMframe for the receiving part of the stream; the receiving part of the stream was logically aborted by the peer. - For
SSL_get_stream_write_state(): the peer sent a QUICSTOP_SENDINGframe for the sending part of the stream; the peer has indicated that it does not wish to receive further data on the sending part of the stream. Calls toSSL_write(3)will fail. π - When you get this value, the application error code that was signalled can be obtained by calling
SSL_get_stream_read_error_code()orSSL_get_stream_write_error_code()as appropriate. π
- For
SSL_STREAM_STATE_CONN_CLOSEDβ the QUIC connection that the stream belongs to got closed. πͺ¦ You can get the tea about the circumstances of this closure usingSSL_get_conn_close_info(3). There may still be residual data available to read viaSSL_read(3)when this state is returned. Calls toSSL_write(3)will fail. And here's a fun little fact:SSL_get_stream_read_state()will return this state if and only ifSSL_get_stream_write_state()will also return this state. they're matching. iconic. β¨
SSL_get_stream_read_error_code() and SSL_get_stream_write_error_code() hand you the application error code that was signalled during non-normal termination of the receiving or sending parts of a stream, respectively. On success, that application error code gets written to app_error_code. π
π NOTES π
If a QUIC connection is closed, the stream state for all streams transitions to SSL_STREAM_STATE_CONN_CLOSED, but no application error code can be retrieved using SSL_get_stream_read_error_code() or SSL_get_stream_write_error_code() β because the QUIC connection closure process does not cause an application error code to be associated with each individual stream still existing at the time of connection closure. π
However! You can obtain the overall error code associated with the connection closure using SSL_get_conn_close_info(3). slay.
π₯ RETURN VALUES π₯
SSL_get_stream_read_state() and SSL_get_stream_write_state() return one of the SSL_STREAM_STATE values. If called on a non-QUIC SSL object, or a QUIC connection SSL object without a default stream, SSL_STREAM_STATE_NONE is returned.
SSL_get_stream_read_error_code() and SSL_get_stream_write_error_code() return 1 on success and 0 if the stream was terminated normally. They return -1 on error β for example if the stream is still healthy, was still healthy at the time of connection closure, if called on a stream for which the respective stream part does not exist (e.g. on a unidirectional stream), or if called on a non-QUIC object or a QUIC connection SSL object without a default stream attached. messy. π
π SEE ALSO π
SSL_stream_conclude(3)SSL_stream_reset(3)SSL_new_stream(3)SSL_accept_stream(3)SSL_get_conn_close_info(3)
β HISTORY β
These functions were added in OpenSSL 3.2. newcomers but they ATE. π
π 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 4.0.3, dated 2026-09-29, and you can find it filed under SSL_GET_STREAM_READ_STATE(3SSL) π go check your stream states, drink some water, and remember: residual data might still be waiting for you even after FINISHED. no cap. π§β¨
π¦ where this page comes from
- ubuntu stonking: libssl-doc 4.0.3-1ubuntu1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms