strhash.h revision 04bdb234571448ed6194e1d4048e6512f2446f1c
d6fa26d0adaec6c910115be34fe7a5a5f402c14fMark Andrews/* $Id: strhash.h,v 1.9 2000/08/02 02:06:40 ishisone Exp $ */
32098293b78922a5fbd10906afa28624820d3756Tinderbox User * Copyright (c) 2000 Japan Network Information Center. All rights reserved.
5347c0fcb04eaea19d9f39795646239f487c6207Tinderbox User * By using this file, you agree to the terms and conditions set forth bellow.
5347c0fcb04eaea19d9f39795646239f487c6207Tinderbox User * LICENSE TERMS AND CONDITIONS
d6fa26d0adaec6c910115be34fe7a5a5f402c14fMark Andrews * The following License Terms and Conditions apply, unless a different
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * license is obtained from Japan Network Information Center ("JPNIC"),
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * a Japanese association, Fuundo Bldg., 1-2 Kanda Ogawamachi, Chiyoda-ku,
cd32f419a8a5432fbb139f56ee73cbf68b9350ccTinderbox User * Tokyo, Japan.
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt * 1. Use, Modification and Redistribution (including distribution of any
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * modified or derived work) in source and/or binary forms is permitted
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * under this License Terms and Conditions.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * 2. Redistribution of source code must retain the copyright notices as they
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * appear in each source code file, this License Terms and Conditions.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * 3. Redistribution in binary form must reproduce the Copyright Notice,
cd32f419a8a5432fbb139f56ee73cbf68b9350ccTinderbox User * this License Terms and Conditions, in the documentation and/or other
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * materials provided with the distribution. For the purposes of binary
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * distribution the "Copyright Notice" refers to the following language:
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * "Copyright (c) Japan Network Information Center. All rights reserved."
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * 4. Neither the name of JPNIC may be used to endorse or promote products
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * derived from this Software without specific prior written approval of
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
38a5df33f461f2379639ef95d282d3658f68ed04Tinderbox User * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox User * 6. Indemnification by Licensee
a1ff871f78b7d907d6fc3a382beea2a640fe8423Tinderbox User * Any person or entities using and/or redistributing this Software under
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt * this License Terms and Conditions shall defend indemnify and hold
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt * harmless JPNIC from and against any and all judgements damages,
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt * expenses, settlement liabilities, cost and other liabilities of any
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt * kind as a result of use and redistribution of this Software or any
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt * claim, suite, action, litigation or proceeding by any third party
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt * arising out of or relates to this License Terms and Conditions.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * 7. Governing Law, Jurisdiction and Venue
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User * This License Terms and Conditions shall be governed by and and
f9ce6280cec79deb16ff6d9807aa493ff23e10d9Tinderbox User * construed in accordance with the law of Japan. Any person or entities
38a5df33f461f2379639ef95d282d3658f68ed04Tinderbox User * using and/or redistributing this Software under this License Terms and
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User * Conditions hereby agrees and consent to the personal and exclusive
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User * jurisdiction and venue of Tokyo District Court of Japan.
0da02c26a6631c25f075a8e4ac6de9e58f49a0c2Tinderbox User * String-keyed hash table
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User * Just a hash table. Nothing special. Number of hash buckets
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User * grows automatically.
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User * Hash table type, which is opaque.
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User * Hash value free proc.
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox Usertypedef void (*mdn_strhash_freeproc_t)(void *value);
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox User * Create a hash table.
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox User * mdn_success -- ok.
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox User * mdn_nomemory -- malloc failed.
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox User * Delete a hash table created by 'mdn_strhash_create'.
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox User * If 'proc' is not NULL, it is called for each value in the
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox User * hash to release memory for them.
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox Usermdn_strhash_destroy(mdn_strhash_t hash, mdn_strhash_freeproc_t proc);
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox User * Register an item to the hash table. This function makes a
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox User * private copy of the key string.
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox User * mdn_success -- ok.
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox User * mdn_nomemory -- malloc failed.
33c9436ef1a43d3c0fc3d9be9b4b0509daa83223Tinderbox Usermdn_strhash_put(mdn_strhash_t hash, const char *key, void *value);
a1ff871f78b7d907d6fc3a382beea2a640fe8423Tinderbox User * Find an item with the specified key.
8a48b6b9b6fa8486f24b22d1972b2b6ebb36a4a4Tinderbox User * mdn_success -- ok. found.
0da02c26a6631c25f075a8e4ac6de9e58f49a0c2Tinderbox User * mdn_noentry -- not found.
8a48b6b9b6fa8486f24b22d1972b2b6ebb36a4a4Tinderbox Usermdn_strhash_get(mdn_strhash_t hash, const char *key, void **valuep);
8a48b6b9b6fa8486f24b22d1972b2b6ebb36a4a4Tinderbox User * Check if an item with the specified key exists.
8a48b6b9b6fa8486f24b22d1972b2b6ebb36a4a4Tinderbox Usermdn_strhash_exists(mdn_strhash_t hash, const char *key);
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User#endif /* MDN_STRHASH_H */