]> jfr.im git - solanum.git/blobdiff - include/hash.h
ircd/authproc.c: avoid crash on lack of any configured DNSBLs
[solanum.git] / include / hash.h
index 84d9f99bad7e8953f758e3423796471af93ec4f5..88bf7a54e83c1b2ac346ccbddfb3740bf4d14b92 100644 (file)
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
  *  USA
- *
- *  $Id: hash.h 3177 2007-02-01 00:19:14Z jilles $
  */
 
 #ifndef INCLUDED_hash_h
 #define INCLUDED_hash_h
 
-#include "tools.h"
+#include "rb_dictionary.h"
+#include "rb_radixtree.h"
 
-extern dlink_list *clientTable;
-extern dlink_list *channelTable;
-extern dlink_list *idTable;
-extern dlink_list *resvTable;
-extern dlink_list *hostTable;
-extern dlink_list *helpTable;
-extern dlink_list *ndTable;
+extern rb_dictionary *nd_dict;
+extern rb_radixtree *resv_tree;
+extern rb_radixtree *channel_tree;
 
 /* Magic value for FNV hash functions */
 #define FNV1_32_INIT 0x811c9dc5UL
 
 /* Client hash table size, used in hash.c/s_debug.c */
-#define U_MAX_BITS (32-17)
+#define U_MAX_BITS 17
 #define U_MAX 131072 /* 2^17 */
 
+/* Client connid hash table size, used in hash.c */
+#define CLI_CONNID_MAX 4096
+
 /* Channel hash table size, hash.c/s_debug.c */
-#define CH_MAX_BITS (32-16)
+#define CH_MAX_BITS 16
 #define CH_MAX 65536 /* 2^16 */
 
 /* hostname hash table size */
-#define HOST_MAX_BITS (32-17)
+#define HOST_MAX_BITS 17
 #define HOST_MAX 131072 /* 2^17 */
 
 /* RESV/XLINE hash table size, used in hash.c */
-#define R_MAX_BITS (32-10)
+#define R_MAX_BITS 10
 #define R_MAX 1024 /* 2^10 */
 
 
-#define HASH_WALK(i, max, ptr, table) for (i = 0; i < max; i++) { DLINK_FOREACH(ptr, table[i].head)
-#define HASH_WALK_SAFE(i, max, ptr, nptr, table) for (i = 0; i < max; i++) { DLINK_FOREACH_SAFE(ptr, nptr, table[i].head)
+#define HASH_WALK(i, max, ptr, table) for (i = 0; i < max; i++) { RB_DLINK_FOREACH(ptr, table[i].head)
+#define HASH_WALK_SAFE(i, max, ptr, nptr, table) for (i = 0; i < max; i++) { RB_DLINK_FOREACH_SAFE(ptr, nptr, table[i].head)
 #define HASH_WALK_END }
 
 struct Client;
@@ -67,10 +65,10 @@ struct ConfItem;
 struct cachefile;
 struct nd_entry;
 
-extern u_int32_t fnv_hash_upper(const unsigned char *s, int bits);
-extern u_int32_t fnv_hash(const unsigned char *s, int bits);
-extern u_int32_t fnv_hash_len(const unsigned char *s, int bits, int len);
-extern u_int32_t fnv_hash_upper_len(const unsigned char *s, int bits, int len);
+extern uint32_t fnv_hash_upper(const unsigned char *s, int bits);
+extern uint32_t fnv_hash(const unsigned char *s, int bits);
+extern uint32_t fnv_hash_len(const unsigned char *s, int bits, int len);
+extern uint32_t fnv_hash_upper_len(const unsigned char *s, int bits, int len);
 
 extern void init_hash(void);
 
@@ -84,26 +82,21 @@ extern void add_to_id_hash(const char *, struct Client *);
 extern void del_from_id_hash(const char *name, struct Client *client);
 extern struct Client *find_id(const char *name);
 
-extern struct Channel *get_or_create_channel(struct Client *client_p, const char *chname, int *isnew);
+extern struct Channel *get_or_create_channel(struct Client *client_p, const char *chname, bool *isnew);
 extern void del_from_channel_hash(const char *name, struct Channel *chan);
 extern struct Channel *find_channel(const char *name);
 
 extern void add_to_hostname_hash(const char *, struct Client *);
 extern void del_from_hostname_hash(const char *, struct Client *);
-extern dlink_node *find_hostname(const char *);
+extern rb_dlink_node *find_hostname(const char *);
 
 extern void add_to_resv_hash(const char *name, struct ConfItem *aconf);
 extern void del_from_resv_hash(const char *name, struct ConfItem *aconf);
 extern struct ConfItem *hash_find_resv(const char *name);
 extern void clear_resv_hash(void);
 
-extern void add_to_help_hash(const char *name, struct cachefile *hptr);
-extern void clear_help_hash(void);
-extern struct cachefile *hash_find_help(const char *name, int flags);
-
-extern void add_to_nd_hash(const char *name, struct nd_entry *nd);
-extern struct nd_entry *hash_find_nd(const char *name);
-
-extern void hash_stats(struct Client *);
+void add_to_cli_connid_hash(struct Client *client_p, uint32_t id);
+void del_from_cli_connid_hash(uint32_t id);
+struct Client *find_cli_connid_hash(uint32_t connid);
 
 #endif /* INCLUDED_hash_h */