File: hash.h

package info (click to toggle)
ircd 2.10.07-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 2,232 kB
  • ctags: 2,253
  • sloc: ansic: 27,541; makefile: 742; sh: 327; perl: 18
file content (77 lines) | stat: -rw-r--r-- 2,895 bytes parent folder | download
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
69
70
71
72
73
74
75
76
77
/*
 * IRC - Internet Relay Chat, include/hash.h 
 * Copyright (C) 1998 by Andrea "Nemesi" Cocito
 *
 * 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 1, 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., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#ifndef HASH_H
#define HASH_H

#include "s_serv.h"		/* For STAT_* values and StatusMask() macro */

/*=============================================================================
 * general defines
 */

/* Now client and channel hash table must be of the same size */
#define HASHSIZE		32000

/*=============================================================================
 * Structures
 */

/*=============================================================================
 * Macros for internal use
 */

/*=============================================================================
 * Externally visible pseudofunctions (macro interface to internal functions)
 */

/* Raw calls, expect a core if you pass a NULL or zero-length name */
#define SeekChannel(name)	hSeekChannel((name))
#define SeekClient(name)	hSeekClient((name), ~StatusMask(STAT_PING))
#define SeekUser(name)   	hSeekClient((name), StatusMask(STAT_USER))
#define SeekServer(name)	hSeekClient((name), StatusMask(STAT_ME) | \
                                                    StatusMask(STAT_SERVER) )

/* Safer macros with sanity check on name, WARNING: these are _macros_,
   no side effects allowed on <name> ! */
#define FindChannel(name)	(BadPtr((name))?NULL:SeekChannel(name))
#define FindClient(name)	(BadPtr((name))?NULL:SeekClient(name))
#define FindUser(name)		(BadPtr((name))?NULL:SeekUser(name))
#define FindServer(name)	(BadPtr((name))?NULL:SeekServer(name))

/*=============================================================================
 * Proto types
 */

extern void hash_init(void);	/* Call me on startup */
extern int hAddClient(aClient *cptr);
extern int hAddChannel(aChannel *chptr);
extern int hRemClient(aClient *cptr);
extern int hChangeClient(aClient *cptr, char *newname);
extern int hRemChannel(aChannel *chptr);
extern aClient *hSeekClient(char *name, int TMask);
extern aChannel *hSeekChannel(char *name);

extern int m_hash(aClient *cptr, aClient *sptr, int parc, char *parv[]);

extern int isNickJuped(char *nick);
extern int addNickJupes(char *nicks);
extern void clearNickJupes(void);

#endif /* HASH_H */