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