lsquic_headers_stream.h revision 7d09751d
1/* Copyright (c) 2017 - 2020 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#if LSQUIC_CONN_STATS 22struct conn_stats; 23#endif 24 25 26/* Incoming frames result in new objects or events. Callbacks in this 27 * struct are used to dispatch them. 28 */ 29struct headers_stream_callbacks 30{ 31 void (*hsc_on_headers) 32 (void *frame_cb_ctx, struct uncompressed_headers *); 33 void (*hsc_on_enable_push) (void *hs_cb_ctx, int enable_push); 34 void (*hsc_on_push_promise) 35 (void *frame_cb_ctx, struct uncompressed_headers *); 36 void (*hsc_on_priority) (void *hs_cb_ctx, lsquic_stream_id_t stream_id, 37 int exclusive, lsquic_stream_id_t dep_stream_id, unsigned weight); 38 void (*hsc_on_stream_error) (void *hs_cb_ctx, lsquic_stream_id_t stream_id); 39 void (*hsc_on_conn_error) (void *hs_cb_ctx); 40}; 41 42 43struct headers_stream * 44lsquic_headers_stream_new (int is_server, struct lsquic_engine_public *, 45 const struct headers_stream_callbacks *, 46#if LSQUIC_CONN_STATS 47 struct conn_stats *, 48#endif 49 void *hs_cb_ctx); 50 51void 52lsquic_headers_stream_destroy (struct headers_stream *); 53 54int 55lsquic_headers_stream_send_headers (struct headers_stream *hs, 56 lsquic_stream_id_t stream_id, 57 const struct lsquic_http_headers *, int eos, 58 unsigned weight); 59 60int 61lsquic_headers_stream_push_promise (struct headers_stream *hs, 62 lsquic_stream_id_t stream_id, lsquic_stream_id_t promised_stream_id, 63 const struct iovec *path, const struct iovec *host, 64 const struct lsquic_http_headers *); 65 66int 67lsquic_headers_stream_send_priority (struct headers_stream *hs, 68 lsquic_stream_id_t stream_id, int exclusive, 69 lsquic_stream_id_t dep_stream_id, unsigned weight); 70 71int 72lsquic_headers_stream_send_settings (struct headers_stream *hs, 73 const struct lsquic_http2_setting *, unsigned count); 74 75struct lsquic_stream * 76lsquic_headers_stream_get_stream (const struct headers_stream *); 77 78size_t 79lsquic_headers_stream_mem_used (const struct headers_stream *); 80 81extern const struct lsquic_stream_if *const lsquic_headers_stream_if; 82 83#endif 84