lsquic_hash.h revision 229fce07
1229fce07SDmitri Tikhonov/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc.  See LICENSE. */
250aadb33SDmitri Tikhonov/*
350aadb33SDmitri Tikhonov * lsquic_hash.c -- A generic hash
450aadb33SDmitri Tikhonov */
550aadb33SDmitri Tikhonov
650aadb33SDmitri Tikhonov#ifndef LSQUIC_HASH_H
750aadb33SDmitri Tikhonov#define LSQUIC_HASH_H
850aadb33SDmitri Tikhonov
950aadb33SDmitri Tikhonovstruct lsquic_hash;
1050aadb33SDmitri Tikhonovstruct lsquic_hash_elem;
1150aadb33SDmitri Tikhonov
1250aadb33SDmitri Tikhonovstruct lsquic_hash *
1350aadb33SDmitri Tikhonovlsquic_hash_create (void);
1450aadb33SDmitri Tikhonov
1550aadb33SDmitri Tikhonovvoid
1650aadb33SDmitri Tikhonovlsquic_hash_destroy (struct lsquic_hash *);
1750aadb33SDmitri Tikhonov
1850aadb33SDmitri Tikhonovstruct lsquic_hash_elem *
1950aadb33SDmitri Tikhonovlsquic_hash_insert (struct lsquic_hash *, const void *key, unsigned key_sz,
2050aadb33SDmitri Tikhonov                                                                void *data);
2150aadb33SDmitri Tikhonov
2250aadb33SDmitri Tikhonovstruct lsquic_hash_elem *
2350aadb33SDmitri Tikhonovlsquic_hash_find (struct lsquic_hash *, const void *key, unsigned key_sz);
2450aadb33SDmitri Tikhonov
2550aadb33SDmitri Tikhonovvoid *
2650aadb33SDmitri Tikhonovlsquic_hashelem_getdata (const struct lsquic_hash_elem *);
2750aadb33SDmitri Tikhonov
2850aadb33SDmitri Tikhonovvoid
2950aadb33SDmitri Tikhonovlsquic_hash_erase (struct lsquic_hash *, struct lsquic_hash_elem *);
3050aadb33SDmitri Tikhonov
3150aadb33SDmitri Tikhonovvoid
3250aadb33SDmitri Tikhonovlsquic_hash_reset_iter (struct lsquic_hash *);
3350aadb33SDmitri Tikhonov
3450aadb33SDmitri Tikhonovstruct lsquic_hash_elem *
3550aadb33SDmitri Tikhonovlsquic_hash_first (struct lsquic_hash *);
3650aadb33SDmitri Tikhonov
3750aadb33SDmitri Tikhonovstruct lsquic_hash_elem *
3850aadb33SDmitri Tikhonovlsquic_hash_next (struct lsquic_hash *);
3950aadb33SDmitri Tikhonov
4050aadb33SDmitri Tikhonovunsigned
4150aadb33SDmitri Tikhonovlsquic_hash_count (struct lsquic_hash *);
4250aadb33SDmitri Tikhonov
43c51ce338SDmitri Tikhonovsize_t
44c51ce338SDmitri Tikhonovlsquic_hash_mem_used (const struct lsquic_hash *);
4550aadb33SDmitri Tikhonov#endif
46