lsquic_attq.h revision e8bd737d
1/* Copyright (c) 2017 - 2018 LiteSpeed Technologies Inc. See LICENSE. */ 2/* 3 * lsquic_attq.h -- Advisory Tick Time Queue 4 */ 5 6#ifndef LSQUIC_ATTQ_H 7#define LSQUIC_ATTQ_H 8 9struct attq; 10struct lsquic_conn; 11 12 13/* The extra level of indirection is done for speed: swapping heap elements 14 * does not need memory associated with lsquic_conn. 15 */ 16struct attq_elem 17{ 18 struct lsquic_conn *ae_conn; 19 lsquic_time_t ae_adv_time; 20 unsigned ae_heap_idx; 21}; 22 23 24struct attq * 25attq_create (void); 26 27void 28attq_destroy (struct attq *); 29 30/* Return 0 on success, -1 on failure (malloc) */ 31int 32attq_add (struct attq *, struct lsquic_conn *, lsquic_time_t advisory_time); 33 34void 35attq_remove (struct attq *, struct lsquic_conn *); 36 37struct lsquic_conn * 38attq_pop (struct attq *, lsquic_time_t cutoff); 39 40unsigned 41attq_count_before (struct attq *, lsquic_time_t cutoff); 42 43const lsquic_time_t * 44attq_next_time (struct attq *); 45 46#endif 47