lsquic_headers_stream.h revision 5392f7a3
1229fce07SDmitri Tikhonov/* Copyright (c) 2017 - 2019 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; 2119f667fbSDmitri Tikhonov#if LSQUIC_CONN_STATS 2219f667fbSDmitri Tikhonovstruct conn_stats; 2319f667fbSDmitri Tikhonov#endif 2450aadb33SDmitri Tikhonov 2550aadb33SDmitri Tikhonov 2650aadb33SDmitri Tikhonov/* Incoming frames result in new objects or events. Callbacks in this 2750aadb33SDmitri Tikhonov * struct are used to dispatch them. 2850aadb33SDmitri Tikhonov */ 2950aadb33SDmitri Tikhonovstruct headers_stream_callbacks 3050aadb33SDmitri Tikhonov{ 3150aadb33SDmitri Tikhonov void (*hsc_on_headers) 3250aadb33SDmitri Tikhonov (void *frame_cb_ctx, struct uncompressed_headers *); 3350aadb33SDmitri Tikhonov void (*hsc_on_enable_push) (void *hs_cb_ctx, int enable_push); 3450aadb33SDmitri Tikhonov void (*hsc_on_push_promise) 3550aadb33SDmitri Tikhonov (void *frame_cb_ctx, struct uncompressed_headers *); 365392f7a3SLiteSpeed Tech void (*hsc_on_priority) (void *hs_cb_ctx, lsquic_stream_id_t stream_id, 375392f7a3SLiteSpeed Tech int exclusive, lsquic_stream_id_t dep_stream_id, unsigned weight); 385392f7a3SLiteSpeed Tech void (*hsc_on_stream_error) (void *hs_cb_ctx, lsquic_stream_id_t stream_id); 3950aadb33SDmitri Tikhonov void (*hsc_on_conn_error) (void *hs_cb_ctx); 4050aadb33SDmitri Tikhonov}; 4150aadb33SDmitri Tikhonov 4250aadb33SDmitri Tikhonov 4350aadb33SDmitri Tikhonovstruct headers_stream * 443b55e6aeSDmitri Tikhonovlsquic_headers_stream_new (int is_server, struct lsquic_engine_public *, 4550aadb33SDmitri Tikhonov const struct headers_stream_callbacks *, 4619f667fbSDmitri Tikhonov#if LSQUIC_CONN_STATS 4719f667fbSDmitri Tikhonov struct conn_stats *, 4819f667fbSDmitri Tikhonov#endif 4950aadb33SDmitri Tikhonov void *hs_cb_ctx); 5050aadb33SDmitri Tikhonov 5150aadb33SDmitri Tikhonovvoid 5250aadb33SDmitri Tikhonovlsquic_headers_stream_destroy (struct headers_stream *); 5350aadb33SDmitri Tikhonov 5450aadb33SDmitri Tikhonovint 5550aadb33SDmitri Tikhonovlsquic_headers_stream_send_headers (struct headers_stream *hs, 565392f7a3SLiteSpeed Tech lsquic_stream_id_t stream_id, 5750aadb33SDmitri Tikhonov const struct lsquic_http_headers *, int eos, 5850aadb33SDmitri Tikhonov unsigned weight); 5950aadb33SDmitri Tikhonov 6050aadb33SDmitri Tikhonovint 6150aadb33SDmitri Tikhonovlsquic_headers_stream_push_promise (struct headers_stream *hs, 625392f7a3SLiteSpeed Tech lsquic_stream_id_t stream_id, lsquic_stream_id_t promised_stream_id, 6350aadb33SDmitri Tikhonov const struct iovec *path, const struct iovec *host, 6450aadb33SDmitri Tikhonov const struct lsquic_http_headers *); 6550aadb33SDmitri Tikhonov 6650aadb33SDmitri Tikhonovint 6750aadb33SDmitri Tikhonovlsquic_headers_stream_send_priority (struct headers_stream *hs, 685392f7a3SLiteSpeed Tech lsquic_stream_id_t stream_id, int exclusive, 695392f7a3SLiteSpeed Tech lsquic_stream_id_t dep_stream_id, unsigned weight); 7050aadb33SDmitri Tikhonov 7150aadb33SDmitri Tikhonovint 7250aadb33SDmitri Tikhonovlsquic_headers_stream_send_settings (struct headers_stream *hs, 7350aadb33SDmitri Tikhonov const struct lsquic_http2_setting *, unsigned count); 7450aadb33SDmitri Tikhonov 75c51ce338SDmitri Tikhonovstruct lsquic_stream * 76c51ce338SDmitri Tikhonovlsquic_headers_stream_get_stream (const struct headers_stream *); 77c51ce338SDmitri Tikhonov 78c51ce338SDmitri Tikhonovsize_t 79c51ce338SDmitri Tikhonovlsquic_headers_stream_mem_used (const struct headers_stream *); 80c51ce338SDmitri Tikhonov 8150aadb33SDmitri Tikhonovextern const struct lsquic_stream_if *const lsquic_headers_stream_if; 8250aadb33SDmitri Tikhonov 8350aadb33SDmitri Tikhonov#endif 84