lsquic_spi.h revision 19f667fb
1229fce07SDmitri Tikhonov/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */ 250aadb33SDmitri Tikhonov/* 350aadb33SDmitri Tikhonov * lsquic_spi.h - SPI: Stream Priority Iterator 450aadb33SDmitri Tikhonov * 550aadb33SDmitri Tikhonov * SPI purposefully does not support switching stream priorities while 650aadb33SDmitri Tikhonov * iterator is active, because this puts iteration termination outside 750aadb33SDmitri Tikhonov * of our control. One can imagine (admittedly theoretical) scenario 850aadb33SDmitri Tikhonov * in which the user keeps on switching stream priorities around and 950aadb33SDmitri Tikhonov * causing an infinite loop. 1050aadb33SDmitri Tikhonov */ 1150aadb33SDmitri Tikhonov 1250aadb33SDmitri Tikhonov#ifndef LSQUIC_SPI 1350aadb33SDmitri Tikhonov#define LSQUIC_SPI 1 1450aadb33SDmitri Tikhonov 1550aadb33SDmitri Tikhonov#include <stdint.h> 1650aadb33SDmitri Tikhonov 1750aadb33SDmitri Tikhonov 1850aadb33SDmitri Tikhonovstruct stream_prio_iter 1950aadb33SDmitri Tikhonov{ 2050aadb33SDmitri Tikhonov lsquic_cid_t spi_cid; /* Used for logging */ 2150aadb33SDmitri Tikhonov const char *spi_name; /* Used for logging */ 2250aadb33SDmitri Tikhonov uint64_t spi_set[4]; /* 256 bits */ 2350aadb33SDmitri Tikhonov enum stream_flags spi_onlist_mask; 2450aadb33SDmitri Tikhonov unsigned char spi_cur_prio; 2550aadb33SDmitri Tikhonov unsigned char spi_prev_prio; 2650aadb33SDmitri Tikhonov struct lsquic_stream *spi_prev_stream, 2750aadb33SDmitri Tikhonov *spi_next_stream; 2850aadb33SDmitri Tikhonov struct lsquic_streams_tailq spi_streams[256]; 2950aadb33SDmitri Tikhonov}; 3050aadb33SDmitri Tikhonov 3150aadb33SDmitri Tikhonov 3250aadb33SDmitri Tikhonovvoid 33c51ce338SDmitri Tikhonovlsquic_spi_init (struct stream_prio_iter *, struct lsquic_stream *first, 3450aadb33SDmitri Tikhonov struct lsquic_stream *last, uintptr_t next_ptr_offset, 3519f667fbSDmitri Tikhonov unsigned onlist_mask, lsquic_cid_t cid, const char *name, 3619f667fbSDmitri Tikhonov int (*filter)(void *filter_ctx, struct lsquic_stream *), 3719f667fbSDmitri Tikhonov void *filter_ctx); 3850aadb33SDmitri Tikhonov 3950aadb33SDmitri Tikhonovstruct lsquic_stream * 4050aadb33SDmitri Tikhonovlsquic_spi_first (struct stream_prio_iter *); 4150aadb33SDmitri Tikhonov 4250aadb33SDmitri Tikhonovstruct lsquic_stream * 4350aadb33SDmitri Tikhonovlsquic_spi_next (struct stream_prio_iter *); 4450aadb33SDmitri Tikhonov 4550aadb33SDmitri Tikhonovvoid 4650aadb33SDmitri Tikhonovlsquic_spi_exhaust_on (struct stream_prio_iter *); 4750aadb33SDmitri Tikhonov 48c51ce338SDmitri Tikhonovvoid 49c51ce338SDmitri Tikhonovlsquic_spi_drop_non_high (struct stream_prio_iter *); 50c51ce338SDmitri Tikhonov 51c51ce338SDmitri Tikhonovvoid 52c51ce338SDmitri Tikhonovlsquic_spi_drop_high (struct stream_prio_iter *); 53c51ce338SDmitri Tikhonov 5450aadb33SDmitri Tikhonov#endif 55