1 
2 /*
3  * Copyright (C) Igor Sysoev
4  * Copyright (C) NGINX, Inc.
5  */
6 
7 #ifndef _NXT_HASH_H_INCLUDED_
8 #define _NXT_HASH_H_INCLUDED_
9 
10 
11 typedef struct {
12     nxt_lvlhsh_t              lvlhsh;
13     const nxt_lvlhsh_proto_t  *proto;
14     void                      *pool;
15 } nxt_hash_t;
16 
17 
18 nxt_inline nxt_int_t
nxt_hash_find(nxt_hash_t * h,nxt_lvlhsh_query_t * lhq)19 nxt_hash_find(nxt_hash_t *h, nxt_lvlhsh_query_t *lhq)
20 {
21     lhq->proto = h->proto;
22 
23     return nxt_lvlhsh_find(&h->lvlhsh, lhq);
24 }
25 
26 
27 nxt_inline nxt_int_t
nxt_hash_insert(nxt_hash_t * h,nxt_lvlhsh_query_t * lhq)28 nxt_hash_insert(nxt_hash_t *h, nxt_lvlhsh_query_t *lhq)
29 {
30     lhq->proto = h->proto;
31     lhq->pool = h->pool;
32 
33     return nxt_lvlhsh_insert(&h->lvlhsh, lhq);
34 }
35 
36 
37 nxt_inline nxt_int_t
nxt_hash_delete(nxt_hash_t * h,nxt_lvlhsh_query_t * lhq)38 nxt_hash_delete(nxt_hash_t *h, nxt_lvlhsh_query_t *lhq)
39 {
40     lhq->proto = h->proto;
41     lhq->pool = h->pool;
42 
43     return nxt_lvlhsh_delete(&h->lvlhsh, lhq);
44 }
45 
46 
47 #endif /* _NXT_HASH_H_INCLUDED_ */
48