Lines Matching refs:conn

85 void OSSL_DEMO_H3_CONN_free(OSSL_DEMO_H3_CONN *conn)  in OSSL_DEMO_H3_CONN_free()  argument
87 if (conn == NULL) in OSSL_DEMO_H3_CONN_free()
90 lh_OSSL_DEMO_H3_STREAM_doall(conn->streams, h3_stream_free); in OSSL_DEMO_H3_CONN_free()
92 nghttp3_conn_del(conn->h3conn); in OSSL_DEMO_H3_CONN_free()
93 BIO_free_all(conn->qconn_bio); in OSSL_DEMO_H3_CONN_free()
94 lh_OSSL_DEMO_H3_STREAM_free(conn->streams); in OSSL_DEMO_H3_CONN_free()
95 OPENSSL_free(conn); in OSSL_DEMO_H3_CONN_free()
98 static OSSL_DEMO_H3_STREAM *h3_conn_create_stream(OSSL_DEMO_H3_CONN *conn, int type) in h3_conn_create_stream() argument
109 if ((s->s = SSL_new_stream(conn->qconn, flags)) == NULL) { in h3_conn_create_stream()
116 lh_OSSL_DEMO_H3_STREAM_insert(conn->streams, s); in h3_conn_create_stream()
124 static OSSL_DEMO_H3_STREAM *h3_conn_accept_stream(OSSL_DEMO_H3_CONN *conn, SSL *qstream) in h3_conn_accept_stream() argument
133 lh_OSSL_DEMO_H3_STREAM_insert(conn->streams, s); in h3_conn_accept_stream()
137 static void h3_conn_remove_stream(OSSL_DEMO_H3_CONN *conn, OSSL_DEMO_H3_STREAM *s) in h3_conn_remove_stream() argument
142 lh_OSSL_DEMO_H3_STREAM_delete(conn->streams, s); in h3_conn_remove_stream()
150 OSSL_DEMO_H3_CONN *conn = conn_user_data; in h3_conn_recv_data() local
152 conn->consumed_app_data += datalen; in h3_conn_recv_data()
153 if (conn->recv_data_cb == NULL) in h3_conn_recv_data()
156 return conn->recv_data_cb(h3conn, stream_id, data, datalen, in h3_conn_recv_data()
165 OSSL_DEMO_H3_CONN *conn = conn_user_data; in h3_conn_stream_close() local
168 if (conn->stream_close_cb != NULL) in h3_conn_stream_close()
169 ret = conn->stream_close_cb(h3conn, stream_id, app_error_code, in h3_conn_stream_close()
172 h3_conn_remove_stream(conn, stream); in h3_conn_stream_close()
181 OSSL_DEMO_H3_CONN *conn = conn_user_data; in h3_conn_stop_sending() local
184 if (conn->stop_sending_cb != NULL) in h3_conn_stop_sending()
185 ret = conn->stop_sending_cb(h3conn, stream_id, app_error_code, in h3_conn_stop_sending()
198 OSSL_DEMO_H3_CONN *conn = conn_user_data; in h3_conn_reset_stream() local
202 if (conn->reset_stream_cb != NULL) in h3_conn_reset_stream()
203 ret = conn->reset_stream_cb(h3conn, stream_id, app_error_code, in h3_conn_reset_stream()
221 OSSL_DEMO_H3_CONN *conn = conn_user_data; in h3_conn_deferred_consume() local
223 if (conn->deferred_consume_cb != NULL) in h3_conn_deferred_consume()
224 ret = conn->deferred_consume_cb(h3conn, stream_id, consumed, in h3_conn_deferred_consume()
227 conn->consumed_app_data += consumed; in h3_conn_deferred_consume()
237 OSSL_DEMO_H3_CONN *conn; in OSSL_DEMO_H3_CONN_new_for_conn() local
251 if ((conn = OPENSSL_zalloc(sizeof(OSSL_DEMO_H3_CONN))) == NULL) in OSSL_DEMO_H3_CONN_new_for_conn()
254 conn->qconn_bio = qconn_bio; in OSSL_DEMO_H3_CONN_new_for_conn()
255 conn->user_data = user_data; in OSSL_DEMO_H3_CONN_new_for_conn()
257 if (BIO_get_ssl(qconn_bio, &conn->qconn) == 0) { in OSSL_DEMO_H3_CONN_new_for_conn()
264 if ((conn->streams = lh_OSSL_DEMO_H3_STREAM_new(h3_stream_hash, h3_stream_eq)) == NULL) in OSSL_DEMO_H3_CONN_new_for_conn()
272 if (SSL_in_before(conn->qconn)) in OSSL_DEMO_H3_CONN_new_for_conn()
273 if (SSL_set_alpn_protos(conn->qconn, alpn, sizeof(alpn))) { in OSSL_DEMO_H3_CONN_new_for_conn()
285 BIO_set_nbio(conn->qconn_bio, 1); in OSSL_DEMO_H3_CONN_new_for_conn()
293 if (!SSL_set_default_stream_mode(conn->qconn, SSL_DEFAULT_STREAM_MODE_NONE)) { in OSSL_DEMO_H3_CONN_new_for_conn()
308 = h3_conn_create_stream(conn, OSSL_DEMO_H3_STREAM_TYPE_CTRL_SEND)) == NULL) in OSSL_DEMO_H3_CONN_new_for_conn()
312 = h3_conn_create_stream(conn, OSSL_DEMO_H3_STREAM_TYPE_QPACK_ENC_SEND)) == NULL) in OSSL_DEMO_H3_CONN_new_for_conn()
316 = h3_conn_create_stream(conn, OSSL_DEMO_H3_STREAM_TYPE_QPACK_DEC_SEND)) == NULL) in OSSL_DEMO_H3_CONN_new_for_conn()
331 conn->recv_data_cb = intl_callbacks.recv_data; in OSSL_DEMO_H3_CONN_new_for_conn()
332 conn->stream_close_cb = intl_callbacks.stream_close; in OSSL_DEMO_H3_CONN_new_for_conn()
333 conn->stop_sending_cb = intl_callbacks.stop_sending; in OSSL_DEMO_H3_CONN_new_for_conn()
334 conn->reset_stream_cb = intl_callbacks.reset_stream; in OSSL_DEMO_H3_CONN_new_for_conn()
335 conn->deferred_consume_cb = intl_callbacks.deferred_consume; in OSSL_DEMO_H3_CONN_new_for_conn()
344 ec = nghttp3_conn_client_new(&conn->h3conn, &intl_callbacks, settings, in OSSL_DEMO_H3_CONN_new_for_conn()
345 NULL, conn); in OSSL_DEMO_H3_CONN_new_for_conn()
361 ec = nghttp3_conn_bind_control_stream(conn->h3conn, s_ctl_send->id); in OSSL_DEMO_H3_CONN_new_for_conn()
369 ec = nghttp3_conn_bind_qpack_streams(conn->h3conn, in OSSL_DEMO_H3_CONN_new_for_conn()
379 return conn; in OSSL_DEMO_H3_CONN_new_for_conn()
382 nghttp3_conn_del(conn->h3conn); in OSSL_DEMO_H3_CONN_new_for_conn()
386 lh_OSSL_DEMO_H3_STREAM_free(conn->streams); in OSSL_DEMO_H3_CONN_new_for_conn()
387 OPENSSL_free(conn); in OSSL_DEMO_H3_CONN_new_for_conn()
398 OSSL_DEMO_H3_CONN *conn = NULL; in OSSL_DEMO_H3_CONN_new_for_addr() local
428 conn = OSSL_DEMO_H3_CONN_new_for_conn(qconn_bio, callbacks, in OSSL_DEMO_H3_CONN_new_for_addr()
430 if (conn == NULL) in OSSL_DEMO_H3_CONN_new_for_addr()
433 return conn; in OSSL_DEMO_H3_CONN_new_for_addr()
440 int OSSL_DEMO_H3_CONN_connect(OSSL_DEMO_H3_CONN *conn) in OSSL_DEMO_H3_CONN_connect() argument
442 return SSL_connect(OSSL_DEMO_H3_CONN_get0_connection(conn)); in OSSL_DEMO_H3_CONN_connect()
445 void *OSSL_DEMO_H3_CONN_get_user_data(const OSSL_DEMO_H3_CONN *conn) in OSSL_DEMO_H3_CONN_get_user_data() argument
447 return conn->user_data; in OSSL_DEMO_H3_CONN_get_user_data()
450 SSL *OSSL_DEMO_H3_CONN_get0_connection(const OSSL_DEMO_H3_CONN *conn) in OSSL_DEMO_H3_CONN_get0_connection() argument
452 return conn->qconn; in OSSL_DEMO_H3_CONN_get0_connection()
459 OSSL_DEMO_H3_CONN *conn = conn_; in h3_conn_pump_stream() local
463 if (!conn->pump_res) in h3_conn_pump_stream()
494 ec = nghttp3_conn_read_stream(conn->h3conn, s->id, NULL, 0, in h3_conn_pump_stream()
510 ec = nghttp3_conn_close_stream(conn->h3conn, s->id, aec); in h3_conn_pump_stream()
537 assert(conn->consumed_app_data == 0); in h3_conn_pump_stream()
538 ec = nghttp3_conn_read_stream(conn->h3conn, s->id, s->buf + s->buf_cur, in h3_conn_pump_stream()
554 consumed = ec + conn->consumed_app_data; in h3_conn_pump_stream()
557 conn->consumed_app_data = 0; in h3_conn_pump_stream()
562 conn->pump_res = 0; in h3_conn_pump_stream()
565 int OSSL_DEMO_H3_CONN_handle_events(OSSL_DEMO_H3_CONN *conn) in OSSL_DEMO_H3_CONN_handle_events() argument
575 if (conn == NULL) in OSSL_DEMO_H3_CONN_handle_events()
588 if ((snew = SSL_accept_stream(conn->qconn, SSL_ACCEPT_STREAM_NO_BLOCK)) == NULL) in OSSL_DEMO_H3_CONN_handle_events()
595 if (h3_conn_accept_stream(conn, snew) == NULL) { in OSSL_DEMO_H3_CONN_handle_events()
610 ec = nghttp3_conn_writev_stream(conn->h3conn, &stream_id, &fin, in OSSL_DEMO_H3_CONN_handle_events()
625 if ((s = lh_OSSL_DEMO_H3_STREAM_retrieve(conn->streams, &key)) == NULL) { in OSSL_DEMO_H3_CONN_handle_events()
648 nghttp3_conn_block_stream(conn->h3conn, stream_id); in OSSL_DEMO_H3_CONN_handle_events()
659 nghttp3_conn_unblock_stream(conn->h3conn, stream_id); in OSSL_DEMO_H3_CONN_handle_events()
669 ec = nghttp3_conn_add_write_offset(conn->h3conn, stream_id, written); in OSSL_DEMO_H3_CONN_handle_events()
679 ec = nghttp3_conn_add_ack_offset(conn->h3conn, stream_id, written); in OSSL_DEMO_H3_CONN_handle_events()
693 ec = nghttp3_conn_add_write_offset(conn->h3conn, stream_id, 0); in OSSL_DEMO_H3_CONN_handle_events()
701 conn->pump_res = 1; /* cleared in below call if an error occurs */ in OSSL_DEMO_H3_CONN_handle_events()
702 lh_OSSL_DEMO_H3_STREAM_doall_arg(conn->streams, h3_conn_pump_stream, conn); in OSSL_DEMO_H3_CONN_handle_events()
703 if (!conn->pump_res) in OSSL_DEMO_H3_CONN_handle_events()
709 int OSSL_DEMO_H3_CONN_submit_request(OSSL_DEMO_H3_CONN *conn, in OSSL_DEMO_H3_CONN_submit_request() argument
717 if (conn == NULL) { in OSSL_DEMO_H3_CONN_submit_request()
724 if ((s_req = h3_conn_create_stream(conn, OSSL_DEMO_H3_STREAM_TYPE_REQ)) == NULL) in OSSL_DEMO_H3_CONN_submit_request()
729 ec = nghttp3_conn_submit_request(conn->h3conn, s_req->id, nva, nvlen, in OSSL_DEMO_H3_CONN_submit_request()
741 h3_conn_remove_stream(conn, s_req); in OSSL_DEMO_H3_CONN_submit_request()