1/* Copyright (c) 2017 - 2022 LiteSpeed Technologies Inc.  See LICENSE. */
2/*
3 * lsquic_spi.h - SPI: Stream Priority Iterator
4 *
5 * Changing a stream's priority when the stream is in the iterator
6 * does not change the stream's position in the iterator.
7 */
8
9#ifndef LSQUIC_SPI
10#define LSQUIC_SPI 1
11
12
13struct stream_prio_iter
14{
15    const struct lsquic_conn       *spi_conn;           /* Used for logging */
16    const char                     *spi_name;           /* Used for logging */
17    uint64_t                        spi_set[4];         /* 256 bits */
18    unsigned                        spi_n_added;
19    unsigned char                   spi_cur_prio;
20    struct lsquic_stream           *spi_next_stream;
21    struct lsquic_streams_tailq     spi_streams[256];
22};
23
24
25void
26lsquic_spi_init (void *, struct lsquic_stream *first,
27         struct lsquic_stream *last, uintptr_t next_ptr_offset,
28         struct lsquic_conn_public *,
29         const char *name,
30         int (*filter)(void *filter_ctx, struct lsquic_stream *),
31         void *filter_ctx);
32
33struct lsquic_stream *
34lsquic_spi_first (void *);
35
36struct lsquic_stream *
37lsquic_spi_next (void *);
38
39void
40lsquic_spi_drop_non_high (void *);
41
42void
43lsquic_spi_drop_high (void *);
44
45void
46lsquic_spi_cleanup (void *);
47
48#endif
49