[insert project logo here (125x200px max)] Navigator Mailinglists Please report any errors or ommissions you find to our `Help' mailinglist, or post a message in the Forums. Copyright and Licensing Information Snap is (c) Jonathan T. Moore, 1999-2002 and licensed under the GNU General Public License (GPL). All other parts of Splash are (c) Willem de Bruijn, 2002-2003 and licensed under the BSD Open Source License. All sourcecode is made publicly available. Acknowledgement Splash and the Splash website are hosted by SourceForge.net |
Splash - DocumentationSNMP Plus a Lightweight API for SNAP Handlingsnap_svc/snap_svc_memmap_hash.hGo to the documentation of this file.00001 /* snap-1.0. Copyright (C) 2000 by Jonathan T. Moore and Michael Hicks. 00002 * 00003 * hashtable.h : basic hash table library, used for managing the 00004 * node-resident service namespace 00005 * 00006 * $Id: snap_svc_memmap_hash.h,v 1.1 2003/04/03 12:42:46 wdebruij Exp $ 00007 */ 00008 #include "snap_svc_memmap_hash_list.h" 00009 00010 typedef struct { 00011 void *key; 00012 void *value; 00013 } pair_t; 00014 00015 typedef struct { 00016 int (*cmp)(const void *,const void *); /* for comparing the keys */ 00017 int (*hash)(void *); /* for hashing the key */ 00018 int max_len; /* max length of bucket list before resize */ 00019 list_t **tab; /* the table: an array of lists of pairs */ 00020 int tab_sz; /* size of the table */ 00021 } hash_table_t; 00022 00023 /* set to 1 when ht_lookup fails */ 00024 int ht_errno; 00025 00026 /* access functions */ 00027 hash_table_t *ht_create(int sz, 00028 int (*cmp)(const void *,const void *), 00029 int (*hash)(void *)); 00030 void ht_insert(hash_table_t *t, void *key, void *val); 00031 void *ht_lookup(hash_table_t *t, void *key); 00032 void ht_remove(hash_table_t * t, void *key); 00033 00034 /* useful for tables indexed by strings */ 00035 int hash_string(char *s); 00036 |