1 |
adx |
30 |
/* |
2 |
michael |
2865 |
* ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd) |
3 |
adx |
30 |
* |
4 |
michael |
8279 |
* Copyright (c) 1997-2018 ircd-hybrid development team |
5 |
adx |
30 |
* |
6 |
|
|
* This program is free software; you can redistribute it and/or modify |
7 |
|
|
* it under the terms of the GNU General Public License as published by |
8 |
|
|
* the Free Software Foundation; either version 2 of the License, or |
9 |
|
|
* (at your option) any later version. |
10 |
|
|
* |
11 |
|
|
* This program is distributed in the hope that it will be useful, |
12 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
|
|
* GNU General Public License for more details. |
15 |
|
|
* |
16 |
|
|
* You should have received a copy of the GNU General Public License |
17 |
|
|
* along with this program; if not, write to the Free Software |
18 |
michael |
4565 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 |
19 |
adx |
30 |
* USA |
20 |
|
|
*/ |
21 |
|
|
|
22 |
michael |
2865 |
/*! \file hash.h |
23 |
|
|
* \brief A header for the ircd hashtable code. |
24 |
|
|
* \version $Id$ |
25 |
|
|
*/ |
26 |
|
|
|
27 |
adx |
30 |
#ifndef INCLUDED_hash_h |
28 |
|
|
#define INCLUDED_hash_h |
29 |
|
|
|
30 |
|
|
#define FNV1_32_INIT 0x811c9dc5 |
31 |
|
|
#define FNV1_32_BITS 16 |
32 |
|
|
#define FNV1_32_SIZE (1 << FNV1_32_BITS) /* 2^16 = 65536 */ |
33 |
|
|
#define HASHSIZE FNV1_32_SIZE |
34 |
|
|
|
35 |
|
|
struct Client; |
36 |
|
|
struct Channel; |
37 |
|
|
|
38 |
michael |
1798 |
enum |
39 |
|
|
{ |
40 |
adx |
30 |
HASH_TYPE_ID, |
41 |
|
|
HASH_TYPE_CLIENT, |
42 |
michael |
8496 |
HASH_TYPE_CHANNEL |
43 |
adx |
30 |
}; |
44 |
|
|
|
45 |
michael |
1798 |
extern void hash_init(void); |
46 |
adx |
30 |
extern void hash_add_client(struct Client *); |
47 |
|
|
extern void hash_del_client(struct Client *); |
48 |
|
|
extern void hash_add_channel(struct Channel *); |
49 |
|
|
extern void hash_del_channel(struct Channel *); |
50 |
|
|
extern void hash_add_id(struct Client *); |
51 |
|
|
extern void hash_del_id(struct Client *); |
52 |
|
|
|
53 |
|
|
extern struct Client *hash_find_id(const char *); |
54 |
michael |
1169 |
extern struct Client *hash_find_client(const char *); |
55 |
|
|
extern struct Client *hash_find_server(const char *); |
56 |
adx |
30 |
extern struct Channel *hash_find_channel(const char *); |
57 |
|
|
extern void *hash_get_bucket(int, unsigned int); |
58 |
|
|
|
59 |
michael |
3289 |
extern void free_list_task(struct Client *); |
60 |
michael |
8656 |
extern void safe_list_channels(struct Client *, bool); |
61 |
adx |
30 |
|
62 |
|
|
extern unsigned int strhash(const char *); |
63 |
|
|
#endif /* INCLUDED_hash_h */ |