From 0fdcdde6c83511871cebff698a1fe1f930347335 Mon Sep 17 00:00:00 2001 From: Max Romanov Date: Fri, 23 Jun 2017 19:19:41 +0300 Subject: lvlhash for ports moved to separate files for future re-use. --- src/nxt_port_hash.h | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/nxt_port_hash.h (limited to 'src/nxt_port_hash.h') 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 + + +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_ */ -- cgit