lsquic_qdec_hdl.h revision 758aff32
1/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */ 2/* 3 * lsquic_qdec_hdl.h -- QPACK decoder streams handler 4 * 5 * The handler owns two unidirectional streams: a) peer-initiated QPACK 6 * encoder stream, from which it reads; and b) locally-initiated QPACK 7 * decoder stream, to which it writes. 8 */ 9 10#ifndef LSQUIC_QDEC_HDL_H 11#define LSQUIC_QDEC_HDL_H 1 12 13struct lsquic_conn; 14struct lsquic_stream; 15struct lsquic_stream_if; 16struct lsquic_engine_public; 17struct qpack_exp_record; 18 19 20struct qpack_dec_hdl 21{ 22 struct lsquic_conn *qdh_conn; 23 enum { 24 QDH_INITIALIZED = 1 << 0, 25 QDH_PUSH_PROMISE = 1 << 1, 26 } qdh_flags; 27 struct lsqpack_dec qdh_decoder; 28 struct lsquic_stream *qdh_enc_sm_in; 29 struct frab_list qdh_fral; 30 struct lsquic_stream *qdh_dec_sm_out; 31 const struct lsquic_engine_public 32 *qdh_enpub; 33 struct http1x_ctor_ctx qdh_h1x_ctor_ctx; 34 void *qdh_hsi_ctx; 35 void (*qdh_on_dec_sent_func)(void *); 36 void *qdh_on_dec_sent_ctx; 37 struct qpack_exp_record *qdh_exp_rec; 38}; 39 40int 41lsquic_qdh_init (struct qpack_dec_hdl *, struct lsquic_conn *, 42 int is_server, const struct lsquic_engine_public *, 43 unsigned dyn_table_size, unsigned max_risked_streams); 44 45void 46lsquic_qdh_cleanup (struct qpack_dec_hdl *); 47 48#define lsquic_qdh_has_enc_stream(qdh) ((qdh)->qdh_enc_sm_in != NULL) 49 50enum header_in_status 51{ 52 HIS_DONE, 53 HIS_NEED, 54 HIS_BLOCKED, 55 HIS_ERROR, 56}; 57 58 59enum lsqpack_read_header_status 60lsquic_qdh_header_in_begin (struct qpack_dec_hdl *, struct lsquic_stream *, 61 uint64_t size, const unsigned char **, size_t); 62 63enum lsqpack_read_header_status 64lsquic_qdh_header_in_continue (struct qpack_dec_hdl *, struct lsquic_stream *, 65 const unsigned char **, size_t); 66 67void 68lsquic_qdh_cancel_stream (struct qpack_dec_hdl *, 69 struct lsquic_stream *); 70 71void 72lsquic_qdh_cancel_stream_id (struct qpack_dec_hdl *, lsquic_stream_id_t); 73 74int 75lsquic_qdh_arm_if_unsent (struct qpack_dec_hdl *, void (*)(void *), void *); 76 77extern const struct lsquic_stream_if *const lsquic_qdh_enc_sm_in_if; 78extern const struct lsquic_stream_if *const lsquic_qdh_dec_sm_out_if; 79 80#endif 81