lsquic_frame_writer.h revision 7d09751d
1/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc. See LICENSE. */ 2/* 3 * lsquic_frame_writer.h -- write frames to HEADERS stream. 4 */ 5 6#ifndef LSQUIC_FRAME_WRITER_H 7#define LSQUIC_FRAME_WRITER_H 1 8 9#include <stddef.h> 10#include <stdint.h> 11 12/* Same as H2_TMP_HDR_BUFF_SIZE */ 13#define MAX_HEADERS_SIZE (64 * 1024) 14 15struct iovec; 16struct lshpack_enc; 17struct lsquic_mm; 18struct lsquic_frame_writer; 19struct lsquic_stream; 20struct lsquic_reader; 21struct lsquic_http_headers; 22struct lsquic_http2_setting; 23#if LSQUIC_CONN_STATS 24struct conn_stats; 25#endif 26 27typedef ssize_t (*fw_writef_f)(struct lsquic_stream *, struct lsquic_reader *); 28 29struct lsquic_frame_writer * 30lsquic_frame_writer_new (struct lsquic_mm *, struct lsquic_stream *, 31 unsigned max_frame_sz, struct lshpack_enc *, 32 fw_writef_f, 33#if LSQUIC_CONN_STATS 34 struct conn_stats *, 35#endif 36 int is_server); 37 38void 39lsquic_frame_writer_destroy (struct lsquic_frame_writer *); 40 41int 42lsquic_frame_writer_have_leftovers (const struct lsquic_frame_writer *); 43 44int 45lsquic_frame_writer_flush (struct lsquic_frame_writer *); 46 47int 48lsquic_frame_writer_write_headers (struct lsquic_frame_writer *, 49 lsquic_stream_id_t stream_id, 50 const struct lsquic_http_headers *, 51 int eos, unsigned weight); 52 53int 54lsquic_frame_writer_write_settings (struct lsquic_frame_writer *, 55 const struct lsquic_http2_setting *, unsigned n_settings); 56 57int 58lsquic_frame_writer_write_priority (struct lsquic_frame_writer *, 59 lsquic_stream_id_t stream_id, int exclusive, 60 lsquic_stream_id_t stream_dep_id, unsigned priority); 61 62int 63lsquic_frame_writer_write_promise (struct lsquic_frame_writer *, 64 lsquic_stream_id_t stream_id, lsquic_stream_id_t promised_stream_id, 65 const struct iovec *path, const struct iovec *host, 66 const struct lsquic_http_headers *headers); 67 68void 69lsquic_frame_writer_max_header_list_size (struct lsquic_frame_writer *, 70 uint32_t max_size); 71 72size_t 73lsquic_frame_writer_mem_used (const struct lsquic_frame_writer *); 74 75#endif 76