xref: /netbsd-src/external/ibm-public/postfix/dist/src/util/mkmap.h (revision c48c605c14fd8622b523d1d6a3f0c0bad133ea89)
1 /*	$NetBSD: mkmap.h,v 1.2 2023/12/23 20:30:46 christos Exp $	*/
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   * We try to open and lock a file before DB/DBM initialization. However, if
18   * the file does not exist then we may have to acquire the lock after the
19   * DB/DBM initialization.
20   */
21 typedef struct MKMAP {
22     struct DICT *(*open) (const char *, int, int);	/* dict_xx_open() */
23     struct DICT *dict;			/* dict_xx_open() result */
24     void    (*after_open) (struct MKMAP *);	/* may be null */
25     void    (*after_close) (struct MKMAP *);	/* may be null */
26     int     multi_writer;		/* multi-writer safe */
27 } MKMAP;
28 
29 extern MKMAP *mkmap_open(const char *, const char *, int, int);
30 extern void mkmap_close(MKMAP *);
31 
32 #define mkmap_append(map, key, val) dict_put((map)->dict, (key), (val))
33 
34 typedef MKMAP *(*MKMAP_OPEN_FN) (const char *);
35 
36 /* LICENSE
37 /* .ad
38 /* .fi
39 /*	The Secure Mailer license must be distributed with this software.
40 /* AUTHOR(S)
41 /*	Wietse Venema
42 /*	IBM T.J. Watson Research
43 /*	P.O. Box 704
44 /*	Yorktown Heights, NY 10598, USA
45 /*
46 /*	Wietse Venema
47 /*	Google, Inc.
48 /*	111 8th Avenue
49 /*	New York, NY 10011, USA
50 /*--*/
51 
52 #endif
53