lsquic_qdec_hdl.h revision 02b6086d
1/* Copyright (c) 2017 - 2019 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; 17 18 19struct qpack_dec_hdl 20{ 21 struct lsquic_conn *qdh_conn; 22 enum { 23 QDH_INITIALIZED = 1 << 0, 24 QDH_PUSH_PROMISE = 1 << 1, 25 } qdh_flags; 26 struct lsqpack_dec qdh_decoder; 27 struct lsquic_stream *qdh_enc_sm_in; 28 struct frab_list qdh_fral; 29 struct lsquic_stream *qdh_dec_sm_out; 30 const struct lsquic_engine_public 31 *qdh_enpub; 32 struct http1x_ctor_ctx qdh_h1x_ctor_ctx; 33 void *qdh_hsi_ctx; 34}; 35 36int 37lsquic_qdh_init (struct qpack_dec_hdl *, struct lsquic_conn *, 38 int is_server, const struct lsquic_engine_public *, 39 unsigned dyn_table_size, unsigned max_risked_streams); 40 41void 42lsquic_qdh_cleanup (struct qpack_dec_hdl *); 43 44#define lsquic_qdh_has_enc_stream(qdh) ((qdh)->qdh_enc_sm_in != NULL) 45 46enum header_in_status 47{ 48 HIS_DONE, 49 HIS_NEED, 50 HIS_BLOCKED, 51 HIS_ERROR, 52}; 53 54 55enum lsqpack_read_header_status 56lsquic_qdh_header_in_begin (struct qpack_dec_hdl *, struct lsquic_stream *, 57 uint64_t size, const unsigned char **, size_t); 58 59enum lsqpack_read_header_status 60lsquic_qdh_header_in_continue (struct qpack_dec_hdl *, struct lsquic_stream *, 61 const unsigned char **, size_t); 62 63void 64lsquic_qdh_unref_stream (struct qpack_dec_hdl *, struct lsquic_stream *); 65 66void 67lsquic_qdh_cancel_stream (struct qpack_dec_hdl *, 68 struct lsquic_stream *); 69 70extern const struct lsquic_stream_if *const lsquic_qdh_enc_sm_in_if; 71extern const struct lsquic_stream_if *const lsquic_qdh_dec_sm_out_if; 72 73#endif 74