File: hash.h

package info (click to toggle)
ircd-ircu 2.10.12.10.dfsg1-3
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, buster, sid, trixie
  • size: 4,788 kB
  • ctags: 4,787
  • sloc: ansic: 37,491; sh: 3,331; makefile: 1,616; perl: 1,180; yacc: 987; cpp: 429; lex: 199; python: 50
file content (95 lines) | stat: -rw-r--r-- 3,162 bytes parent folder | download | duplicates (4)
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*
 * 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.
 */
/** @file
 * @brief Hash table management APIs.
 * @version $Id: hash.h,v 1.7 2005/03/30 03:48:22 entrope Exp $
 */

#ifndef INCLUDED_hash_h
#define INCLUDED_hash_h

struct Client;
struct Channel;
struct StatDesc;

/*
 * general defines
 */

/** Size of client and channel hash tables.
 * Both 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 */
/** Search for a channel by name. */
#define SeekChannel(name)       hSeekChannel((name))
/** Search for any client by name. */
#define SeekClient(name)        hSeekClient((name), ~0)
/** Search for a registered user by name. */
#define SeekUser(name)          hSeekClient((name), (STAT_USER))
/** Search for a server by name. */
#define SeekServer(name)        hSeekClient((name), (STAT_ME | STAT_SERVER))

/* Safer macros with sanity check on name, WARNING: these are _macros_,
   no side effects allowed on <name> ! */
/** Search for a channel by name. */
#define FindChannel(name)       (BadPtr((name)) ? 0 : SeekChannel(name))
/** Search for any client by name. */
#define FindClient(name)        (BadPtr((name)) ? 0 : SeekClient(name))
/** Search for a registered user by name. */
#define FindUser(name)          (BadPtr((name)) ? 0 : SeekUser(name))
/** Search for a server by name. */
#define FindServer(name)        (BadPtr((name)) ? 0 : SeekServer(name))

/*
 * Proto types
 */

extern void init_hash(void);    /* Call me on startup */
extern int hAddClient(struct Client *cptr);
extern int hAddChannel(struct Channel *chptr);
extern int hRemClient(struct Client *cptr);
extern int hChangeClient(struct Client *cptr, const char *newname);
extern int hRemChannel(struct Channel *chptr);
extern struct Client *hSeekClient(const char *name, int TMask);
extern struct Channel *hSeekChannel(const char *name);

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

extern int isNickJuped(const char *nick);
extern int addNickJupes(const char *nicks);
extern void clearNickJupes(void);
extern void stats_nickjupes(struct Client* to, const struct StatDesc* sd,
			    char* param);
extern void list_next_channels(struct Client *cptr);

#endif /* INCLUDED_hash_h */