00001 /* $Id: hash.h,v 1.1.1.1 2003/07/04 02:53:45 Mysid Exp $ */ 00002 00003 /* 00004 * Copyright (c) 1996-1997 Chip Norkus 00005 * Copyright (c) 1997 Max Byrd 00006 * Copyright (c) 1997 Greg Poma 00007 * All rights reserved. 00008 * 00009 * Redistribution and use in source and binary forms, with or without 00010 * modification, are permitted provided that the following conditions 00011 * are met: 00012 * 1. Redistributions of source code must retain the above copyright 00013 * notice, this list of conditions and the following disclaimer. 00014 * 2. Redistributions in binary form must reproduce the above copyright 00015 * notice, this list of conditions and the following disclaimer in the 00016 * documentation and/or other materials provided with the distribution. 00017 * 3. Neither the name of the authors nor the names of its contributors 00018 * may be used to endorse or promote products derived from this software 00019 * without specific prior written permission. 00020 * 00021 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND 00022 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00023 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00024 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE 00025 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00026 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 00027 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00028 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00029 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 00030 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00031 * SUCH DAMAGE. 00032 */ 00033 00039 #ifndef __HASH_H 00040 #define __HASH_H 00041 #include "chanserv.h" 00042 #include "nickserv.h" 00043 #include "clone.h" 00044 #include "queue.h" 00045 00046 /* 00047 * in this I use hash tables for nicks and channels, speed up searching 00048 * and the like... 00049 */ 00050 00051 /* 00052 * nickname hash entry 00053 */ 00054 LIST_HEAD(_nickhashent, _regnicklist); 00055 00059 typedef struct _nickhashent RegNickHashEnt; 00060 00061 /* 00062 * nickname id number hash 00063 */ 00064 LIST_HEAD(RegNickIdHashEnt, RegNickIdMap); 00065 00066 /* 00067 * Channel trigger hash 00068 */ 00069 LIST_HEAD(ChanTrigHashEnt, _ChanTrigInfo); 00070 00071 /* 00072 * user hash entry 00073 */ 00074 LIST_HEAD(_userhashent, _userlist); 00075 00079 typedef struct _userhashent UserHashEnt; 00080 00084 typedef struct chanhashent { 00085 ChanList *chan; 00086 ChanList *lastchan; 00087 } ChanHashEnt; 00088 00092 typedef struct regchanhashent { 00093 RegChanList *chan; 00094 RegChanList *lastchan; 00095 } RegChanHashEnt; 00096 00100 typedef struct clonehashent { 00101 HostClone *clone; 00102 HostClone *lastclone; 00103 } CloneHashEnt; 00104 00105 u_int16_t getHashKey(const char *); 00106 00107 extern UserHashEnt UserHash[NICKHASHSIZE]; 00108 extern RegNickHashEnt RegNickHash[NICKHASHSIZE]; 00109 extern RegNickIdHashEnt RegNickIdHash[IDHASHSIZE]; 00110 extern ChanHashEnt ChanHash[CHANHASHSIZE]; 00111 extern RegChanHashEnt RegChanHash[CHANHASHSIZE]; 00112 extern CloneHashEnt CloneHash[CLONEHASHSIZE]; 00113 extern ChanTrigHashEnt ChanTrigHash[CHANTRIGHASHSIZE]; 00114 00115 #endif /* __HASH_H */