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