lsquic_headers_stream.h revision c51ce338
1/* Copyright (c) 2017 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_settings; 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_mm *, 42 const struct lsquic_engine_settings *, 43 const struct headers_stream_callbacks *, 44 void *hs_cb_ctx); 45 46void 47lsquic_headers_stream_destroy (struct headers_stream *); 48 49int 50lsquic_headers_stream_send_headers (struct headers_stream *hs, 51 uint32_t stream_id, 52 const struct lsquic_http_headers *, int eos, 53 unsigned weight); 54 55int 56lsquic_headers_stream_push_promise (struct headers_stream *hs, 57 uint32_t stream_id, uint32_t promised_stream_id, 58 const struct iovec *path, const struct iovec *host, 59 const struct lsquic_http_headers *); 60 61int 62lsquic_headers_stream_send_priority (struct headers_stream *hs, 63 uint32_t stream_id, int exclusive, uint32_t dep_stream_id, unsigned weight); 64 65int 66lsquic_headers_stream_send_settings (struct headers_stream *hs, 67 const struct lsquic_http2_setting *, unsigned count); 68 69struct lsquic_stream * 70lsquic_headers_stream_get_stream (const struct headers_stream *); 71 72size_t 73lsquic_headers_stream_mem_used (const struct headers_stream *); 74 75extern const struct lsquic_stream_if *const lsquic_headers_stream_if; 76 77#endif 78