This commit was generated by cvs2svn to compensate for changes in r2,
[ircu2.10.12-pk.git] / include / hash.h
1 /*
2  * IRC - Internet Relay Chat, include/hash.h 
3  * Copyright (C) 1998 by Andrea "Nemesi" Cocito
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 1, or (at your option)
8  * any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */
19
20 #ifndef HASH_H
21 #define HASH_H
22
23 #include "s_serv.h"             /* For STAT_* values and StatusMask() macro */
24
25 /*=============================================================================
26  * general defines
27  */
28
29 /* Now client and channel hash table must be of the same size */
30 #define HASHSIZE                32000
31
32 /*=============================================================================
33  * Structures
34  */
35
36 /*=============================================================================
37  * Macros for internal use
38  */
39
40 /*=============================================================================
41  * Externally visible pseudofunctions (macro interface to internal functions)
42  */
43
44 /* Raw calls, expect a core if you pass a NULL or zero-length name */
45 #define SeekChannel(name)       hSeekChannel((name))
46 #define SeekClient(name)        hSeekClient((name), ~StatusMask(STAT_PING))
47 #define SeekUser(name)          hSeekClient((name), StatusMask(STAT_USER))
48 #define SeekServer(name)        hSeekClient((name), StatusMask(STAT_ME) | \
49                                                     StatusMask(STAT_SERVER) )
50
51 /* Safer macros with sanity check on name, WARNING: these are _macros_,
52    no side effects allowed on <name> ! */
53 #define FindChannel(name)       (BadPtr((name))?NULL:SeekChannel(name))
54 #define FindClient(name)        (BadPtr((name))?NULL:SeekClient(name))
55 #define FindUser(name)          (BadPtr((name))?NULL:SeekUser(name))
56 #define FindServer(name)        (BadPtr((name))?NULL:SeekServer(name))
57
58 /*=============================================================================
59  * Proto types
60  */
61
62 extern void hash_init(void);    /* Call me on startup */
63 extern int hAddClient(aClient *cptr);
64 extern int hAddChannel(aChannel *chptr);
65 extern int hRemClient(aClient *cptr);
66 extern int hChangeClient(aClient *cptr, char *newname);
67 extern int hRemChannel(aChannel *chptr);
68 extern aClient *hSeekClient(char *name, int TMask);
69 extern aChannel *hSeekChannel(char *name);
70
71 extern int m_hash(aClient *cptr, aClient *sptr, int parc, char *parv[]);
72
73 extern int isNickJuped(char *nick);
74 extern int addNickJupes(char *nicks);
75 extern void clearNickJupes(void);
76
77 #endif /* HASH_H */