1 /* 2 * Copyright (C) 2001-2003 FhG Fokus 3 * 4 * This file is part of Kamailio, a free SIP server. 5 * 6 * Kamailio is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version 10 * 11 * Kamailio is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 */ 20 /*! 21 * \file 22 * \brief Kamailio core :: Hash support 23 * \ingroup core 24 * Module: \ref core 25 */ 26 27 28 29 #ifndef _HASH_FUNC_H_ 30 #define _HASH_FUNC_H_ 31 32 #include "str.h" 33 #include "hashes.h" 34 35 /* always use a power of 2 for hash table size */ 36 #define T_TABLE_POWER 16 37 #define TABLE_ENTRIES (1 << (T_TABLE_POWER)) 38 39 unsigned int new_hash( str call_id, str cseq_nr ); 40 41 #define new_hash2(call_id, cseq_nr) \ 42 (get_hash2_raw(&(call_id), &(cseq_nr)) & (TABLE_ENTRIES-1)) 43 44 45 #define hash( cid, cseq) new_hash2( cid, cseq ) 46 47 #endif 48