lsquic_headers_stream.h revision 3b55e6ae
110c492f0SDmitri Tikhonov/* Copyright (c) 2017 - 2018 LiteSpeed Technologies Inc.  See LICENSE. */
250aadb33SDmitri Tikhonov/*
350aadb33SDmitri Tikhonov * lsquic_headers_stream.h -- HEADERS stream interface
450aadb33SDmitri Tikhonov */
550aadb33SDmitri Tikhonov
650aadb33SDmitri Tikhonov#ifndef LSQUIC_HEADERS_STREAM_H
750aadb33SDmitri Tikhonov#define LSQUIC_HEADERS_STREAM_H 1
850aadb33SDmitri Tikhonov
950aadb33SDmitri Tikhonov#include <stdint.h>
1050aadb33SDmitri Tikhonov
1150aadb33SDmitri Tikhonovstruct iovec;
1250aadb33SDmitri Tikhonovstruct lsquic_stream_if;
1350aadb33SDmitri Tikhonovstruct lsquic_stream;
1450aadb33SDmitri Tikhonovstruct lsquic_mm;
1550aadb33SDmitri Tikhonovstruct lsquic_http_headers;
1650aadb33SDmitri Tikhonovstruct lsquic_frame_reader;
1750aadb33SDmitri Tikhonovstruct lsquic_frame_writer;
1850aadb33SDmitri Tikhonovstruct uncompressed_headers;
193b55e6aeSDmitri Tikhonovstruct lsquic_engine_public;
2050aadb33SDmitri Tikhonovstruct lsquic_http2_setting;
2150aadb33SDmitri Tikhonov
2250aadb33SDmitri Tikhonov
2350aadb33SDmitri Tikhonov/* Incoming frames result in new objects or events.  Callbacks in this
2450aadb33SDmitri Tikhonov * struct are used to dispatch them.
2550aadb33SDmitri Tikhonov */
2650aadb33SDmitri Tikhonovstruct headers_stream_callbacks
2750aadb33SDmitri Tikhonov{
2850aadb33SDmitri Tikhonov    void (*hsc_on_headers)
2950aadb33SDmitri Tikhonov                    (void *frame_cb_ctx, struct uncompressed_headers *);
3050aadb33SDmitri Tikhonov    void (*hsc_on_enable_push)  (void *hs_cb_ctx, int enable_push);
3150aadb33SDmitri Tikhonov    void (*hsc_on_push_promise)
3250aadb33SDmitri Tikhonov                    (void *frame_cb_ctx, struct uncompressed_headers *);
3350aadb33SDmitri Tikhonov    void (*hsc_on_priority)     (void *hs_cb_ctx, uint32_t stream_id,
3450aadb33SDmitri Tikhonov                    int exclusive, uint32_t dep_stream_id, unsigned weight);
3550aadb33SDmitri Tikhonov    void (*hsc_on_stream_error) (void *hs_cb_ctx, uint32_t stream_id);
3650aadb33SDmitri Tikhonov    void (*hsc_on_conn_error)   (void *hs_cb_ctx);
3750aadb33SDmitri Tikhonov};
3850aadb33SDmitri Tikhonov
3950aadb33SDmitri Tikhonov
4050aadb33SDmitri Tikhonovstruct headers_stream *
413b55e6aeSDmitri Tikhonovlsquic_headers_stream_new (int is_server, struct lsquic_engine_public *,
4250aadb33SDmitri Tikhonov                           const struct headers_stream_callbacks *,
4350aadb33SDmitri Tikhonov                           void *hs_cb_ctx);
4450aadb33SDmitri Tikhonov
4550aadb33SDmitri Tikhonovvoid
4650aadb33SDmitri Tikhonovlsquic_headers_stream_destroy (struct headers_stream *);
4750aadb33SDmitri Tikhonov
4850aadb33SDmitri Tikhonovint
4950aadb33SDmitri Tikhonovlsquic_headers_stream_send_headers (struct headers_stream *hs,
5050aadb33SDmitri Tikhonov                                uint32_t stream_id,
5150aadb33SDmitri Tikhonov                                const struct lsquic_http_headers *, int eos,
5250aadb33SDmitri Tikhonov                                unsigned weight);
5350aadb33SDmitri Tikhonov
5450aadb33SDmitri Tikhonovint
5550aadb33SDmitri Tikhonovlsquic_headers_stream_push_promise (struct headers_stream *hs,
5650aadb33SDmitri Tikhonov                        uint32_t stream_id, uint32_t promised_stream_id,
5750aadb33SDmitri Tikhonov                        const struct iovec *path, const struct iovec *host,
5850aadb33SDmitri Tikhonov                        const struct lsquic_http_headers *);
5950aadb33SDmitri Tikhonov
6050aadb33SDmitri Tikhonovint
6150aadb33SDmitri Tikhonovlsquic_headers_stream_send_priority (struct headers_stream *hs,
6250aadb33SDmitri Tikhonov    uint32_t stream_id, int exclusive, uint32_t dep_stream_id, unsigned weight);
6350aadb33SDmitri Tikhonov
6450aadb33SDmitri Tikhonovint
6550aadb33SDmitri Tikhonovlsquic_headers_stream_send_settings (struct headers_stream *hs,
6650aadb33SDmitri Tikhonov                        const struct lsquic_http2_setting *, unsigned count);
6750aadb33SDmitri Tikhonov
68c51ce338SDmitri Tikhonovstruct lsquic_stream *
69c51ce338SDmitri Tikhonovlsquic_headers_stream_get_stream (const struct headers_stream *);
70c51ce338SDmitri Tikhonov
71c51ce338SDmitri Tikhonovsize_t
72c51ce338SDmitri Tikhonovlsquic_headers_stream_mem_used (const struct headers_stream *);
73c51ce338SDmitri Tikhonov
7450aadb33SDmitri Tikhonovextern const struct lsquic_stream_if *const lsquic_headers_stream_if;
7550aadb33SDmitri Tikhonov
7650aadb33SDmitri Tikhonov#endif
77