lsquic_frame_writer.h revision c51ce338
150aadb33SDmitri Tikhonov/* Copyright (c) 2017 LiteSpeed Technologies Inc.  See LICENSE. */
250aadb33SDmitri Tikhonov/*
350aadb33SDmitri Tikhonov * lsquic_frame_writer.h -- write frames to HEADERS stream.
450aadb33SDmitri Tikhonov */
550aadb33SDmitri Tikhonov
650aadb33SDmitri Tikhonov#ifndef LSQUIC_FRAME_WRITER_H
750aadb33SDmitri Tikhonov#define LSQUIC_FRAME_WRITER_H 1
850aadb33SDmitri Tikhonov
950aadb33SDmitri Tikhonov#include <stddef.h>
1050aadb33SDmitri Tikhonov#include <stdint.h>
1150aadb33SDmitri Tikhonov
1250aadb33SDmitri Tikhonovstruct iovec;
1350aadb33SDmitri Tikhonovstruct lsquic_henc;
1450aadb33SDmitri Tikhonovstruct lsquic_mm;
1550aadb33SDmitri Tikhonovstruct lsquic_frame_writer;
1650aadb33SDmitri Tikhonovstruct lsquic_stream;
1750aadb33SDmitri Tikhonovstruct lsquic_http_headers;
1850aadb33SDmitri Tikhonovstruct lsquic_http2_setting;
1950aadb33SDmitri Tikhonov
2050aadb33SDmitri Tikhonovtypedef ssize_t (*fw_write_f)(struct lsquic_stream *, const void *, size_t);
2150aadb33SDmitri Tikhonov
2250aadb33SDmitri Tikhonovstruct lsquic_frame_writer *
2350aadb33SDmitri Tikhonovlsquic_frame_writer_new (struct lsquic_mm *, struct lsquic_stream *,
2450aadb33SDmitri Tikhonov                         unsigned max_frame_sz, struct lsquic_henc *,
25c51ce338SDmitri Tikhonov                         fw_write_f, int is_server);
2650aadb33SDmitri Tikhonov
2750aadb33SDmitri Tikhonovvoid
2850aadb33SDmitri Tikhonovlsquic_frame_writer_destroy (struct lsquic_frame_writer *);
2950aadb33SDmitri Tikhonov
3050aadb33SDmitri Tikhonovint
3150aadb33SDmitri Tikhonovlsquic_frame_writer_have_leftovers (const struct lsquic_frame_writer *);
3250aadb33SDmitri Tikhonov
3350aadb33SDmitri Tikhonovint
3450aadb33SDmitri Tikhonovlsquic_frame_writer_flush (struct lsquic_frame_writer *);
3550aadb33SDmitri Tikhonov
3650aadb33SDmitri Tikhonovint
3750aadb33SDmitri Tikhonovlsquic_frame_writer_write_headers (struct lsquic_frame_writer *,
3850aadb33SDmitri Tikhonov                                   uint32_t stream_id,
3950aadb33SDmitri Tikhonov                                   const struct lsquic_http_headers *,
4050aadb33SDmitri Tikhonov                                   int eos, unsigned weight);
4150aadb33SDmitri Tikhonov
4250aadb33SDmitri Tikhonovint
4350aadb33SDmitri Tikhonovlsquic_frame_writer_write_settings (struct lsquic_frame_writer *,
4450aadb33SDmitri Tikhonov    const struct lsquic_http2_setting *, unsigned n_settings);
4550aadb33SDmitri Tikhonov
4650aadb33SDmitri Tikhonovint
4750aadb33SDmitri Tikhonovlsquic_frame_writer_write_priority (struct lsquic_frame_writer *,
4850aadb33SDmitri Tikhonov            uint32_t stream_id, int exclusive, uint32_t stream_dep_id,
4950aadb33SDmitri Tikhonov            unsigned priority);
5050aadb33SDmitri Tikhonov
5150aadb33SDmitri Tikhonovint
5250aadb33SDmitri Tikhonovlsquic_frame_writer_write_promise (struct lsquic_frame_writer *,
5350aadb33SDmitri Tikhonov                       uint32_t stream_id, uint32_t promised_stream_id,
5450aadb33SDmitri Tikhonov                       const struct iovec *path, const struct iovec *host,
5550aadb33SDmitri Tikhonov                       const struct lsquic_http_headers *headers);
5650aadb33SDmitri Tikhonov
5750aadb33SDmitri Tikhonovvoid
5850aadb33SDmitri Tikhonovlsquic_frame_writer_max_header_list_size (struct lsquic_frame_writer *,
5950aadb33SDmitri Tikhonov                                          uint32_t max_size);
6050aadb33SDmitri Tikhonov
61c51ce338SDmitri Tikhonovsize_t
62c51ce338SDmitri Tikhonovlsquic_frame_writer_mem_used (const struct lsquic_frame_writer *);
63c51ce338SDmitri Tikhonov
6450aadb33SDmitri Tikhonov#endif
65