Lines Matching refs:qss

58 static void qss_cull(QUIC_SSTREAM *qss);
62 QUIC_SSTREAM *qss; in ossl_quic_sstream_new() local
64 qss = OPENSSL_zalloc(sizeof(QUIC_SSTREAM)); in ossl_quic_sstream_new()
65 if (qss == NULL) in ossl_quic_sstream_new()
68 ring_buf_init(&qss->ring_buf); in ossl_quic_sstream_new()
69 if (!ring_buf_resize(&qss->ring_buf, init_buf_size, 0)) { in ossl_quic_sstream_new()
70 ring_buf_destroy(&qss->ring_buf, 0); in ossl_quic_sstream_new()
71 OPENSSL_free(qss); in ossl_quic_sstream_new()
75 ossl_uint_set_init(&qss->new_set); in ossl_quic_sstream_new()
76 ossl_uint_set_init(&qss->acked_set); in ossl_quic_sstream_new()
77 return qss; in ossl_quic_sstream_new()
80 void ossl_quic_sstream_free(QUIC_SSTREAM *qss) in ossl_quic_sstream_free() argument
82 if (qss == NULL) in ossl_quic_sstream_free()
85 ossl_uint_set_destroy(&qss->new_set); in ossl_quic_sstream_free()
86 ossl_uint_set_destroy(&qss->acked_set); in ossl_quic_sstream_free()
87 ring_buf_destroy(&qss->ring_buf, qss->cleanse); in ossl_quic_sstream_free()
88 OPENSSL_free(qss); in ossl_quic_sstream_free()
91 int ossl_quic_sstream_get_stream_frame(QUIC_SSTREAM *qss, in ossl_quic_sstream_get_stream_frame() argument
100 UINT_SET_ITEM *range = ossl_list_uint_set_head(&qss->new_set); in ossl_quic_sstream_get_stream_frame()
114 if (!qss->have_final_size || qss->sent_final_size) in ossl_quic_sstream_get_stream_frame()
117 hdr->offset = qss->ring_buf.head_offset; in ossl_quic_sstream_get_stream_frame()
137 if (!ring_buf_get_buf_at(&qss->ring_buf, in ossl_quic_sstream_get_stream_frame()
159 hdr->is_fin = qss->have_final_size in ossl_quic_sstream_get_stream_frame()
160 && hdr->offset + hdr->len == qss->ring_buf.head_offset; in ossl_quic_sstream_get_stream_frame()
166 int ossl_quic_sstream_has_pending(QUIC_SSTREAM *qss) in ossl_quic_sstream_has_pending() argument
172 return ossl_quic_sstream_get_stream_frame(qss, 0, &shdr, iov, &num_iov); in ossl_quic_sstream_has_pending()
175 uint64_t ossl_quic_sstream_get_cur_size(QUIC_SSTREAM *qss) in ossl_quic_sstream_get_cur_size() argument
177 return qss->ring_buf.head_offset; in ossl_quic_sstream_get_cur_size()
180 int ossl_quic_sstream_mark_transmitted(QUIC_SSTREAM *qss, in ossl_quic_sstream_mark_transmitted() argument
189 if (!ossl_uint_set_remove(&qss->new_set, &r)) in ossl_quic_sstream_mark_transmitted()
195 int ossl_quic_sstream_mark_transmitted_fin(QUIC_SSTREAM *qss, in ossl_quic_sstream_mark_transmitted_fin() argument
202 if (!qss->have_final_size || final_size != qss->ring_buf.head_offset) in ossl_quic_sstream_mark_transmitted_fin()
205 qss->sent_final_size = 1; in ossl_quic_sstream_mark_transmitted_fin()
209 int ossl_quic_sstream_mark_lost(QUIC_SSTREAM *qss, in ossl_quic_sstream_mark_lost() argument
221 if (!ossl_uint_set_insert(&qss->new_set, &r)) in ossl_quic_sstream_mark_lost()
227 int ossl_quic_sstream_mark_lost_fin(QUIC_SSTREAM *qss) in ossl_quic_sstream_mark_lost_fin() argument
229 if (qss->acked_final_size) in ossl_quic_sstream_mark_lost_fin()
234 qss->sent_final_size = 0; in ossl_quic_sstream_mark_lost_fin()
238 int ossl_quic_sstream_mark_acked(QUIC_SSTREAM *qss, in ossl_quic_sstream_mark_acked() argument
246 if (!ossl_uint_set_insert(&qss->acked_set, &r)) in ossl_quic_sstream_mark_acked()
249 qss_cull(qss); in ossl_quic_sstream_mark_acked()
253 int ossl_quic_sstream_mark_acked_fin(QUIC_SSTREAM *qss) in ossl_quic_sstream_mark_acked_fin() argument
255 if (!qss->have_final_size) in ossl_quic_sstream_mark_acked_fin()
259 qss->acked_final_size = 1; in ossl_quic_sstream_mark_acked_fin()
263 void ossl_quic_sstream_fin(QUIC_SSTREAM *qss) in ossl_quic_sstream_fin() argument
265 if (qss->have_final_size) in ossl_quic_sstream_fin()
268 qss->have_final_size = 1; in ossl_quic_sstream_fin()
271 int ossl_quic_sstream_get_final_size(QUIC_SSTREAM *qss, uint64_t *final_size) in ossl_quic_sstream_get_final_size() argument
273 if (!qss->have_final_size) in ossl_quic_sstream_get_final_size()
277 *final_size = qss->ring_buf.head_offset; in ossl_quic_sstream_get_final_size()
282 int ossl_quic_sstream_append(QUIC_SSTREAM *qss, in ossl_quic_sstream_append() argument
289 struct ring_buf old_ring_buf = qss->ring_buf; in ossl_quic_sstream_append()
291 if (qss->have_final_size) { in ossl_quic_sstream_append()
308 l = ring_buf_push(&qss->ring_buf, buf, buf_len); in ossl_quic_sstream_append()
320 assert(r.end + 1 == qss->ring_buf.head_offset); in ossl_quic_sstream_append()
321 if (!ossl_uint_set_insert(&qss->new_set, &r)) { in ossl_quic_sstream_append()
322 qss->ring_buf = old_ring_buf; in ossl_quic_sstream_append()
332 static void qss_cull(QUIC_SSTREAM *qss) in qss_cull() argument
334 UINT_SET_ITEM *h = ossl_list_uint_set_head(&qss->acked_set); in qss_cull()
353 ring_buf_cpop_range(&qss->ring_buf, h->range.start, h->range.end, in qss_cull()
354 qss->cleanse); in qss_cull()
357 int ossl_quic_sstream_set_buffer_size(QUIC_SSTREAM *qss, size_t num_bytes) in ossl_quic_sstream_set_buffer_size() argument
359 return ring_buf_resize(&qss->ring_buf, num_bytes, qss->cleanse); in ossl_quic_sstream_set_buffer_size()
362 size_t ossl_quic_sstream_get_buffer_size(QUIC_SSTREAM *qss) in ossl_quic_sstream_get_buffer_size() argument
364 return qss->ring_buf.alloc; in ossl_quic_sstream_get_buffer_size()
367 size_t ossl_quic_sstream_get_buffer_used(QUIC_SSTREAM *qss) in ossl_quic_sstream_get_buffer_used() argument
369 return ring_buf_used(&qss->ring_buf); in ossl_quic_sstream_get_buffer_used()
372 size_t ossl_quic_sstream_get_buffer_avail(QUIC_SSTREAM *qss) in ossl_quic_sstream_get_buffer_avail() argument
374 return ring_buf_avail(&qss->ring_buf); in ossl_quic_sstream_get_buffer_avail()
377 int ossl_quic_sstream_is_totally_acked(QUIC_SSTREAM *qss) in ossl_quic_sstream_is_totally_acked() argument
382 if (qss->have_final_size && !qss->acked_final_size) in ossl_quic_sstream_is_totally_acked()
385 if (ossl_quic_sstream_get_cur_size(qss) == 0) in ossl_quic_sstream_is_totally_acked()
388 if (ossl_list_uint_set_num(&qss->acked_set) != 1) in ossl_quic_sstream_is_totally_acked()
391 r = ossl_list_uint_set_head(&qss->acked_set)->range; in ossl_quic_sstream_is_totally_acked()
392 cur_size = qss->ring_buf.head_offset; in ossl_quic_sstream_is_totally_acked()
421 void ossl_quic_sstream_set_cleanse(QUIC_SSTREAM *qss, int cleanse) in ossl_quic_sstream_set_cleanse() argument
423 qss->cleanse = cleanse; in ossl_quic_sstream_set_cleanse()