| 1 |
adx |
30 |
/* |
| 2 |
|
|
* ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd). |
| 3 |
|
|
* hash.h: A header for the ircd hashtable code. |
| 4 |
|
|
* |
| 5 |
|
|
* Copyright (C) 2002 by the past and present ircd coders, and others. |
| 6 |
|
|
* |
| 7 |
|
|
* This program is free software; you can redistribute it and/or modify |
| 8 |
|
|
* it under the terms of the GNU General Public License as published by |
| 9 |
|
|
* the Free Software Foundation; either version 2 of the License, or |
| 10 |
|
|
* (at your option) any later version. |
| 11 |
|
|
* |
| 12 |
|
|
* This program is distributed in the hope that it will be useful, |
| 13 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
|
|
* GNU General Public License for more details. |
| 16 |
|
|
* |
| 17 |
|
|
* You should have received a copy of the GNU General Public License |
| 18 |
|
|
* along with this program; if not, write to the Free Software |
| 19 |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
| 20 |
|
|
* USA |
| 21 |
|
|
* |
| 22 |
knight |
31 |
* $Id$ |
| 23 |
adx |
30 |
*/ |
| 24 |
|
|
|
| 25 |
|
|
#ifndef INCLUDED_hash_h |
| 26 |
|
|
#define INCLUDED_hash_h |
| 27 |
|
|
|
| 28 |
|
|
#define FNV1_32_INIT 0x811c9dc5 |
| 29 |
|
|
#define FNV1_32_BITS 16 |
| 30 |
|
|
#define FNV1_32_SIZE (1 << FNV1_32_BITS) /* 2^16 = 65536 */ |
| 31 |
|
|
#define HASHSIZE FNV1_32_SIZE |
| 32 |
|
|
|
| 33 |
|
|
struct Client; |
| 34 |
|
|
struct Channel; |
| 35 |
|
|
struct ResvChannel; |
| 36 |
|
|
struct UserHost; |
| 37 |
|
|
|
| 38 |
|
|
enum { |
| 39 |
|
|
HASH_TYPE_ID, |
| 40 |
|
|
HASH_TYPE_CLIENT, |
| 41 |
|
|
HASH_TYPE_CHANNEL, |
| 42 |
|
|
HASH_TYPE_USERHOST, |
| 43 |
|
|
HASH_TYPE_RESERVED |
| 44 |
|
|
}; |
| 45 |
|
|
|
| 46 |
|
|
extern void init_hash(void); |
| 47 |
|
|
extern void hash_add_client(struct Client *); |
| 48 |
|
|
extern void hash_del_client(struct Client *); |
| 49 |
|
|
extern void hash_add_channel(struct Channel *); |
| 50 |
|
|
extern void hash_del_channel(struct Channel *); |
| 51 |
|
|
extern void hash_add_resv(struct ResvChannel *); |
| 52 |
|
|
extern void hash_del_resv(struct ResvChannel *); |
| 53 |
|
|
extern void hash_add_id(struct Client *); |
| 54 |
|
|
extern void hash_del_id(struct Client *); |
| 55 |
|
|
extern void hash_add_userhost(struct UserHost *); |
| 56 |
|
|
extern void hash_del_userhost(struct UserHost *); |
| 57 |
|
|
|
| 58 |
|
|
extern struct UserHost *hash_find_userhost(const char *); |
| 59 |
|
|
extern struct Client *hash_find_id(const char *); |
| 60 |
|
|
extern struct Client *find_client(const char *); |
| 61 |
|
|
extern struct Client *find_server(const char *); |
| 62 |
|
|
extern struct Channel *hash_find_channel(const char *); |
| 63 |
|
|
extern void *hash_get_bucket(int, unsigned int); |
| 64 |
|
|
extern struct ResvChannel *hash_find_resv(const char *); |
| 65 |
|
|
|
| 66 |
|
|
extern void free_list_task(struct ListTask *, struct Client *); |
| 67 |
|
|
extern void safe_list_channels(struct Client *, struct ListTask *, int, int); |
| 68 |
|
|
|
| 69 |
|
|
extern unsigned int strhash(const char *); |
| 70 |
|
|
#endif /* INCLUDED_hash_h */ |