1/*	$NetBSD$	*/
2
3#ifndef _MKMAP_H_INCLUDED_
4#define _MKMAP_H_INCLUDED_
5
6/*++
7/* NAME
8/*	mkmap 3h
9/* SUMMARY
10/*	create or rewrite Postfix database
11/* SYNOPSIS
12/*	#include <mkmap.h>
13/* DESCRIPTION
14/* .nf
15
16 /*
17  * Utility library.
18  */
19#include <dict.h>
20
21 /*
22  * A database handle is an opaque structure. The user is not supposed to
23  * know its implementation. We try to open and lock a file before DB/DBM
24  * initialization. However, if the file does not exist then we may have to
25  * acquire the lock after the DB/DBM initialization.
26  */
27typedef struct MKMAP {
28    struct DICT *(*open) (const char *, int, int);	/* dict_xx_open() */
29    struct DICT *dict;			/* dict_xx_open() result */
30    void    (*after_open) (struct MKMAP *);	/* may be null */
31    void    (*after_close) (struct MKMAP *);	/* may be null */
32} MKMAP;
33
34extern MKMAP *mkmap_open(const char *, const char *, int, int);
35extern void mkmap_append(MKMAP *, const char *, const char *);
36extern void mkmap_close(MKMAP *);
37
38#define mkmap_append(map, key, val) dict_put((map)->dict, (key), (val))
39
40extern MKMAP *mkmap_dbm_open(const char *);
41extern MKMAP *mkmap_cdb_open(const char *);
42extern MKMAP *mkmap_hash_open(const char *);
43extern MKMAP *mkmap_btree_open(const char *);
44extern MKMAP *mkmap_sdbm_open(const char *);
45extern MKMAP *mkmap_proxy_open(const char *);
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/*--*/
57
58#endif
59