lsquic_spi.h revision fbc6cc04
17d09751dSDmitri Tikhonov/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc.  See LICENSE. */
250aadb33SDmitri Tikhonov/*
350aadb33SDmitri Tikhonov * lsquic_spi.h - SPI: Stream Priority Iterator
450aadb33SDmitri Tikhonov *
5fbc6cc04SDmitri Tikhonov * Changing a stream's priority when the stream is in the iterator
6fbc6cc04SDmitri Tikhonov * does not change the stream's position in the iterator.
750aadb33SDmitri Tikhonov */
850aadb33SDmitri Tikhonov
950aadb33SDmitri Tikhonov#ifndef LSQUIC_SPI
1050aadb33SDmitri Tikhonov#define LSQUIC_SPI 1
1150aadb33SDmitri Tikhonov
1250aadb33SDmitri Tikhonov
1350aadb33SDmitri Tikhonovstruct stream_prio_iter
1450aadb33SDmitri Tikhonov{
155392f7a3SLiteSpeed Tech    const struct lsquic_conn       *spi_conn;           /* Used for logging */
1650aadb33SDmitri Tikhonov    const char                     *spi_name;           /* Used for logging */
1750aadb33SDmitri Tikhonov    uint64_t                        spi_set[4];         /* 256 bits */
18a0e1aeeeSDmitri Tikhonov    unsigned                        spi_n_added;
1950aadb33SDmitri Tikhonov    unsigned char                   spi_cur_prio;
20cd35ff02SDmitri Tikhonov    struct lsquic_stream           *spi_next_stream;
2150aadb33SDmitri Tikhonov    struct lsquic_streams_tailq     spi_streams[256];
2250aadb33SDmitri Tikhonov};
2350aadb33SDmitri Tikhonov
2450aadb33SDmitri Tikhonov
2550aadb33SDmitri Tikhonovvoid
26fbc6cc04SDmitri Tikhonovlsquic_spi_init (void *, struct lsquic_stream *first,
2750aadb33SDmitri Tikhonov         struct lsquic_stream *last, uintptr_t next_ptr_offset,
28fbc6cc04SDmitri Tikhonov         struct lsquic_conn_public *,
295392f7a3SLiteSpeed Tech         const char *name,
3019f667fbSDmitri Tikhonov         int (*filter)(void *filter_ctx, struct lsquic_stream *),
3119f667fbSDmitri Tikhonov         void *filter_ctx);
3250aadb33SDmitri Tikhonov
3350aadb33SDmitri Tikhonovstruct lsquic_stream *
34fbc6cc04SDmitri Tikhonovlsquic_spi_first (void *);
3550aadb33SDmitri Tikhonov
3650aadb33SDmitri Tikhonovstruct lsquic_stream *
37fbc6cc04SDmitri Tikhonovlsquic_spi_next (void *);
3850aadb33SDmitri Tikhonov
3950aadb33SDmitri Tikhonovvoid
40fbc6cc04SDmitri Tikhonovlsquic_spi_drop_non_high (void *);
4150aadb33SDmitri Tikhonov
42c51ce338SDmitri Tikhonovvoid
43fbc6cc04SDmitri Tikhonovlsquic_spi_drop_high (void *);
44c51ce338SDmitri Tikhonov
45c51ce338SDmitri Tikhonovvoid
46fbc6cc04SDmitri Tikhonovlsquic_spi_cleanup (void *);
47c51ce338SDmitri Tikhonov
4850aadb33SDmitri Tikhonov#endif
49