lsquic_frame_writer.h revision 50aadb33
1/* Copyright (c) 2017 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 lsquic_henc;
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);
21typedef size_t  (*fw_wavail_f)(const struct lsquic_stream *stream);
22typedef int     (*fw_flush_f)(struct lsquic_stream *);
23
24struct lsquic_frame_writer *
25lsquic_frame_writer_new (struct lsquic_mm *, struct lsquic_stream *,
26                         unsigned max_frame_sz, struct lsquic_henc *,
27                         fw_write_f, fw_wavail_f, fw_flush_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
63#endif
64