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