Lines Matching refs:ctx

98   ((struct cf_osslq_ctx *)(cf)->ctx)->call_data
301 static void cf_osslq_ctx_clear(struct cf_osslq_ctx *ctx)
303 struct cf_call_data save = ctx->call_data;
305 cf_osslq_h3conn_cleanup(&ctx->h3);
306 Curl_vquic_tls_cleanup(&ctx->tls);
307 vquic_ctx_free(&ctx->q);
308 Curl_bufcp_free(&ctx->stream_bufcp);
309 Curl_ssl_peer_cleanup(&ctx->peer);
311 memset(ctx, 0, sizeof(*ctx));
312 ctx->call_data = save;
317 struct cf_osslq_ctx *ctx = cf->ctx;
321 if(ctx && ctx->tls.ssl) {
324 cf_osslq_ctx_clear(ctx);
333 struct cf_osslq_ctx *ctx = cf->ctx;
338 if(ctx) {
340 cf_osslq_ctx_clear(ctx);
341 free(ctx);
343 cf->ctx = NULL;
353 struct cf_osslq_ctx *ctx = cf->ctx;
368 Curl_bufq_initp(&nstream->recvbuf, &ctx->stream_bufcp, 1, BUFQ_OPT_NONE);
387 struct cf_osslq_ctx *ctx = cf->ctx;
406 lerr = SSL_get_verify_result(ctx->tls.ssl);
428 ctx->protocol_shutdown = TRUE;
455 ctx->peer.dispname, r_port, r_ip);
467 struct cf_osslq_ctx *ctx = cf->ctx;
473 return Curl_vquic_tls_verify_peer(&ctx->tls, cf, data, &ctx->peer);
508 struct cf_osslq_ctx *ctx = cf->ctx;
525 Curl_bufq_initp(&stream->sendbuf, &ctx->stream_bufcp,
530 Curl_bufq_initp(&stream->recvbuf, &ctx->stream_bufcp,
541 struct cf_osslq_ctx *ctx = cf->ctx;
547 if(ctx->h3.conn && !stream->closed) {
548 nghttp3_conn_shutdown_stream_read(ctx->h3.conn, stream->s.id);
549 nghttp3_conn_close_stream(ctx->h3.conn, stream->s.id,
551 nghttp3_conn_set_stream_user_data(ctx->h3.conn, stream->s.id, NULL);
568 struct cf_osslq_ctx *ctx = cf->ctx;
575 else if(ctx->h3.s_ctrl.id == stream_id) {
576 return &ctx->h3.s_ctrl;
578 else if(ctx->h3.s_qpack_enc.id == stream_id) {
579 return &ctx->h3.s_qpack_enc;
581 else if(ctx->h3.s_qpack_dec.id == stream_id) {
582 return &ctx->h3.s_qpack_dec;
978 static CURLcode cf_osslq_h3conn_init(struct cf_osslq_ctx *ctx, SSL *conn,
981 struct cf_osslq_h3conn *h3 = &ctx->h3;
998 &ctx->stream_bufcp, NULL);
1005 &ctx->stream_bufcp, NULL);
1012 &ctx->stream_bufcp, NULL);
1038 struct cf_osslq_ctx *ctx = cf->ctx;
1046 Curl_bufcp_init(&ctx->stream_bufcp, H3_STREAM_CHUNK_SIZE,
1048 result = Curl_ssl_peer_init(&ctx->peer, cf);
1053 result = Curl_vquic_tls_init(&ctx->tls, cf, data, &ctx->peer,
1059 result = vquic_ctx_init(&ctx->q);
1064 Curl_cf_socket_peek(cf->next, data, &ctx->q.sockfd,
1069 ctx->q.local_addrlen = sizeof(ctx->q.local_addr);
1070 rv = getsockname(ctx->q.sockfd, (struct sockaddr *)&ctx->q.local_addr,
1071 &ctx->q.local_addrlen);
1081 bio = BIO_new_dgram(ctx->q.sockfd, BIO_NOCLOSE);
1087 if(!SSL_set1_initial_peer_addr(ctx->tls.ssl, baddr)) {
1092 if(!SSL_set_blocking_mode(ctx->tls.ssl, 0)) {
1098 SSL_set_bio(ctx->tls.ssl, bio, bio);
1100 SSL_set_connect_state(ctx->tls.ssl);
1101 SSL_set_incoming_stream_policy(ctx->tls.ssl,
1104 result = cf_osslq_h3conn_init(ctx, ctx->tls.ssl, cf);
1172 struct cf_osslq_ctx *ctx = cf->ctx;
1206 nread = nghttp3_conn_read_stream(ctx->h3.conn, s->id,
1234 rv = nghttp3_conn_close_stream(ctx->h3.conn, s->id, app_error);
1244 rv = nghttp3_conn_close_stream(ctx->h3.conn, s->id,
1268 struct cf_osslq_ctx *ctx = cf->ctx;
1271 if(!ctx->tls.ssl)
1278 SSL *snew = SSL_accept_stream(ctx->tls.ssl, SSL_ACCEPT_STREAM_NO_BLOCK);
1282 (void)cf_osslq_h3conn_add_stream(&ctx->h3, snew, cf, data);
1285 if(!SSL_handle_events(ctx->tls.ssl)) {
1286 int detail = SSL_get_error(ctx->tls.ssl, 0);
1290 if(ctx->h3.conn) {
1292 for(i = 0; i < ctx->h3.remote_ctrl_n; ++i) {
1293 result = cf_osslq_stream_recv(&ctx->h3.remote_ctrl[i], cf, data);
1299 if(ctx->h3.conn) {
1326 struct cf_osslq_ctx *ctx = cf->ctx;
1330 if(ctx->h3.conn) {
1336 nghttp3_conn_unblock_stream(ctx->h3.conn, stream->s.id);
1350 struct cf_osslq_ctx *ctx = cf->ctx;
1353 if(!ctx->tls.ssl || !ctx->h3.conn)
1366 n = nghttp3_conn_writev_stream(ctx->h3.conn, &stream_id, &eos,
1414 nghttp3_conn_block_stream(ctx->h3.conn, s->id);
1429 rv = nghttp3_conn_add_write_offset(ctx->h3.conn, s->id, acked_len);
1436 rv = nghttp3_conn_add_ack_offset(ctx->h3.conn, s->id, acked_len);
1462 struct cf_osslq_ctx *ctx = cf->ctx;
1465 if(!ctx->tls.ssl)
1473 if(!SSL_handle_events(ctx->tls.ssl)) {
1474 int detail = SSL_get_error(ctx->tls.ssl, 0);
1488 struct cf_osslq_ctx *ctx = cf->ctx;
1494 if(ctx->tls.ssl &&
1495 SSL_get_event_timeout(ctx->tls.ssl, &tv, &is_infinite) &&
1506 if(SSL_get_event_timeout(ctx->tls.ssl, &tv, &is_infinite)) {
1523 struct cf_osslq_ctx *ctx = cf->ctx;
1545 if(ctx->reconnect_at.tv_sec && Curl_timediff(now, ctx->reconnect_at) < 0) {
1551 if(!ctx->tls.ssl) {
1552 ctx->started_at = now;
1558 if(!ctx->got_first_byte) {
1559 int readable = SOCKET_READABLE(ctx->q.sockfd, 0);
1561 ctx->got_first_byte = TRUE;
1562 ctx->first_byte_at = Curl_now();
1567 err = SSL_do_handshake(ctx->tls.ssl);
1571 ctx->handshake_at = now;
1573 (int)Curl_timediff(now, ctx->started_at));
1584 int detail = SSL_get_error(ctx->tls.ssl, err);
1588 result = Curl_vquic_tls_before_recv(&ctx->tls, cf, data);
1612 if(result == CURLE_RECV_ERROR && ctx->tls.ssl && ctx->protocol_shutdown) {
1644 struct cf_osslq_ctx *ctx = cf->ctx;
1702 *err = cf_osslq_stream_open(&stream->s, ctx->tls.ssl, 0,
1703 &ctx->stream_bufcp, data);
1734 rc = nghttp3_conn_submit_request(ctx->h3.conn, stream->s.id,
1771 struct cf_osslq_ctx *ctx = cf->ctx;
1779 DEBUGASSERT(ctx->tls.ssl);
1780 DEBUGASSERT(ctx->h3.conn);
1848 (void)nghttp3_conn_resume_stream(ctx->h3.conn, stream->s.id);
1909 struct cf_osslq_ctx *ctx = cf->ctx;
1915 (void)ctx;
1918 DEBUGASSERT(ctx);
1919 DEBUGASSERT(ctx->tls.ssl);
1920 DEBUGASSERT(ctx->h3.conn);
2002 struct cf_osslq_ctx *ctx = cf->ctx;
2026 (void)nghttp3_conn_resume_stream(ctx->h3.conn, stream->s.id);
2049 struct cf_osslq_ctx *ctx = cf->ctx;
2055 if(!ctx->tls.ssl)
2084 struct cf_osslq_ctx *ctx = cf->ctx;
2086 if(!ctx->tls.ssl) {
2092 Curl_pollset_set(data, ps, ctx->q.sockfd,
2093 SSL_net_read_desired(ctx->tls.ssl),
2094 SSL_net_write_desired(ctx->tls.ssl));
2100 Curl_pollset_check(data, ps, ctx->q.sockfd, &want_recv, &want_send);
2102 Curl_pollset_set(data, ps, ctx->q.sockfd,
2103 SSL_net_read_desired(ctx->tls.ssl),
2104 SSL_net_write_desired(ctx->tls.ssl));
2113 struct cf_osslq_ctx *ctx = cf->ctx;
2126 if(ctx->got_first_byte) {
2127 timediff_t ms = Curl_timediff(ctx->first_byte_at, ctx->started_at);
2135 if(ctx->got_first_byte)
2136 *when = ctx->first_byte_at;
2142 *when = ctx->handshake_at;
2176 struct cf_osslq_ctx *ctx = NULL;
2181 ctx = calloc(1, sizeof(*ctx));
2182 if(!ctx) {
2186 cf_osslq_ctx_clear(ctx);
2188 result = Curl_cf_create(&cf, &Curl_cft_http3, ctx);
2207 Curl_safefree(ctx);