lsquic_headers_stream.h revision 50aadb33
150aadb33SDmitri Tikhonov/* Copyright (c) 2017 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;
1950aadb33SDmitri Tikhonovstruct lsquic_engine_settings;
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 *
4150aadb33SDmitri Tikhonovlsquic_headers_stream_new (int is_server, struct lsquic_mm *,
4250aadb33SDmitri Tikhonov                           const struct lsquic_engine_settings *,
4350aadb33SDmitri Tikhonov                           const struct headers_stream_callbacks *,
4450aadb33SDmitri Tikhonov                           void *hs_cb_ctx);
4550aadb33SDmitri Tikhonov
4650aadb33SDmitri Tikhonovvoid
4750aadb33SDmitri Tikhonovlsquic_headers_stream_destroy (struct headers_stream *);
4850aadb33SDmitri Tikhonov
4950aadb33SDmitri Tikhonovint
5050aadb33SDmitri Tikhonovlsquic_headers_stream_send_headers (struct headers_stream *hs,
5150aadb33SDmitri Tikhonov                                uint32_t stream_id,
5250aadb33SDmitri Tikhonov                                const struct lsquic_http_headers *, int eos,
5350aadb33SDmitri Tikhonov                                unsigned weight);
5450aadb33SDmitri Tikhonov
5550aadb33SDmitri Tikhonovint
5650aadb33SDmitri Tikhonovlsquic_headers_stream_push_promise (struct headers_stream *hs,
5750aadb33SDmitri Tikhonov                        uint32_t stream_id, uint32_t promised_stream_id,
5850aadb33SDmitri Tikhonov                        const struct iovec *path, const struct iovec *host,
5950aadb33SDmitri Tikhonov                        const struct lsquic_http_headers *);
6050aadb33SDmitri Tikhonov
6150aadb33SDmitri Tikhonovint
6250aadb33SDmitri Tikhonovlsquic_headers_stream_send_priority (struct headers_stream *hs,
6350aadb33SDmitri Tikhonov    uint32_t stream_id, int exclusive, uint32_t dep_stream_id, unsigned weight);
6450aadb33SDmitri Tikhonov
6550aadb33SDmitri Tikhonovint
6650aadb33SDmitri Tikhonovlsquic_headers_stream_send_settings (struct headers_stream *hs,
6750aadb33SDmitri Tikhonov                        const struct lsquic_http2_setting *, unsigned count);
6850aadb33SDmitri Tikhonov
6950aadb33SDmitri Tikhonovextern const struct lsquic_stream_if *const lsquic_headers_stream_if;
7050aadb33SDmitri Tikhonov
7150aadb33SDmitri Tikhonov#endif
72