Lines Matching refs:qc
27 static void qc_cleanup(QUIC_CONNECTION *qc, int have_lock);
29 static int create_channel(QUIC_CONNECTION *qc, SSL_CTX *ctx);
30 static QUIC_XSO *create_xso_from_stream(QUIC_CONNECTION *qc, QUIC_STREAM *qs);
38 static void qc_update_reject_policy(QUIC_CONNECTION *qc);
39 static void qc_touch_default_xso(QUIC_CONNECTION *qc);
40 static void qc_set_default_xso(QUIC_CONNECTION *qc, QUIC_XSO *xso, int touch);
41 static void qc_set_default_xso_keep_ref(QUIC_CONNECTION *qc, QUIC_XSO *xso,
45 static int quic_mutation_allowed(QUIC_CONNECTION *qc, int req_active);
73 QUIC_CONNECTION *qc;
86 else if (!ctx->is_stream && ctx->qc != NULL)
87 ctx->qc->last_error = last_error;
109 * qc should be provided if available. In exceptional circumstances when qc is
129 if (reason == SSL_R_PROTOCOL_IS_SHUTDOWN && ctx->qc != NULL)
130 ossl_quic_channel_restore_err_state(ctx->qc->ch);
248 * qc NULL NULL non-NULL non-NULL
260 QUIC_CONNECTION *qc;
269 ctx->qc = NULL;
308 qc = (QUIC_CONNECTION *)s;
309 ctx->obj = &qc->obj;
310 ctx->qd = qc->domain;
311 ctx->ql = qc->listener; /* never changes, so can be read without lock */
312 ctx->qc = qc;
323 if ((flags & QCTX_AUTO_S) != 0 && qc->default_xso == NULL) {
324 if (!quic_mutation_allowed(qc, /*req_active=*/0)) {
344 && (qc->default_xso == NULL || (flags & QCTX_S) == 0)) {
349 ctx->xso = qc->default_xso;
362 ctx->qc = xso->conn;
520 static int quic_mutation_allowed(QUIC_CONNECTION *qc, int req_active)
522 if (qc->shutting_down || ossl_quic_channel_is_term_any(qc->ch))
525 if (req_active && !ossl_quic_channel_is_active(qc->ch))
588 QUIC_CONNECTION *qc = NULL;
600 qc = OPENSSL_zalloc(sizeof(*qc));
601 if (qc == NULL) {
608 if ((qc->mutex = ossl_crypto_mutex_new()) == NULL) {
615 qc->tls = ossl_ssl_connection_new_int(ctx, &qc->obj.ssl, TLS_method());
616 if (qc->tls == NULL || (sc = SSL_CONNECTION_FROM_SSL(qc->tls)) == NULL) {
630 qc->is_thread_assisted
634 qc->as_server = 0;
635 qc->as_server_state = qc->as_server;
637 if (!create_channel(qc, ctx))
640 ossl_quic_channel_set_msg_callback(qc->ch, ctx->msg_callback, &qc->obj.ssl);
641 ossl_quic_channel_set_msg_callback_arg(qc->ch, ctx->msg_callback_arg);
644 if (!ossl_quic_obj_init(&qc->obj, ctx, SSL_TYPE_QUIC_CONNECTION, NULL,
645 qc->engine, qc->port)) {
651 qc->default_stream_mode = SSL_DEFAULT_STREAM_MODE_AUTO_BIDI;
652 qc->default_ssl_mode = qc->obj.ssl.ctx->mode;
653 qc->default_ssl_options = qc->obj.ssl.ctx->options & OSSL_QUIC_PERMITTED_OPTIONS;
654 qc->incoming_stream_policy = SSL_INCOMING_STREAM_POLICY_AUTO;
655 qc->last_error = SSL_ERROR_NONE;
657 qc_update_reject_policy(qc);
669 return &qc->obj.ssl;
672 if (qc != NULL) {
673 qc_cleanup(qc, /*have_lock=*/0);
674 OPENSSL_free(qc);
692 static void qc_cleanup(QUIC_CONNECTION *qc, int have_lock)
694 SSL_free(qc->tls);
695 qc->tls = NULL;
697 ossl_quic_channel_free(qc->ch);
698 qc->ch = NULL;
700 if (qc->port != NULL && qc->listener == NULL && qc->pending == 0) { /* TODO */
701 quic_unref_port_bios(qc->port);
702 ossl_quic_port_free(qc->port);
703 qc->port = NULL;
705 ossl_quic_engine_free(qc->engine);
706 qc->engine = NULL;
712 ossl_crypto_mutex_unlock(qc->mutex);
714 if (qc->listener == NULL && qc->pending == 0)
715 ossl_crypto_mutex_free(&qc->mutex);
777 assert(ctx.qc->num_xso > 0);
778 --ctx.qc->num_xso;
784 ossl_quic_stream_map_reset_stream_send_part(ossl_quic_channel_get_qsm(ctx.qc->ch),
790 ossl_quic_stream_map_stop_sending_recv_part(ossl_quic_channel_get_qsm(ctx.qc->ch),
795 ossl_quic_stream_map_update_state(ossl_quic_channel_get_qsm(ctx.qc->ch),
798 is_default = (ctx.xso == ctx.qc->default_xso);
802 * Unref the connection in most cases; the XSO has a ref to the QC and
804 * the QC refs the XSO but the XSO does not ref the QC. If we are the
805 * default XSO, we only get here when the QC is being torn down anyway,
806 * so don't call SSL_free(qc) as we are already in it.
809 SSL_free(&ctx.qc->obj.ssl);
819 if (ctx.qc->default_xso != NULL) {
820 QUIC_XSO *xso = ctx.qc->default_xso;
825 ctx.qc->default_xso = NULL;
829 assert(ctx.qc->num_xso == 0);
832 if (ctx.qc->is_thread_assisted && ctx.qc->started) {
833 ossl_quic_thread_assist_wait_stopped(&ctx.qc->thread_assist);
834 ossl_quic_thread_assist_cleanup(&ctx.qc->thread_assist);
839 * Note: SSL_free (that called this function) calls OPENSSL_free(ctx.qc) for
842 qc_cleanup(ctx.qc, /*have_lock=*/1);
843 /* Note: SSL_free calls OPENSSL_free(qc) for us */
845 if (ctx.qc->listener != NULL)
846 SSL_free(&ctx.qc->listener->obj.ssl);
847 if (ctx.qc->domain != NULL)
848 SSL_free(&ctx.qc->domain->obj.ssl);
913 if (ctx.qc->is_thread_assisted && ctx.qc->started)
914 ossl_quic_thread_assist_notify_deadline_changed(&ctx.qc->thread_assist);
919 static void qc_touch_default_xso(QUIC_CONNECTION *qc)
921 qc->default_xso_created = 1;
922 qc_update_reject_policy(qc);
930 static void qc_set_default_xso_keep_ref(QUIC_CONNECTION *qc, QUIC_XSO *xso,
938 if (qc->default_xso != xso) {
939 *old_xso = qc->default_xso; /* transfer old XSO ref to caller */
941 qc->default_xso = xso;
946 * now has a ref to the QC.
948 if (!ossl_assert(SSL_up_ref(&qc->obj.ssl)))
953 * will have had a reference to the QC we need to drop to avoid a
962 CRYPTO_DOWN_REF(&qc->obj.ssl.references, &refs);
968 qc_touch_default_xso(qc);
976 static void qc_set_default_xso(QUIC_CONNECTION *qc, QUIC_XSO *xso, int touch)
980 qc_set_default_xso_keep_ref(qc, xso, touch, &old_xso);
1029 SSL_clear_options(ctx.qc->tls, hs_mask_value);
1030 SSL_set_options(ctx.qc->tls, hs_or_value);
1033 ctx.qc->default_ssl_options
1034 = ((ctx.qc->default_ssl_options & ~mask_value) | or_value)
1038 ret = ctx.qc->default_ssl_options;
1290 if (ctx.qc->started)
1295 BIO_ADDR_clear(&ctx.qc->init_peer_addr);
1299 return BIO_ADDR_copy(&ctx.qc->init_peer_addr, peer_addr);
1458 static void qc_shutdown_flush_init(QUIC_CONNECTION *qc)
1462 if (qc->shutting_down)
1465 qsm = ossl_quic_channel_get_qsm(qc->ch);
1468 qc->shutting_down = 1;
1473 static int qc_shutdown_flush_finished(QUIC_CONNECTION *qc)
1475 QUIC_STREAM_MAP *qsm = ossl_quic_channel_get_qsm(qc->ch);
1477 return qc->shutting_down
1484 QUIC_CONNECTION *qc = arg;
1486 return ossl_quic_channel_is_terminated(qc->ch);
1492 QUIC_CONNECTION *qc = arg;
1494 return ossl_quic_channel_is_term_any(qc->ch)
1495 || qc_shutdown_flush_finished(qc);
1500 QUIC_CONNECTION *qc = arg;
1501 return ossl_quic_channel_is_term_any(qc->ch);
1525 if (ossl_quic_channel_is_terminated(ctx.qc->ch)) {
1532 qc_shutdown_flush_init(ctx.qc);
1534 if (!qc_shutdown_flush_finished(ctx.qc)) {
1536 ret = block_until_pred(&ctx, quic_shutdown_flush_wait, ctx.qc, 0);
1546 if (!qc_shutdown_flush_finished(ctx.qc)) {
1553 if (wait_peer && !ossl_quic_channel_is_term_any(ctx.qc->ch)) {
1555 ret = block_until_pred(&ctx, quic_shutdown_peer_wait, ctx.qc, 0);
1564 if (!ossl_quic_channel_is_term_any(ctx.qc->ch)) {
1576 ctx.qc->shutting_down = 1;
1582 ossl_quic_channel_local_close(ctx.qc->ch,
1586 SSL_set_shutdown(ctx.qc->tls, SSL_SENT_SHUTDOWN);
1588 if (ossl_quic_channel_is_terminated(ctx.qc->ch)) {
1596 ret = block_until_pred(&ctx, quic_shutdown_wait, ctx.qc, 0);
1605 ret = ossl_quic_channel_is_terminated(ctx.qc->ch);
1626 ctx.qc->default_ssl_mode |= (uint32_t)larg;
1641 return ctx.qc->default_ssl_mode;
1647 ctx.qc->default_ssl_mode &= ~(uint32_t)larg;
1654 return ctx.qc->default_ssl_mode;
1660 ossl_quic_channel_set_msg_callback_arg(ctx.qc->ch, parg);
1662 return SSL_ctrl(ctx.qc->tls, cmd, larg, parg);
1697 return ossl_ctrl_internal(&ctx.qc->obj.ssl, cmd, larg, parg, /*no_quic=*/1);
1709 if (ctx.qc->as_server_state == 0)
1713 if (ctx.qc->started) {
1719 ctx.qc->as_server_state = 0;
1731 if (ctx.qc->as_server_state == 1)
1735 if (ctx.qc->started) {
1741 ctx.qc->as_server_state = 1;
1747 QUIC_CONNECTION *qc;
1750 static int tls_wants_non_io_retry(QUIC_CONNECTION *qc)
1752 int want = SSL_want(qc->tls);
1766 if (!quic_mutation_allowed(args->qc, /*req_active=*/1))
1769 if (ossl_quic_channel_is_handshake_complete(args->qc->ch))
1772 if (tls_wants_non_io_retry(args->qc))
1778 static int configure_channel(QUIC_CONNECTION *qc)
1780 assert(qc->ch != NULL);
1782 if (!ossl_quic_channel_set_peer_addr(qc->ch, &qc->init_peer_addr))
1796 static int create_channel(QUIC_CONNECTION *qc, SSL_CTX *ctx)
1804 engine_args.mutex = qc->mutex;
1810 qc->engine = ossl_quic_engine_new(&engine_args);
1811 if (qc->engine == NULL) {
1817 qc->port = ossl_quic_engine_create_port(qc->engine, &port_args);
1818 if (qc->port == NULL) {
1820 ossl_quic_engine_free(qc->engine);
1824 qc->ch = ossl_quic_port_create_outgoing(qc->port, qc->tls);
1825 if (qc->ch == NULL) {
1827 ossl_quic_port_free(qc->port);
1828 ossl_quic_engine_free(qc->engine);
1842 QUIC_CONNECTION *qc = ctx->qc;
1844 if (!qc->started) {
1845 if (!configure_channel(qc)) {
1851 if (!ossl_quic_channel_start(qc->ch)) {
1852 ossl_quic_channel_restore_err_state(qc->ch);
1859 if (qc->is_thread_assisted)
1860 if (!ossl_quic_thread_assist_init_start(&qc->thread_assist, qc->ch)) {
1868 qc->started = 1;
1876 QUIC_CONNECTION *qc = ctx->qc;
1880 if (ossl_quic_channel_is_handshake_complete(qc->ch))
1884 if (!quic_mutation_allowed(qc, /*req_active=*/0))
1887 if (qc->as_server != qc->as_server_state) {
1901 if (!qc->started && ossl_quic_port_is_addressed_w(port)
1902 && BIO_ADDR_family(&qc->init_peer_addr) == AF_UNSPEC) {
1915 if (!csm_analyse_init_peer_addr(net_wbio, &qc->init_peer_addr))
1917 BIO_ADDR_clear(&qc->init_peer_addr);
1919 ossl_quic_channel_set_peer_addr(qc->ch, &qc->init_peer_addr);
1922 if (!qc->started
1924 && BIO_ADDR_family(&qc->init_peer_addr) == AF_UNSPEC) {
1940 if (ossl_quic_channel_is_handshake_complete(qc->ch))
1948 if (ossl_quic_channel_is_handshake_complete(qc->ch))
1952 if (ossl_quic_channel_is_term_any(qc->ch)) {
1955 } else if (ossl_quic_obj_desires_blocking(&qc->obj)) {
1963 ossl_quic_engine_update_poll_descriptors(qc->obj.engine, /*force=*/1);
1974 args.qc = qc;
1977 if (!quic_mutation_allowed(qc, /*req_active=*/1)) {
1985 if (tls_wants_non_io_retry(qc)) {
1986 QUIC_RAISE_NORMAL_ERROR(ctx, SSL_get_error(qc->tls, 0));
1990 assert(ossl_quic_channel_is_handshake_complete(qc->ch));
1994 if (tls_wants_non_io_retry(qc)) {
1995 QUIC_RAISE_NORMAL_ERROR(ctx, SSL_get_error(qc->tls, 0));
2062 QUIC_CONNECTION *qc = ctx->qc;
2064 if (qc->default_xso_created
2065 || qc->default_stream_mode == SSL_DEFAULT_STREAM_MODE_NONE)
2073 if (qc->default_stream_mode == SSL_DEFAULT_STREAM_MODE_AUTO_UNI)
2076 qc_set_default_xso(qc, (QUIC_XSO *)quic_conn_stream_new(ctx, flags,
2079 if (qc->default_xso == NULL)
2082 qc_touch_default_xso(qc);
2087 QUIC_CONNECTION *qc;
2098 if (!quic_mutation_allowed(args->qc, /*req_active=*/1)) {
2104 args->qs = ossl_quic_stream_map_get_by_id(ossl_quic_channel_get_qsm(args->qc->ch),
2107 args->qs = ossl_quic_stream_map_get_by_id(ossl_quic_channel_get_qsm(args->qc->ch),
2121 QUIC_CONNECTION *qc = ctx->qc;
2131 if (qc->default_xso_created
2132 || qc->default_stream_mode == SSL_DEFAULT_STREAM_MODE_NONE)
2141 expect_id = qc->as_server
2145 qs = ossl_quic_stream_map_get_by_id(ossl_quic_channel_get_qsm(qc->ch),
2148 qs = ossl_quic_stream_map_get_by_id(ossl_quic_channel_get_qsm(qc->ch),
2154 qs = ossl_quic_stream_map_get_by_id(ossl_quic_channel_get_qsm(qc->ch),
2162 if (ossl_quic_channel_is_term_any(qc->ch)) {
2170 wargs.qc = qc;
2189 ossl_statm_get_rtt_info(ossl_quic_channel_get_statm(qc->ch), &rtt_info);
2190 ossl_quic_stream_map_remove_from_accept_queue(ossl_quic_channel_get_qsm(qc->ch),
2196 qc_set_default_xso(qc, create_xso_from_stream(qc, qs), /*touch=*/0);
2197 if (qc->default_xso == NULL)
2200 qc_touch_default_xso(qc); /* inhibits default XSO */
2205 static QUIC_XSO *create_xso_from_stream(QUIC_CONNECTION *qc, QUIC_STREAM *qs)
2214 if (!ossl_quic_obj_init(&xso->obj, qc->obj.ssl.ctx, SSL_TYPE_QUIC_XSO,
2215 &qc->obj.ssl, NULL, NULL)) {
2220 /* XSO refs QC */
2221 if (!SSL_up_ref(&qc->obj.ssl)) {
2226 xso->conn = qc;
2227 xso->ssl_mode = qc->default_ssl_mode;
2229 = qc->default_ssl_options & OSSL_QUIC_PERMITTED_OPTIONS_STREAM;
2234 ++qc->num_xso;
2244 QUIC_CONNECTION *qc;
2251 QUIC_CONNECTION *qc = args->qc;
2253 if (!quic_mutation_allowed(qc, /*req_active=*/1))
2256 if (ossl_quic_channel_is_new_local_stream_admissible(qc->ch, args->is_uni))
2266 QUIC_CONNECTION *qc = ctx->qc;
2276 if (!quic_mutation_allowed(qc, /*req_active=*/0)) {
2282 && !ossl_quic_channel_is_new_local_stream_admissible(qc->ch, is_uni)) {
2294 args.qc = qc;
2299 if (!quic_mutation_allowed(qc, /*req_active=*/1)) {
2308 qs = ossl_quic_channel_new_stream_local(qc->ch, is_uni);
2314 xso = create_xso_from_stream(qc, qs);
2318 qc_touch_default_xso(qc); /* inhibits default XSO */
2326 ossl_quic_stream_map_release(ossl_quic_channel_get_qsm(qc->ch), qs);
2375 net_error = ossl_quic_channel_net_error(ctx.qc->ch);
2376 last_error = ctx.is_stream ? ctx.xso->last_error : ctx.qc->last_error;
2423 w = error_to_want(ctx.is_stream ? ctx.xso->last_error : ctx.qc->last_error);
2835 if (!quic_mutation_allowed(ctx.qc, /*req_active=*/0)) {
2941 QUIC_CONNECTION *qc = ctx->qc;
2973 ossl_statm_get_rtt_info(ossl_quic_channel_get_statm(qc->ch), &rtt_info);
2981 QUIC_STREAM_MAP *qsm = ossl_quic_channel_get_qsm(ctx->qc->ch);
2987 ossl_quic_stream_map_update_state(ossl_quic_channel_get_qsm(qc->ch),
3004 if (!quic_mutation_allowed(args->ctx->qc, /*req_active=*/1)) {
3054 ctx.xso = ctx.qc->default_xso;
3067 if (quic_mutation_allowed(ctx.qc, /*req_active=*/0))
3071 } else if (!quic_mutation_allowed(ctx.qc, /*req_active=*/0)) {
3147 if (!ctx.qc->started)
3153 ctx.xso = ctx.qc->default_xso;
3168 || ossl_quic_channel_has_pending(ctx.qc->ch)
3169 || ossl_quic_channel_is_term_any(ctx.qc->ch);
3207 if (!quic_mutation_allowed(ctx.qc, /*req_active=*/1)) {
3275 return &ctx.qc->obj.ssl;
3342 if (ctx.qc->default_xso_created
3343 || ctx.qc->default_stream_mode == SSL_DEFAULT_STREAM_MODE_NONE)
3352 if (ossl_quic_stream_is_server_init(ctx.xso->stream) != ctx.qc->as_server)
3410 if (ctx.qc->default_xso_created) {
3420 ctx.qc->default_stream_mode = mode;
3448 /* QC ref to any default XSO is transferred to us and to caller. */
3449 qc_set_default_xso_keep_ref(ctx.qc, NULL, /*touch=*/1, &xso);
3478 if (ctx.qc->default_xso != NULL) {
3503 qc_set_default_xso(ctx.qc, xso, /*touch=*/1);
3514 static int qc_get_effective_incoming_stream_policy(QUIC_CONNECTION *qc)
3516 switch (qc->incoming_stream_policy) {
3518 if ((qc->default_xso == NULL && !qc->default_xso_created)
3519 || qc->default_stream_mode == SSL_DEFAULT_STREAM_MODE_NONE)
3525 return qc->incoming_stream_policy;
3530 static void qc_update_reject_policy(QUIC_CONNECTION *qc)
3532 int policy = qc_get_effective_incoming_stream_policy(qc);
3535 ossl_quic_channel_set_incoming_stream_auto_reject(qc->ch,
3537 qc->incoming_stream_aec);
3556 ctx.qc->incoming_stream_policy = policy;
3557 ctx.qc->incoming_stream_aec = aec;
3566 qc_update_reject_policy(ctx.qc);
3586 value_out = ossl_quic_channel_get_max_idle_timeout_request(ctx->qc->ch);
3596 if (ossl_quic_channel_have_generated_transport_params(ctx->qc->ch)) {
3602 ossl_quic_channel_set_max_idle_timeout_request(ctx->qc->ch, value_in);
3614 if (!ossl_quic_channel_is_handshake_complete(ctx->qc->ch)) {
3621 ? ossl_quic_channel_get_max_idle_timeout_actual(ctx->qc->ch)
3622 : ossl_quic_channel_get_max_idle_timeout_peer_request(ctx->qc->ch);
3656 ? ossl_quic_channel_get_remote_stream_count_avail(ctx->qc->ch, is_uni)
3657 : ossl_quic_channel_get_local_stream_count_avail(ctx->qc->ch, is_uni);
3864 QUIC_CONNECTION *qc = args->ctx->qc;
3865 QUIC_STREAM_MAP *qsm = ossl_quic_channel_get_qsm(qc->ch);
3867 if (!quic_mutation_allowed(qc, /*req_active=*/1)) {
3896 if (qc_get_effective_incoming_stream_policy(ctx.qc)
3902 qsm = ossl_quic_channel_get_qsm(ctx.qc->ch);
3927 xso = create_xso_from_stream(ctx.qc, qs);
3931 ossl_statm_get_rtt_info(ossl_quic_channel_get_statm(ctx.qc->ch), &rtt_info);
3937 qc_touch_default_xso(ctx.qc); /* inhibits default XSO */
3959 v = ossl_quic_stream_map_get_total_accept_queue_len(ossl_quic_channel_get_qsm(ctx.qc->ch));
3982 qsm = ossl_quic_channel_get_qsm(ctx.qc->ch);
4004 static void quic_classify_stream(QUIC_CONNECTION *qc,
4013 local_init = (ossl_quic_stream_is_server_init(qs) == qc->as_server);
4026 } else if (ossl_quic_channel_is_term_any(qc->ch)) {
4071 quic_classify_stream(ctx.qc, ctx.xso->stream, is_write, &state, NULL);
4103 quic_classify_stream(ctx.qc, ctx.xso->stream, is_write,
4185 tc = ossl_quic_channel_get_terminate_cause(ctx.qc->ch);
4229 if (!ossl_quic_channel_trigger_txku(ctx.qc->ch)) {
4273 QUIC_CONNECTION *qc = create_qc_from_incoming_conn(ql, ch);
4275 return (qc == NULL) ? NULL : &qc->obj.ssl;
4440 QUIC_CONNECTION *qc = NULL;
4467 if ((qc = OPENSSL_zalloc(sizeof(*qc))) == NULL) {
4477 qc->listener = ql;
4478 qc->engine = ql->engine;
4479 qc->port = ql->port;
4483 qc->mutex = ql->mutex;
4486 qc->is_thread_assisted
4491 qc->tls = ossl_ssl_connection_new_int(ql->obj.ssl.ctx, NULL, TLS_method());
4492 if (qc->tls == NULL || (sc = SSL_CONNECTION_FROM_SSL(qc->tls)) == NULL) {
4498 qc->default_ssl_options = OSSL_QUIC_PERMITTED_OPTIONS;
4499 qc->last_error = SSL_ERROR_NONE;
4504 * to grab reference for qc.
4506 qc->ch = ossl_quic_port_create_outgoing(qc->port, qc->tls);
4507 if (qc->ch == NULL) {
4512 ossl_quic_channel_set_msg_callback(qc->ch, ql->obj.ssl.ctx->msg_callback, &qc->obj.ssl);
4513 ossl_quic_channel_set_msg_callback_arg(qc->ch, ql->obj.ssl.ctx->msg_callback_arg);
4521 if (!ossl_quic_obj_init(&qc->obj, ql->obj.ssl.ctx,
4529 qc->default_stream_mode = SSL_DEFAULT_STREAM_MODE_AUTO_BIDI;
4530 qc->default_ssl_mode = qc->obj.ssl.ctx->mode;
4531 qc->default_ssl_options = qc->obj.ssl.ctx->options & OSSL_QUIC_PERMITTED_OPTIONS;
4532 qc->incoming_stream_policy = SSL_INCOMING_STREAM_POLICY_AUTO;
4533 qc->last_error = SSL_ERROR_NONE;
4535 qc_update_reject_policy(qc);
4539 return &qc->obj.ssl;
4542 if (qc != NULL) {
4543 qc_cleanup(qc, /* have_lock= */ 0);
4544 OPENSSL_free(qc);
4610 QUIC_CONNECTION *qc = NULL;
4664 qc = (QUIC_CONNECTION *)conn_ssl_tmp;
4666 qc->listener = ctx.ql;
4669 qc->pending = 0;
4696 QUIC_CONNECTION *qc = NULL;
4698 if ((qc = OPENSSL_zalloc(sizeof(*qc))) == NULL) {
4703 if (!ossl_quic_obj_init(&qc->obj, ql->obj.ssl.ctx,
4710 ossl_quic_channel_get_peer_addr(ch, &qc->init_peer_addr); /* best effort */
4711 qc->pending = 1;
4712 qc->engine = ql->engine;
4713 qc->port = ql->port;
4714 qc->ch = ch;
4716 qc->mutex = ql->mutex;
4718 qc->tls = ossl_quic_channel_get0_tls(ch);
4719 qc->started = 1;
4720 qc->as_server = 1;
4721 qc->as_server_state = 1;
4722 qc->default_stream_mode = SSL_DEFAULT_STREAM_MODE_AUTO_BIDI;
4723 qc->default_ssl_options = ql->obj.ssl.ctx->options & OSSL_QUIC_PERMITTED_OPTIONS;
4724 qc->incoming_stream_policy = SSL_INCOMING_STREAM_POLICY_AUTO;
4725 qc->last_error = SSL_ERROR_NONE;
4726 qc_update_reject_policy(qc);
4727 return qc;
4730 OPENSSL_free(qc);
5070 ossl_quic_channel_set_msg_callback(ctx.qc->ch, (ossl_msg_cb)fp,
5071 &ctx.qc->obj.ssl);
5073 return ssl3_callback_ctrl(ctx.qc->tls, cmd, fp);
5078 return ssl3_callback_ctrl(ctx.qc->tls, cmd, fp);
5132 if (ossl_quic_channel_is_term_any(ctx.qc->ch)) {
5134 if (!ossl_quic_channel_is_closing(ctx.qc->ch))
5208 static int test_poll_event_ec(QUIC_CONNECTION *qc)
5210 return ossl_quic_channel_is_term_any(qc->ch);
5215 static int test_poll_event_ecd(QUIC_CONNECTION *qc)
5217 return ossl_quic_channel_is_terminated(qc->ch);
5222 static int test_poll_event_is(QUIC_CONNECTION *qc, int is_uni)
5224 return ossl_quic_stream_map_get_accept_queue_len(ossl_quic_channel_get_qsm(qc->ch),
5230 static int test_poll_event_os(QUIC_CONNECTION *qc, int is_uni)
5233 return quic_mutation_allowed(qc, /*req_active=*/1)
5234 && ossl_quic_channel_get_local_stream_count_avail(qc->ch, is_uni) > 0;
5263 if (ctx.qc != NULL && !ctx.qc->started) {
5293 if (ctx.qc != NULL && !ctx.is_stream) {
5295 && test_poll_event_ec(ctx.qc))
5299 && test_poll_event_ecd(ctx.qc))
5303 && test_poll_event_is(ctx.qc, /*uni=*/0))
5307 && test_poll_event_is(ctx.qc, /*uni=*/1))
5311 && test_poll_event_os(ctx.qc, /*uni=*/0))
5315 && test_poll_event_os(ctx.qc, /*uni=*/1))
5400 return ctx.qc->ch;