diff options
author | Max Romanov <max.romanov@nginx.com> | 2017-06-23 19:19:41 +0300 |
---|---|---|
committer | Max Romanov <max.romanov@nginx.com> | 2017-06-23 19:19:41 +0300 |
commit | 0fdcdde6c83511871cebff698a1fe1f930347335 (patch) | |
tree | ba88f51490f6acc2cea81c76c37101c679b6a10e /src/nxt_port_hash.h | |
parent | 58e20da984d395857c3334ce74aa7c99dae84377 (diff) | |
download | unit-0fdcdde6c83511871cebff698a1fe1f930347335.tar.gz unit-0fdcdde6c83511871cebff698a1fe1f930347335.tar.bz2 |
lvlhash for ports moved to separate files for future re-use.
Diffstat (limited to 'src/nxt_port_hash.h')
-rw-r--r-- | src/nxt_port_hash.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/nxt_port_hash.h b/src/nxt_port_hash.h new file mode 100644 index 00000000..57f9ba08 --- /dev/null +++ b/src/nxt_port_hash.h @@ -0,0 +1,42 @@ + +/* + * Copyright (C) Max Romanov + * Copyright (C) NGINX, Inc. + */ + +#ifndef _NXT_PORT_HASH_H_INCLUDED_ +#define _NXT_PORT_HASH_H_INCLUDED_ + + +#include <nxt_main.h> + + +void nxt_port_hash_add(nxt_lvlhsh_t *port_hash, nxt_mp_t *mem_pool, + nxt_port_t *port); + +void nxt_port_hash_remove(nxt_lvlhsh_t *port_hash, nxt_mp_t *mem_pool, + nxt_port_t *port); + +nxt_port_t *nxt_port_hash_find(nxt_lvlhsh_t *port_hash, nxt_pid_t pid, + nxt_port_id_t port_id); + +nxt_port_t *nxt_port_hash_first(nxt_lvlhsh_t *port_hash, + nxt_lvlhsh_each_t *lhe); + +#define nxt_port_hash_next(port_hash, lhe) \ + nxt_lvlhsh_each((port_hash), (lhe)) + +#define nxt_port_hash_each(port_hash, port) \ + do { \ + nxt_lvlhsh_each_t _lhe; \ + \ + for (port = nxt_port_hash_first((port_hash), &_lhe); \ + port != NULL; \ + port = nxt_port_hash_next((port_hash), &_lhe)) { \ + +#define nxt_port_hash_loop \ + } \ + } while(0) + + +#endif /* _NXT_PORT_HASH_H_INCLIDED_ */ |