Lines Matching refs:xso
24 static void aon_write_finish(QUIC_XSO *xso);
35 static void qc_set_default_xso(QUIC_CONNECTION *qc, QUIC_XSO *xso, int touch);
36 static void qc_set_default_xso_keep_ref(QUIC_CONNECTION *qc, QUIC_XSO *xso,
39 static int quic_validate_for_write(QUIC_XSO *xso, int *err);
42 static int xso_blocking_mode(const QUIC_XSO *xso);
113 QUIC_XSO *xso; member
123 if (ctx->is_stream && ctx->xso != NULL) in quic_set_last_error()
124 ctx->xso->last_error = last_error; in quic_set_last_error()
203 QUIC_XSO *xso; in expect_quic() local
206 ctx->xso = NULL; in expect_quic()
216 ctx->xso = qc->default_xso; in expect_quic()
222 xso = (QUIC_XSO *)s; in expect_quic()
223 ctx->qc = xso->conn; in expect_quic()
224 ctx->xso = xso; in expect_quic()
256 if (ctx->xso == NULL && remote_init >= 0) { in expect_quic_with_stream_lock()
275 ctx->xso = ctx->qc->default_xso; in expect_quic_with_stream_lock()
278 if (ctx->xso == NULL) { in expect_quic_with_stream_lock()
492 if (( ctx.xso->stream->send_state == QUIC_SSTREAM_STATE_READY in ossl_quic_free()
493 || ctx.xso->stream->send_state == QUIC_SSTREAM_STATE_SEND) in ossl_quic_free()
494 && !ossl_quic_sstream_get_final_size(ctx.xso->stream->sstream, NULL)) in ossl_quic_free()
496 ctx.xso->stream, 0); in ossl_quic_free()
499 if ( ctx.xso->stream->recv_state == QUIC_RSTREAM_STATE_RECV in ossl_quic_free()
500 || ctx.xso->stream->recv_state == QUIC_RSTREAM_STATE_SIZE_KNOWN) in ossl_quic_free()
502 ctx.xso->stream, 0); in ossl_quic_free()
505 ctx.xso->stream->deleted = 1; in ossl_quic_free()
507 ctx.xso->stream); in ossl_quic_free()
509 is_default = (ctx.xso == ctx.qc->default_xso); in ossl_quic_free()
531 QUIC_XSO *xso = ctx.qc->default_xso; in ossl_quic_free() local
534 SSL_free(&xso->ssl); in ossl_quic_free()
649 static void qc_set_default_xso_keep_ref(QUIC_CONNECTION *qc, QUIC_XSO *xso, in qc_set_default_xso_keep_ref() argument
657 if (qc->default_xso != xso) { in qc_set_default_xso_keep_ref()
660 qc->default_xso = xso; in qc_set_default_xso_keep_ref()
662 if (xso == NULL) { in qc_set_default_xso_keep_ref()
695 static void qc_set_default_xso(QUIC_CONNECTION *qc, QUIC_XSO *xso, int touch) in qc_set_default_xso() argument
699 qc_set_default_xso_keep_ref(qc, xso, touch, &old_xso); in qc_set_default_xso()
706 static void xso_update_options(QUIC_XSO *xso) in xso_update_options() argument
708 int cleanse = ((xso->ssl_options & SSL_OP_CLEANSE_PLAINTEXT) != 0); in xso_update_options()
710 if (xso->stream->rstream != NULL) in xso_update_options()
711 ossl_quic_rstream_set_cleanse(xso->stream->rstream, cleanse); in xso_update_options()
713 if (xso->stream->sstream != NULL) in xso_update_options()
714 ossl_quic_sstream_set_cleanse(xso->stream->sstream, cleanse); in xso_update_options()
757 if (ctx.xso != NULL) { in quic_mask_or_options()
758 ctx.xso->ssl_options in quic_mask_or_options()
759 = ((ctx.xso->ssl_options & ~mask_value) | or_value) in quic_mask_or_options()
762 xso_update_options(ctx.xso); in quic_mask_or_options()
765 ret = ctx.is_stream ? ctx.xso->ssl_options : ctx.qc->default_ssl_options; in quic_mask_or_options()
957 return xso_blocking_mode(ctx.xso); in ossl_quic_conn_get_blocking_mode()
996 if (ctx.xso != NULL) { in ossl_quic_conn_set_blocking_mode()
1001 ctx.xso->desires_blocking = (blocking != 0); in ossl_quic_conn_set_blocking_mode()
1002 ctx.xso->desires_blocking_set = 1; in ossl_quic_conn_set_blocking_mode()
1049 static int xso_blocking_mode(const QUIC_XSO *xso) in xso_blocking_mode() argument
1051 if (xso->desires_blocking_set) in xso_blocking_mode()
1052 return xso->desires_blocking && qc_can_support_blocking_cached(xso->conn); in xso_blocking_mode()
1055 return xso->conn->blocking; in xso_blocking_mode()
1364 if (ctx.xso != NULL) { in ossl_quic_ctrl()
1366 if (ctx.xso->aon_write_in_progress) in ossl_quic_ctrl()
1369 ctx.xso->ssl_mode |= (uint32_t)larg; in ossl_quic_ctrl()
1370 return ctx.xso->ssl_mode; in ossl_quic_ctrl()
1378 if (ctx.xso != NULL) { in ossl_quic_ctrl()
1379 ctx.xso->ssl_mode &= ~(uint32_t)larg; in ossl_quic_ctrl()
1380 return ctx.xso->ssl_mode; in ossl_quic_ctrl()
1943 QUIC_XSO *xso = NULL; in create_xso_from_stream() local
1945 if ((xso = OPENSSL_zalloc(sizeof(*xso))) == NULL) { in create_xso_from_stream()
1950 if (!ossl_ssl_init(&xso->ssl, qc->ssl.ctx, qc->ssl.method, SSL_TYPE_QUIC_XSO)) { in create_xso_from_stream()
1961 xso->conn = qc; in create_xso_from_stream()
1962 xso->ssl_mode = qc->default_ssl_mode; in create_xso_from_stream()
1963 xso->ssl_options in create_xso_from_stream()
1965 xso->last_error = SSL_ERROR_NONE; in create_xso_from_stream()
1967 xso->stream = qs; in create_xso_from_stream()
1970 xso_update_options(xso); in create_xso_from_stream()
1971 return xso; in create_xso_from_stream()
1974 OPENSSL_free(xso); in create_xso_from_stream()
2002 QUIC_XSO *xso = NULL; in quic_conn_stream_new() local
2049 xso = create_xso_from_stream(qc, qs); in quic_conn_stream_new()
2050 if (xso == NULL) in quic_conn_stream_new()
2057 return &xso->ssl; in quic_conn_stream_new()
2060 OPENSSL_free(xso); in quic_conn_stream_new()
2111 last_error = ctx.is_stream ? ctx.xso->last_error : ctx.qc->last_error; in ossl_quic_get_error()
2158 w = error_to_want(ctx.is_stream ? ctx.xso->last_error : ctx.qc->last_error); in ossl_quic_want()
2180 static void quic_post_write(QUIC_XSO *xso, int did_append, in quic_post_write() argument
2189 ossl_quic_stream_map_update_state(ossl_quic_channel_get_qsm(xso->conn->ch), in quic_post_write()
2190 xso->stream); in quic_post_write()
2193 ossl_quic_sstream_fin(xso->stream->sstream); in quic_post_write()
2202 ossl_quic_reactor_tick(ossl_quic_channel_get_reactor(xso->conn->ch), 0); in quic_post_write()
2206 QUIC_XSO *xso; member
2249 static int xso_sstream_append(QUIC_XSO *xso, const unsigned char *buf, in xso_sstream_append() argument
2252 QUIC_SSTREAM *sstream = xso->stream->sstream; in xso_sstream_append()
2254 uint64_t cwm = ossl_quic_txfc_get_cwm(&xso->stream->txfc); in xso_sstream_append()
2272 if (!quic_mutation_allowed(args->xso->conn, /*req_active=*/1)) in quic_write_again()
2276 if (!quic_validate_for_write(args->xso, &args->err)) in quic_write_again()
2284 if (!xso_sstream_append(args->xso, args->buf, args->len, &actual_written)) in quic_write_again()
2287 quic_post_write(args->xso, actual_written > 0, in quic_write_again()
2307 QUIC_XSO *xso = ctx->xso; in quic_write_blocking() local
2312 if (!xso_sstream_append(xso, buf, len, &actual_written)) { in quic_write_blocking()
2318 quic_post_write(xso, actual_written > 0, actual_written == len, flags, 1); in quic_write_blocking()
2331 args.xso = xso; in quic_write_blocking()
2338 res = block_until_pred(xso->conn, quic_write_again, &args, 0); in quic_write_blocking()
2340 if (!quic_mutation_allowed(xso->conn, /*req_active=*/1)) in quic_write_blocking()
2354 static void aon_write_begin(QUIC_XSO *xso, const unsigned char *buf, in aon_write_begin() argument
2357 assert(!xso->aon_write_in_progress); in aon_write_begin()
2359 xso->aon_write_in_progress = 1; in aon_write_begin()
2360 xso->aon_buf_base = buf; in aon_write_begin()
2361 xso->aon_buf_pos = already_sent; in aon_write_begin()
2362 xso->aon_buf_len = buf_len; in aon_write_begin()
2365 static void aon_write_finish(QUIC_XSO *xso) in aon_write_finish() argument
2367 xso->aon_write_in_progress = 0; in aon_write_finish()
2368 xso->aon_buf_base = NULL; in aon_write_finish()
2369 xso->aon_buf_pos = 0; in aon_write_finish()
2370 xso->aon_buf_len = 0; in aon_write_finish()
2378 QUIC_XSO *xso = ctx->xso; in quic_write_nonblocking_aon() local
2382 = ((xso->ssl_mode & SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER) != 0); in quic_write_nonblocking_aon()
2384 if (xso->aon_write_in_progress) { in quic_write_nonblocking_aon()
2390 if ((!accept_moving_buffer && xso->aon_buf_base != buf) in quic_write_nonblocking_aon()
2391 || len != xso->aon_buf_len) in quic_write_nonblocking_aon()
2398 actual_buf = (unsigned char *)buf + xso->aon_buf_pos; in quic_write_nonblocking_aon()
2399 actual_len = len - xso->aon_buf_pos; in quic_write_nonblocking_aon()
2407 if (!xso_sstream_append(xso, actual_buf, actual_len, &actual_written)) { in quic_write_nonblocking_aon()
2413 quic_post_write(xso, actual_written > 0, actual_written == actual_len, in quic_write_nonblocking_aon()
2418 if (xso->aon_write_in_progress) { in quic_write_nonblocking_aon()
2425 *written = xso->aon_buf_len; in quic_write_nonblocking_aon()
2426 aon_write_finish(xso); in quic_write_nonblocking_aon()
2434 if (xso->aon_write_in_progress) { in quic_write_nonblocking_aon()
2441 xso->aon_buf_pos += actual_written; in quic_write_nonblocking_aon()
2442 assert(xso->aon_buf_pos < xso->aon_buf_len); in quic_write_nonblocking_aon()
2452 aon_write_begin(xso, buf, len, actual_written); in quic_write_nonblocking_aon()
2466 QUIC_XSO *xso = ctx->xso; in quic_write_nonblocking_epw() local
2469 if (!xso_sstream_append(xso, buf, len, written)) { in quic_write_nonblocking_epw()
2475 quic_post_write(xso, *written > 0, *written == len, flags, in quic_write_nonblocking_epw()
2486 static int quic_validate_for_write(QUIC_XSO *xso, int *err) in quic_validate_for_write() argument
2490 if (xso == NULL || xso->stream == NULL) { in quic_validate_for_write()
2495 switch (xso->stream->send_state) { in quic_validate_for_write()
2502 qsm = ossl_quic_channel_get_qsm(xso->conn->ch); in quic_validate_for_write()
2504 if (!ossl_quic_stream_map_ensure_send_part_id(qsm, xso->stream)) { in quic_validate_for_write()
2513 if (ossl_quic_sstream_get_final_size(xso->stream->sstream, NULL)) { in quic_validate_for_write()
2548 partial_write = ((ctx.xso != NULL) in ossl_quic_write_flags()
2549 ? ((ctx.xso->ssl_mode & SSL_MODE_ENABLE_PARTIAL_WRITE) != 0) : 0); in ossl_quic_write_flags()
2571 if (len > 0 && !quic_validate_for_write(ctx.xso, &err)) { in ossl_quic_write_flags()
2578 quic_post_write(ctx.xso, 0, 1, flags, in ossl_quic_write_flags()
2585 if (xso_blocking_mode(ctx.xso)) in ossl_quic_write_flags()
2617 static int quic_validate_for_read(QUIC_XSO *xso, int *err, int *eos) in quic_validate_for_read() argument
2623 if (xso == NULL || xso->stream == NULL) { in quic_validate_for_read()
2628 switch (xso->stream->recv_state) { in quic_validate_for_read()
2644 qsm = ossl_quic_channel_get_qsm(xso->conn->ch); in quic_validate_for_read()
2645 ossl_quic_stream_map_notify_app_read_reset_recv_part(qsm, xso->stream); in quic_validate_for_read()
2664 if (!quic_validate_for_read(ctx->xso, &err, &eos)) { in quic_read_actual()
2666 ctx->xso->retired_fin = 1; in quic_read_actual()
2704 ossl_quic_stream_map_notify_totally_read(qsm, ctx->xso->stream); in quic_read_actual()
2713 ctx->xso->retired_fin = 1; in quic_read_actual()
2768 if (ctx.xso == NULL) { in quic_read()
2780 ctx.xso = ctx.qc->default_xso; in quic_read()
2783 if (!quic_read_actual(&ctx, ctx.xso->stream, buf, len, bytes_read, peek)) { in quic_read()
2795 } else if (xso_blocking_mode(ctx.xso)) { in quic_read()
2802 args.stream = ctx.xso->stream; in quic_read()
2826 if (!quic_read_actual(&ctx, ctx.xso->stream, buf, len, bytes_read, peek)) { in quic_read()
2871 if (ctx.xso == NULL) { in ossl_quic_pending_int()
2874 ctx.xso = ctx.qc->default_xso; in ossl_quic_pending_int()
2881 if (ctx.xso->stream == NULL) { in ossl_quic_pending_int()
2887 avail = ossl_quic_stream_recv_pending(ctx.xso->stream, in ossl_quic_pending_int()
2892 avail = ossl_quic_stream_recv_pending(ctx.xso->stream, in ossl_quic_pending_int()
2925 qs = ctx.xso->stream; in ossl_quic_conn_stream_conclude()
2932 if (!quic_validate_for_write(ctx.xso, &err)) { in ossl_quic_conn_stream_conclude()
2943 quic_post_write(ctx.xso, 1, 0, 0, qctx_should_autotick(&ctx)); in ossl_quic_conn_stream_conclude()
2999 if (ctx.xso == NULL) { in ossl_quic_get_stream_type()
3014 if (ossl_quic_stream_is_bidi(ctx.xso->stream)) in ossl_quic_get_stream_type()
3017 if (ossl_quic_stream_is_server_init(ctx.xso->stream) != ctx.qc->as_server) in ossl_quic_get_stream_type()
3036 id = ctx.xso->stream->id; in ossl_quic_get_stream_id()
3055 is_local = ossl_quic_stream_is_local_init(ctx.xso->stream); in ossl_quic_is_stream_local()
3105 QUIC_XSO *xso = NULL; in ossl_quic_detach_stream() local
3114 qc_set_default_xso_keep_ref(ctx.qc, NULL, /*touch=*/1, &xso); in ossl_quic_detach_stream()
3118 return xso != NULL ? &xso->ssl : NULL; in ossl_quic_detach_stream()
3129 QUIC_XSO *xso; in ossl_quic_attach_stream() local
3139 xso = (QUIC_XSO *)stream; in ossl_quic_attach_stream()
3153 if (!CRYPTO_GET_REF(&xso->ssl.references, &nref)) { in ossl_quic_attach_stream()
3168 qc_set_default_xso(ctx.qc, xso, /*touch=*/1); in ossl_quic_attach_stream()
3335 event_handling_mode = ctx->xso->event_handling_mode; in qctx_should_autotick()
3383 ctx->xso->event_handling_mode = (int)value_out; in qc_getset_event_handling()
3388 ? ctx->xso->event_handling_mode in qc_getset_event_handling()
3417 if (ctx->xso == NULL) { in qc_get_stream_write_buf_stat()
3422 if (!ossl_quic_stream_has_send(ctx->xso->stream)) { in qc_get_stream_write_buf_stat()
3427 if (ossl_quic_stream_has_send_buffer(ctx->xso->stream)) in qc_get_stream_write_buf_stat()
3428 value = getter(ctx->xso->stream->sstream); in qc_get_stream_write_buf_stat()
3559 QUIC_XSO *xso; in ossl_quic_accept_stream() local
3598 xso = create_xso_from_stream(ctx.qc, qs); in ossl_quic_accept_stream()
3599 if (xso == NULL) in ossl_quic_accept_stream()
3605 new_s = &xso->ssl; in ossl_quic_accept_stream()
3654 qs = ctx.xso->stream; in ossl_quic_stream_reset()
3657 if (!quic_validate_for_write(ctx.xso, &err)) { in ossl_quic_stream_reset()
3664 ctx.xso->requested_reset = 1; in ossl_quic_stream_reset()
3743 quic_classify_stream(ctx.qc, ctx.xso->stream, is_write, &state, NULL); in quic_get_stream_state()
3775 quic_classify_stream(ctx.qc, ctx.xso->stream, /*is_write=*/0, in quic_get_stream_error_code()
3816 if (!ossl_quic_stream_has_send(ctx.xso->stream)) { in ossl_quic_set_write_buffer_size()
3822 if (!ossl_quic_stream_has_send_buffer(ctx.xso->stream)) { in ossl_quic_set_write_buffer_size()
3831 if (!ossl_quic_sstream_set_buffer_size(ctx.xso->stream->sstream, size)) { in ossl_quic_set_write_buffer_size()
4021 static int test_poll_event_r(QUIC_XSO *xso) in test_poll_event_r() argument
4039 if (xso->stream->recv_state == QUIC_RSTREAM_STATE_DATA_READ) in test_poll_event_r()
4042 return ossl_quic_stream_has_recv_buffer(xso->stream) in test_poll_event_r()
4043 && ossl_quic_rstream_available(xso->stream->rstream, &avail, &fin) in test_poll_event_r()
4044 && (avail > 0 || (fin && !xso->retired_fin)); in test_poll_event_r()
4049 static int test_poll_event_er(QUIC_XSO *xso) in test_poll_event_er() argument
4051 return ossl_quic_stream_has_recv(xso->stream) in test_poll_event_er()
4052 && ossl_quic_stream_recv_is_reset(xso->stream) in test_poll_event_er()
4053 && !xso->retired_fin; in test_poll_event_er()
4058 static int test_poll_event_w(QUIC_XSO *xso) in test_poll_event_w() argument
4060 return !xso->conn->shutting_down in test_poll_event_w()
4061 && ossl_quic_stream_has_send_buffer(xso->stream) in test_poll_event_w()
4062 && ossl_quic_sstream_get_buffer_avail(xso->stream->sstream) in test_poll_event_w()
4063 && !ossl_quic_sstream_get_final_size(xso->stream->sstream, NULL) in test_poll_event_w()
4064 && quic_mutation_allowed(xso->conn, /*req_active=*/1); in test_poll_event_w()
4069 static int test_poll_event_ew(QUIC_XSO *xso) in test_poll_event_ew() argument
4071 return ossl_quic_stream_has_send(xso->stream) in test_poll_event_ew()
4072 && xso->stream->peer_stop_sending in test_poll_event_ew()
4073 && !xso->requested_reset in test_poll_event_ew()
4074 && !xso->conn->shutting_down; in test_poll_event_ew()
4130 if (ctx.xso != NULL) { in ossl_quic_conn_poll_events()
4134 && test_poll_event_r(ctx.xso)) in ossl_quic_conn_poll_events()
4138 && test_poll_event_er(ctx.xso)) in ossl_quic_conn_poll_events()
4142 && test_poll_event_w(ctx.xso)) in ossl_quic_conn_poll_events()
4146 && test_poll_event_ew(ctx.xso)) in ossl_quic_conn_poll_events()