1#ifndef _MKMAP_H_INCLUDED_
2#define _MKMAP_H_INCLUDED_
3
4/*++
5/* NAME
6/*	mkmap 3h
7/* SUMMARY
8/*	create or rewrite Postfix database
9/* SYNOPSIS
10/*	#include <mkmap.h>
11/* DESCRIPTION
12/* .nf
13
14 /*
15  * Utility library.
16  */
17#include <dict.h>
18
19 /*
20  * A database handle is an opaque structure. The user is not supposed to
21  * know its implementation. We try to open and lock a file before DB/DBM
22  * initialization. However, if the file does not exist then we may have to
23  * acquire the lock after the DB/DBM initialization.
24  */
25typedef struct MKMAP {
26    struct DICT *(*open) (const char *, int, int);	/* dict_xx_open() */
27    struct DICT *dict;			/* dict_xx_open() result */
28    void    (*after_open) (struct MKMAP *);	/* may be null */
29    void    (*after_close) (struct MKMAP *);	/* may be null */
30    int     multi_writer;			/* multi-writer safe */
31} MKMAP;
32
33extern MKMAP *mkmap_open(const char *, const char *, int, int);
34extern void mkmap_append(MKMAP *, const char *, const char *);
35extern void mkmap_close(MKMAP *);
36
37#define mkmap_append(map, key, val) dict_put((map)->dict, (key), (val))
38
39extern MKMAP *mkmap_dbm_open(const char *);
40extern MKMAP *mkmap_cdb_open(const char *);
41extern MKMAP *mkmap_hash_open(const char *);
42extern MKMAP *mkmap_btree_open(const char *);
43extern MKMAP *mkmap_lmdb_open(const char *);
44extern MKMAP *mkmap_sdbm_open(const char *);
45extern MKMAP *mkmap_proxy_open(const char *);
46extern MKMAP *mkmap_fail_open(const char *);
47
48/* LICENSE
49/* .ad
50/* .fi
51/*	The Secure Mailer license must be distributed with this software.
52/* AUTHOR(S)
53/*	Wietse Venema
54/*	IBM T.J. Watson Research
55/*	P.O. Box 704
56/*	Yorktown Heights, NY 10598, USA
57/*--*/
58
59#endif
60