Lines Matching refs:ctx

135 static void cf_msh3_ctx_init(struct cf_msh3_ctx *ctx,  in cf_msh3_ctx_init()  argument
138 DEBUGASSERT(!ctx->initialized); in cf_msh3_ctx_init()
139 Curl_hash_offt_init(&ctx->streams, 63, h3_stream_hash_free); in cf_msh3_ctx_init()
140 Curl_sock_assign_addr(&ctx->addr, ai, TRNSPRT_QUIC); in cf_msh3_ctx_init()
141 ctx->sock[SP_LOCAL] = CURL_SOCKET_BAD; in cf_msh3_ctx_init()
142 ctx->sock[SP_REMOTE] = CURL_SOCKET_BAD; in cf_msh3_ctx_init()
143 ctx->initialized = TRUE; in cf_msh3_ctx_init()
146 static void cf_msh3_ctx_free(struct cf_msh3_ctx *ctx) in cf_msh3_ctx_free() argument
148 if(ctx && ctx->initialized) { in cf_msh3_ctx_free()
149 Curl_hash_destroy(&ctx->streams); in cf_msh3_ctx_free()
151 free(ctx); in cf_msh3_ctx_free()
159 ((struct cf_msh3_ctx *)(cf)->ctx)->call_data
182 #define H3_STREAM_CTX(ctx,data) ((struct stream_ctx *)((data && ctx)? \ argument
183 Curl_hash_offt_get(&(ctx)->streams, (data)->mid) : NULL))
200 struct cf_msh3_ctx *ctx = cf->ctx; in h3_data_setup() local
201 struct stream_ctx *stream = H3_STREAM_CTX(ctx, data); in h3_data_setup()
216 if(!Curl_hash_offt_set(&ctx->streams, data->mid, stream)) { in h3_data_setup()
226 struct cf_msh3_ctx *ctx = cf->ctx; in h3_data_done() local
227 struct stream_ctx *stream = H3_STREAM_CTX(ctx, data); in h3_data_done()
232 Curl_hash_offt_remove(&ctx->streams, data->mid); in h3_data_done()
254 struct cf_msh3_ctx *ctx = cf->ctx; in h3_drain_stream() local
255 struct stream_ctx *stream = H3_STREAM_CTX(ctx, data); in h3_drain_stream()
278 struct cf_msh3_ctx *ctx = cf->ctx; in msh3_conn_connected() local
283 ctx->handshake_succeeded = TRUE; in msh3_conn_connected()
284 ctx->connected = TRUE; in msh3_conn_connected()
285 ctx->handshake_complete = TRUE; in msh3_conn_connected()
292 struct cf_msh3_ctx *ctx = cf->ctx; in msh3_conn_shutdown_complete() local
297 ctx->connected = FALSE; in msh3_conn_shutdown_complete()
298 ctx->handshake_complete = TRUE; in msh3_conn_shutdown_complete()
353 struct cf_msh3_ctx *ctx = h3_get_msh3_ctx(data); in write_resp_raw() local
354 struct stream_ctx *stream = H3_STREAM_CTX(ctx, data); in write_resp_raw()
380 struct cf_msh3_ctx *ctx = h3_get_msh3_ctx(data); in msh3_header_received() local
381 struct stream_ctx *stream = H3_STREAM_CTX(ctx, data); in msh3_header_received()
431 struct cf_msh3_ctx *ctx = h3_get_msh3_ctx(data); in msh3_data_received() local
432 struct stream_ctx *stream = H3_STREAM_CTX(ctx, data); in msh3_data_received()
471 struct cf_msh3_ctx *ctx = h3_get_msh3_ctx(data); in msh3_complete() local
472 struct stream_ctx *stream = H3_STREAM_CTX(ctx, data); in msh3_complete()
491 struct cf_msh3_ctx *ctx = h3_get_msh3_ctx(data); in msh3_shutdown_complete() local
492 struct stream_ctx *stream = H3_STREAM_CTX(ctx, data); in msh3_shutdown_complete()
504 struct cf_msh3_ctx *ctx = h3_get_msh3_ctx(data); in msh3_data_sent() local
505 struct stream_ctx *stream = H3_STREAM_CTX(ctx, data); in msh3_data_sent()
517 struct cf_msh3_ctx *ctx = cf->ctx; in recv_closed_stream() local
518 struct stream_ctx *stream = H3_STREAM_CTX(ctx, data); in recv_closed_stream()
551 struct cf_msh3_ctx *ctx = cf->ctx; in set_quic_expire() local
552 struct stream_ctx *stream = H3_STREAM_CTX(ctx, data); in set_quic_expire()
569 struct cf_msh3_ctx *ctx = cf->ctx; in cf_msh3_recv() local
570 struct stream_ctx *stream = H3_STREAM_CTX(ctx, data); in cf_msh3_recv()
621 struct cf_msh3_ctx *ctx = cf->ctx; in cf_msh3_send() local
622 struct stream_ctx *stream = H3_STREAM_CTX(ctx, data); in cf_msh3_send()
672 stream->req = MsH3RequestOpen(ctx->qconn, &msh3_request_if, data, in cf_msh3_send()
717 struct cf_msh3_ctx *ctx = cf->ctx; in cf_msh3_adjust_pollset() local
718 struct stream_ctx *stream = H3_STREAM_CTX(ctx, data); in cf_msh3_adjust_pollset()
722 if(stream && ctx->sock[SP_LOCAL] != CURL_SOCKET_BAD) { in cf_msh3_adjust_pollset()
724 Curl_pollset_add_in(data, ps, ctx->sock[SP_LOCAL]); in cf_msh3_adjust_pollset()
728 Curl_pollset_add_out(data, ps, ctx->sock[SP_LOCAL]); in cf_msh3_adjust_pollset()
737 struct cf_msh3_ctx *ctx = cf->ctx; in cf_msh3_data_pending() local
738 struct stream_ctx *stream = H3_STREAM_CTX(ctx, data); in cf_msh3_data_pending()
774 struct cf_msh3_ctx *ctx = cf->ctx; in cf_msh3_data_event() local
775 struct stream_ctx *stream = H3_STREAM_CTX(ctx, data); in cf_msh3_data_event()
817 struct cf_msh3_ctx *ctx = cf->ctx; in cf_connect_start() local
823 DEBUGASSERT(ctx->initialized); in cf_connect_start()
829 memcpy(&addr, &ctx->addr.curl_sa_addr, ctx->addr.addrlen); in cf_connect_start()
848 ctx->api = MsH3ApiOpen(); in cf_connect_start()
849 if(!ctx->api) { in cf_connect_start()
854 ctx->qconn = MsH3ConnectionOpen(ctx->api, in cf_connect_start()
860 if(!ctx->qconn) { in cf_connect_start()
862 if(ctx->api) { in cf_connect_start()
863 MsH3ApiClose(ctx->api); in cf_connect_start()
864 ctx->api = NULL; in cf_connect_start()
880 struct cf_msh3_ctx *ctx = cf->ctx; in cf_msh3_connect() local
892 if(ctx->sock[SP_LOCAL] == CURL_SOCKET_BAD) { in cf_msh3_connect()
893 if(Curl_socketpair(AF_UNIX, SOCK_STREAM, 0, &ctx->sock[0], FALSE) < 0) { in cf_msh3_connect()
894 ctx->sock[SP_LOCAL] = CURL_SOCKET_BAD; in cf_msh3_connect()
895 ctx->sock[SP_REMOTE] = CURL_SOCKET_BAD; in cf_msh3_connect()
901 if(!ctx->qconn) { in cf_msh3_connect()
902 ctx->connect_started = Curl_now(); in cf_msh3_connect()
908 if(ctx->handshake_complete) { in cf_msh3_connect()
909 ctx->handshake_at = Curl_now(); in cf_msh3_connect()
910 if(ctx->handshake_succeeded) { in cf_msh3_connect()
933 struct cf_msh3_ctx *ctx = cf->ctx; in cf_msh3_close() local
939 if(ctx) { in cf_msh3_close()
941 if(ctx->qconn) { in cf_msh3_close()
942 MsH3ConnectionClose(ctx->qconn); in cf_msh3_close()
943 ctx->qconn = NULL; in cf_msh3_close()
945 if(ctx->api) { in cf_msh3_close()
946 MsH3ApiClose(ctx->api); in cf_msh3_close()
947 ctx->api = NULL; in cf_msh3_close()
950 if(ctx->active) { in cf_msh3_close()
955 ctx->active = FALSE; in cf_msh3_close()
956 if(ctx->sock[SP_LOCAL] == cf->conn->sock[cf->sockindex]) { in cf_msh3_close()
958 (int)ctx->sock[SP_LOCAL]); in cf_msh3_close()
963 "conn->sock[], discarding", (int)ctx->sock[SP_LOCAL]); in cf_msh3_close()
964 ctx->sock[SP_LOCAL] = CURL_SOCKET_BAD; in cf_msh3_close()
969 if(ctx->sock[SP_LOCAL] != CURL_SOCKET_BAD) { in cf_msh3_close()
970 sclose(ctx->sock[SP_LOCAL]); in cf_msh3_close()
972 if(ctx->sock[SP_REMOTE] != CURL_SOCKET_BAD) { in cf_msh3_close()
973 sclose(ctx->sock[SP_REMOTE]); in cf_msh3_close()
975 ctx->sock[SP_LOCAL] = CURL_SOCKET_BAD; in cf_msh3_close()
976 ctx->sock[SP_REMOTE] = CURL_SOCKET_BAD; in cf_msh3_close()
987 if(cf->ctx) { in cf_msh3_destroy()
988 cf_msh3_ctx_free(cf->ctx); in cf_msh3_destroy()
989 cf->ctx = NULL; in cf_msh3_destroy()
998 struct cf_msh3_ctx *ctx = cf->ctx; in cf_msh3_query() local
1003 (void)ctx; in cf_msh3_query()
1011 *when = ctx->handshake_at; in cf_msh3_query()
1017 *when = ctx->handshake_at; in cf_msh3_query()
1032 struct cf_msh3_ctx *ctx = cf->ctx; in cf_msh3_conn_is_alive() local
1036 return ctx && ctx->sock[SP_LOCAL] != CURL_SOCKET_BAD && ctx->qconn && in cf_msh3_conn_is_alive()
1037 ctx->connected; in cf_msh3_conn_is_alive()
1065 return cf->ctx; in h3_get_msh3_ctx()
1078 struct cf_msh3_ctx *ctx = NULL; in Curl_cf_msh3_create() local
1085 ctx = calloc(1, sizeof(*ctx)); in Curl_cf_msh3_create()
1086 if(!ctx) { in Curl_cf_msh3_create()
1090 cf_msh3_ctx_init(ctx, ai); in Curl_cf_msh3_create()
1092 result = Curl_cf_create(&cf, &Curl_cft_http3, ctx); in Curl_cf_msh3_create()
1098 cf_msh3_ctx_free(ctx); in Curl_cf_msh3_create()