xref: /unit/src/nxt_port_hash.h (revision 75:63205c12a84b)
1 
2 /*
3  * Copyright (C) Max Romanov
4  * Copyright (C) NGINX, Inc.
5  */
6 
7 #ifndef _NXT_PORT_HASH_H_INCLUDED_
8 #define _NXT_PORT_HASH_H_INCLUDED_
9 
10 
11 #include <nxt_main.h>
12 
13 
14 void nxt_port_hash_add(nxt_lvlhsh_t *port_hash, nxt_mp_t *mem_pool,
15     nxt_port_t *port);
16 
17 void nxt_port_hash_remove(nxt_lvlhsh_t *port_hash, nxt_mp_t *mem_pool,
18     nxt_port_t *port);
19 
20 nxt_port_t *nxt_port_hash_find(nxt_lvlhsh_t *port_hash, nxt_pid_t pid,
21     nxt_port_id_t port_id);
22 
23 nxt_port_t *nxt_port_hash_first(nxt_lvlhsh_t *port_hash,
24     nxt_lvlhsh_each_t *lhe);
25 
26 #define nxt_port_hash_next(port_hash, lhe)                                    \
27     nxt_lvlhsh_each((port_hash), (lhe))
28 
29 #define nxt_port_hash_each(port_hash, port)                                   \
30     do {                                                                      \
31         nxt_lvlhsh_each_t  _lhe;                                              \
32                                                                               \
33         for (port = nxt_port_hash_first((port_hash), &_lhe);                  \
34              port != NULL;                                                    \
35              port = nxt_port_hash_next((port_hash), &_lhe)) {                 \
36 
37 #define nxt_port_hash_loop                                                    \
38         }                                                                     \
39     } while(0)
40 
41 
42 #endif /* _NXT_PORT_HASH_H_INCLIDED_ */
43