diff --git a/include/haproxy/hpack-tbl.h b/include/haproxy/hpack-tbl.h index a75ab068c..02cf7db54 100644 --- a/include/haproxy/hpack-tbl.h +++ b/include/haproxy/hpack-tbl.h @@ -49,8 +49,13 @@ extern const struct http_hdr hpack_sht[HPACK_SHT_SIZE]; extern struct pool_head *pool_head_hpack_tbl; -extern int __hpack_dht_make_room(struct hpack_dht *dht, unsigned int needed); -extern int hpack_dht_insert(struct hpack_dht *dht, struct ist name, struct ist value); +int __hpack_dht_make_room(struct hpack_dht *dht, unsigned int needed); +int hpack_dht_insert(struct hpack_dht *dht, struct ist name, struct ist value); + +#ifdef DEBUG_HPACK +void hpack_dht_dump(FILE *out, const struct hpack_dht *dht); +void hpack_dht_check_consistency(const struct hpack_dht *dht); +#endif /* return a pointer to the entry designated by index (starting at 1) or * NULL if this index is not there. @@ -126,6 +131,14 @@ static inline struct ist hpack_idx_to_value(const struct hpack_dht *dht, uint32_ return hpack_get_value(dht, dte); } +/* returns the slot number of the oldest entry (tail). Must not be used on an + * empty table. + */ +static inline unsigned int hpack_dht_get_tail(const struct hpack_dht *dht) +{ + return ((dht->head + 1U < dht->used) ? dht->wrap : 0) + dht->head + 1U - dht->used; +} + /* Purges table dht until a header field of bytes fits according to * the protocol (adding 32 bytes overhead). Returns non-zero on success, zero * on failure (ie: table empty but still not sufficient). diff --git a/src/hpack-tbl.c b/src/hpack-tbl.c index ac6408c2c..e7c3d33ec 100644 --- a/src/hpack-tbl.c +++ b/src/hpack-tbl.c @@ -101,17 +101,9 @@ const struct http_hdr hpack_sht[HPACK_SHT_SIZE] = { struct pool_head *pool_head_hpack_tbl = NULL; -/* returns the slot number of the oldest entry (tail). Must not be used on an - * empty table. - */ -static inline unsigned int hpack_dht_get_tail(const struct hpack_dht *dht) -{ - return ((dht->head + 1U < dht->used) ? dht->wrap : 0) + dht->head + 1U - dht->used; -} - #ifdef DEBUG_HPACK /* dump the whole dynamic header table */ -static void hpack_dht_dump(FILE *out, const struct hpack_dht *dht) +void hpack_dht_dump(FILE *out, const struct hpack_dht *dht) { unsigned int i; unsigned int slot; @@ -128,7 +120,7 @@ static void hpack_dht_dump(FILE *out, const struct hpack_dht *dht) } /* check for the whole dynamic header table consistency, abort on failures */ -static void hpack_dht_check_consistency(const struct hpack_dht *dht) +void hpack_dht_check_consistency(const struct hpack_dht *dht) { unsigned slot = hpack_dht_get_tail(dht); unsigned used2 = dht->used;