lsquic_frame_writer.h revision 229fce07
1/* Copyright (c) 2017 - 2019 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#define MAX_HEADERS_SIZE (64 * 1024) 13 14struct iovec; 15struct lshpack_enc; 16struct lsquic_mm; 17struct lsquic_frame_writer; 18struct lsquic_stream; 19struct lsquic_http_headers; 20struct lsquic_http2_setting; 21 22typedef ssize_t (*fw_write_f)(struct lsquic_stream *, const void *, size_t); 23 24struct lsquic_frame_writer * 25lsquic_frame_writer_new (struct lsquic_mm *, struct lsquic_stream *, 26 unsigned max_frame_sz, struct lshpack_enc *, 27 fw_write_f, int is_server); 28 29void 30lsquic_frame_writer_destroy (struct lsquic_frame_writer *); 31 32int 33lsquic_frame_writer_have_leftovers (const struct lsquic_frame_writer *); 34 35int 36lsquic_frame_writer_flush (struct lsquic_frame_writer *); 37 38int 39lsquic_frame_writer_write_headers (struct lsquic_frame_writer *, 40 uint32_t stream_id, 41 const struct lsquic_http_headers *, 42 int eos, unsigned weight); 43 44int 45lsquic_frame_writer_write_settings (struct lsquic_frame_writer *, 46 const struct lsquic_http2_setting *, unsigned n_settings); 47 48int 49lsquic_frame_writer_write_priority (struct lsquic_frame_writer *, 50 uint32_t stream_id, int exclusive, uint32_t stream_dep_id, 51 unsigned priority); 52 53int 54lsquic_frame_writer_write_promise (struct lsquic_frame_writer *, 55 uint32_t stream_id, uint32_t promised_stream_id, 56 const struct iovec *path, const struct iovec *host, 57 const struct lsquic_http_headers *headers); 58 59void 60lsquic_frame_writer_max_header_list_size (struct lsquic_frame_writer *, 61 uint32_t max_size); 62 63size_t 64lsquic_frame_writer_mem_used (const struct lsquic_frame_writer *); 65 66#endif 67