1 /* $NetBSD: binhash.h,v 1.1.1.1 2009/06/23 10:08:59 tron Exp $ */ 2 3 #ifndef _BINHASH_H_INCLUDED_ 4 #define _BINHASH_H_INCLUDED_ 5 6 /*++ 7 /* NAME 8 /* binhash 3h 9 /* SUMMARY 10 /* hash table manager 11 /* SYNOPSIS 12 /* #include <binhash.h> 13 /* DESCRIPTION 14 /* .nf 15 16 /* Structure of one hash table entry. */ 17 18 typedef struct BINHASH_INFO { 19 char *key; /* lookup key */ 20 int key_len; /* key length */ 21 char *value; /* associated value */ 22 struct BINHASH_INFO *next; /* colliding entry */ 23 struct BINHASH_INFO *prev; /* colliding entry */ 24 } BINHASH_INFO; 25 26 /* Structure of one hash table. */ 27 28 typedef struct BINHASH { 29 int size; /* length of entries array */ 30 int used; /* number of entries in table */ 31 BINHASH_INFO **data; /* entries array, auto-resized */ 32 } BINHASH; 33 34 extern BINHASH *binhash_create(int); 35 extern BINHASH_INFO *binhash_enter(BINHASH *, const char *, int, char *); 36 extern BINHASH_INFO *binhash_locate(BINHASH *, const char *, int); 37 extern char *binhash_find(BINHASH *, const char *, int); 38 extern void binhash_delete(BINHASH *, const char *, int, void (*) (char *)); 39 extern void binhash_free(BINHASH *, void (*) (char *)); 40 extern void binhash_walk(BINHASH *, void (*) (BINHASH_INFO *, char *), char *); 41 extern BINHASH_INFO **binhash_list(BINHASH *); 42 43 /* LICENSE 44 /* .ad 45 /* .fi 46 /* The Secure Mailer license must be distributed with this software. 47 /* AUTHOR(S) 48 /* Wietse Venema 49 /* IBM T.J. Watson Research 50 /* P.O. Box 704 51 /* Yorktown Heights, NY 10598, USA 52 /* CREATION DATE 53 /* Thu Feb 20 16:54:29 EST 1997 54 /* LAST MODIFICATION 55 /* %E% %U% 56 /* VERSION/RELEASE 57 /* %I% 58 /*--*/ 59 60 #endif 61