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