X-Git-Url: https://jfr.im/git/irc/rqf/shadowircd.git/blobdiff_plain/b37021a45e15eef2e937aa11f185b48cf766d772..e71a453543ae342bae011c3e4df790555d0e5744:/include/hash.h diff --git a/include/hash.h b/include/hash.h index 38319f0..6dc2d4e 100644 --- a/include/hash.h +++ b/include/hash.h @@ -27,16 +27,14 @@ #ifndef INCLUDED_hash_h #define INCLUDED_hash_h -#include "tools.h" - struct Dictionary; -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 rb_dlink_list *clientTable; +extern rb_dlink_list *channelTable; +extern rb_dlink_list *idTable; +extern rb_dlink_list *resvTable; +extern rb_dlink_list *hostTable; +extern rb_dlink_list *helpTable; extern struct Dictionary *nd_dict; @@ -44,24 +42,27 @@ extern struct Dictionary *nd_dict; #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 fd hash table size, used in hash.c */ +#define CLI_FD_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; @@ -93,16 +94,16 @@ 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); +void add_to_cli_fd_hash(struct Client *client_p); +void del_from_cli_fd_hash(struct Client *client_p); +struct Client *find_cli_fd_hash(int fd); extern void hash_stats(struct Client *);