xref: /netbsd-src/external/ibm-public/postfix/dist/src/util/mkmap.h (revision c48c605c14fd8622b523d1d6a3f0c0bad133ea89)
1*c48c605cSchristos /*	$NetBSD: mkmap.h,v 1.2 2023/12/23 20:30:46 christos Exp $	*/
2059c16a8Schristos 
3059c16a8Schristos #ifndef _MKMAP_H_INCLUDED_
4059c16a8Schristos #define _MKMAP_H_INCLUDED_
5059c16a8Schristos 
6059c16a8Schristos /*++
7059c16a8Schristos /* NAME
8059c16a8Schristos /*	mkmap 3h
9059c16a8Schristos /* SUMMARY
10059c16a8Schristos /*	create or rewrite Postfix database
11059c16a8Schristos /* SYNOPSIS
12059c16a8Schristos /*	#include <mkmap.h>
13059c16a8Schristos /* DESCRIPTION
14059c16a8Schristos /* .nf
15059c16a8Schristos 
16059c16a8Schristos  /*
17059c16a8Schristos   * We try to open and lock a file before DB/DBM initialization. However, if
18059c16a8Schristos   * the file does not exist then we may have to acquire the lock after the
19059c16a8Schristos   * DB/DBM initialization.
20059c16a8Schristos   */
21059c16a8Schristos typedef struct MKMAP {
22059c16a8Schristos     struct DICT *(*open) (const char *, int, int);	/* dict_xx_open() */
23059c16a8Schristos     struct DICT *dict;			/* dict_xx_open() result */
24059c16a8Schristos     void    (*after_open) (struct MKMAP *);	/* may be null */
25059c16a8Schristos     void    (*after_close) (struct MKMAP *);	/* may be null */
26059c16a8Schristos     int     multi_writer;		/* multi-writer safe */
27059c16a8Schristos } MKMAP;
28059c16a8Schristos 
29059c16a8Schristos extern MKMAP *mkmap_open(const char *, const char *, int, int);
30059c16a8Schristos extern void mkmap_close(MKMAP *);
31059c16a8Schristos 
32059c16a8Schristos #define mkmap_append(map, key, val) dict_put((map)->dict, (key), (val))
33059c16a8Schristos 
34059c16a8Schristos typedef MKMAP *(*MKMAP_OPEN_FN) (const char *);
35059c16a8Schristos 
36059c16a8Schristos /* LICENSE
37059c16a8Schristos /* .ad
38059c16a8Schristos /* .fi
39059c16a8Schristos /*	The Secure Mailer license must be distributed with this software.
40059c16a8Schristos /* AUTHOR(S)
41059c16a8Schristos /*	Wietse Venema
42059c16a8Schristos /*	IBM T.J. Watson Research
43059c16a8Schristos /*	P.O. Box 704
44059c16a8Schristos /*	Yorktown Heights, NY 10598, USA
45059c16a8Schristos /*
46059c16a8Schristos /*	Wietse Venema
47059c16a8Schristos /*	Google, Inc.
48059c16a8Schristos /*	111 8th Avenue
49059c16a8Schristos /*	New York, NY 10011, USA
50059c16a8Schristos /*--*/
51059c16a8Schristos 
52059c16a8Schristos #endif
53