lsquic_headers_stream.h revision 229fce07
1/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc.  See LICENSE. */
2/*
3 * lsquic_headers_stream.h -- HEADERS stream interface
4 */
5
6#ifndef LSQUIC_HEADERS_STREAM_H
7#define LSQUIC_HEADERS_STREAM_H 1
8
9#include <stdint.h>
10
11struct iovec;
12struct lsquic_stream_if;
13struct lsquic_stream;
14struct lsquic_mm;
15struct lsquic_http_headers;
16struct lsquic_frame_reader;
17struct lsquic_frame_writer;
18struct uncompressed_headers;
19struct lsquic_engine_public;
20struct lsquic_http2_setting;
21
22
23/* Incoming frames result in new objects or events.  Callbacks in this
24 * struct are used to dispatch them.
25 */
26struct headers_stream_callbacks
27{
28    void (*hsc_on_headers)
29                    (void *frame_cb_ctx, struct uncompressed_headers *);
30    void (*hsc_on_enable_push)  (void *hs_cb_ctx, int enable_push);
31    void (*hsc_on_push_promise)
32                    (void *frame_cb_ctx, struct uncompressed_headers *);
33    void (*hsc_on_priority)     (void *hs_cb_ctx, uint32_t stream_id,
34                    int exclusive, uint32_t dep_stream_id, unsigned weight);
35    void (*hsc_on_stream_error) (void *hs_cb_ctx, uint32_t stream_id);
36    void (*hsc_on_conn_error)   (void *hs_cb_ctx);
37};
38
39
40struct headers_stream *
41lsquic_headers_stream_new (int is_server, struct lsquic_engine_public *,
42                           const struct headers_stream_callbacks *,
43                           void *hs_cb_ctx);
44
45void
46lsquic_headers_stream_destroy (struct headers_stream *);
47
48int
49lsquic_headers_stream_send_headers (struct headers_stream *hs,
50                                uint32_t stream_id,
51                                const struct lsquic_http_headers *, int eos,
52                                unsigned weight);
53
54int
55lsquic_headers_stream_push_promise (struct headers_stream *hs,
56                        uint32_t stream_id, uint32_t promised_stream_id,
57                        const struct iovec *path, const struct iovec *host,
58                        const struct lsquic_http_headers *);
59
60int
61lsquic_headers_stream_send_priority (struct headers_stream *hs,
62    uint32_t stream_id, int exclusive, uint32_t dep_stream_id, unsigned weight);
63
64int
65lsquic_headers_stream_send_settings (struct headers_stream *hs,
66                        const struct lsquic_http2_setting *, unsigned count);
67
68struct lsquic_stream *
69lsquic_headers_stream_get_stream (const struct headers_stream *);
70
71size_t
72lsquic_headers_stream_mem_used (const struct headers_stream *);
73
74extern const struct lsquic_stream_if *const lsquic_headers_stream_if;
75
76#endif
77