lsquic_frame_writer.h revision 5392f7a3
1229fce07SDmitri Tikhonov/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */ 250aadb33SDmitri Tikhonov/* 350aadb33SDmitri Tikhonov * lsquic_frame_writer.h -- write frames to HEADERS stream. 450aadb33SDmitri Tikhonov */ 550aadb33SDmitri Tikhonov 650aadb33SDmitri Tikhonov#ifndef LSQUIC_FRAME_WRITER_H 750aadb33SDmitri Tikhonov#define LSQUIC_FRAME_WRITER_H 1 850aadb33SDmitri Tikhonov 950aadb33SDmitri Tikhonov#include <stddef.h> 1050aadb33SDmitri Tikhonov#include <stdint.h> 1150aadb33SDmitri Tikhonov 125392f7a3SLiteSpeed Tech/* Same as H2_TMP_HDR_BUFF_SIZE */ 133b55e6aeSDmitri Tikhonov#define MAX_HEADERS_SIZE (64 * 1024) 143b55e6aeSDmitri Tikhonov 1550aadb33SDmitri Tikhonovstruct iovec; 16bea64822SDmitri Tikhonovstruct lshpack_enc; 1750aadb33SDmitri Tikhonovstruct lsquic_mm; 1850aadb33SDmitri Tikhonovstruct lsquic_frame_writer; 1950aadb33SDmitri Tikhonovstruct lsquic_stream; 205392f7a3SLiteSpeed Techstruct lsquic_reader; 2150aadb33SDmitri Tikhonovstruct lsquic_http_headers; 2250aadb33SDmitri Tikhonovstruct lsquic_http2_setting; 2319f667fbSDmitri Tikhonov#if LSQUIC_CONN_STATS 2419f667fbSDmitri Tikhonovstruct conn_stats; 2519f667fbSDmitri Tikhonov#endif 2650aadb33SDmitri Tikhonov 275392f7a3SLiteSpeed Techtypedef ssize_t (*fw_writef_f)(struct lsquic_stream *, struct lsquic_reader *); 2850aadb33SDmitri Tikhonov 2950aadb33SDmitri Tikhonovstruct lsquic_frame_writer * 3050aadb33SDmitri Tikhonovlsquic_frame_writer_new (struct lsquic_mm *, struct lsquic_stream *, 31bea64822SDmitri Tikhonov unsigned max_frame_sz, struct lshpack_enc *, 325392f7a3SLiteSpeed Tech fw_writef_f, 3319f667fbSDmitri Tikhonov#if LSQUIC_CONN_STATS 3419f667fbSDmitri Tikhonov struct conn_stats *, 3519f667fbSDmitri Tikhonov#endif 3619f667fbSDmitri Tikhonov int is_server); 3750aadb33SDmitri Tikhonov 3850aadb33SDmitri Tikhonovvoid 3950aadb33SDmitri Tikhonovlsquic_frame_writer_destroy (struct lsquic_frame_writer *); 4050aadb33SDmitri Tikhonov 4150aadb33SDmitri Tikhonovint 4250aadb33SDmitri Tikhonovlsquic_frame_writer_have_leftovers (const struct lsquic_frame_writer *); 4350aadb33SDmitri Tikhonov 4450aadb33SDmitri Tikhonovint 4550aadb33SDmitri Tikhonovlsquic_frame_writer_flush (struct lsquic_frame_writer *); 4650aadb33SDmitri Tikhonov 4750aadb33SDmitri Tikhonovint 4850aadb33SDmitri Tikhonovlsquic_frame_writer_write_headers (struct lsquic_frame_writer *, 495392f7a3SLiteSpeed Tech lsquic_stream_id_t stream_id, 5050aadb33SDmitri Tikhonov const struct lsquic_http_headers *, 5150aadb33SDmitri Tikhonov int eos, unsigned weight); 5250aadb33SDmitri Tikhonov 5350aadb33SDmitri Tikhonovint 5450aadb33SDmitri Tikhonovlsquic_frame_writer_write_settings (struct lsquic_frame_writer *, 5550aadb33SDmitri Tikhonov const struct lsquic_http2_setting *, unsigned n_settings); 5650aadb33SDmitri Tikhonov 5750aadb33SDmitri Tikhonovint 5850aadb33SDmitri Tikhonovlsquic_frame_writer_write_priority (struct lsquic_frame_writer *, 595392f7a3SLiteSpeed Tech lsquic_stream_id_t stream_id, int exclusive, 605392f7a3SLiteSpeed Tech lsquic_stream_id_t stream_dep_id, unsigned priority); 6150aadb33SDmitri Tikhonov 6250aadb33SDmitri Tikhonovint 6350aadb33SDmitri Tikhonovlsquic_frame_writer_write_promise (struct lsquic_frame_writer *, 645392f7a3SLiteSpeed Tech lsquic_stream_id_t stream_id, lsquic_stream_id_t promised_stream_id, 655392f7a3SLiteSpeed Tech const struct iovec *path, const struct iovec *host, 665392f7a3SLiteSpeed Tech const struct lsquic_http_headers *headers); 6750aadb33SDmitri Tikhonov 6850aadb33SDmitri Tikhonovvoid 6950aadb33SDmitri Tikhonovlsquic_frame_writer_max_header_list_size (struct lsquic_frame_writer *, 7050aadb33SDmitri Tikhonov uint32_t max_size); 7150aadb33SDmitri Tikhonov 72c51ce338SDmitri Tikhonovsize_t 73c51ce338SDmitri Tikhonovlsquic_frame_writer_mem_used (const struct lsquic_frame_writer *); 74c51ce338SDmitri Tikhonov 7550aadb33SDmitri Tikhonov#endif 76