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 */ 25 typedef struct MKMAP { 26 DICT_OPEN_FN open; /* 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 33 extern MKMAP *mkmap_open(const char *, const char *, int, int); 34 extern void mkmap_append(MKMAP *, const char *, const char *); 35 extern void mkmap_close(MKMAP *); 36 37 #define mkmap_append(map, key, val) dict_put((map)->dict, (key), (val)) 38 39 extern MKMAP *mkmap_dbm_open(const char *); 40 extern MKMAP *mkmap_cdb_open(const char *); 41 extern MKMAP *mkmap_hash_open(const char *); 42 extern MKMAP *mkmap_btree_open(const char *); 43 extern MKMAP *mkmap_lmdb_open(const char *); 44 extern MKMAP *mkmap_sdbm_open(const char *); 45 extern MKMAP *mkmap_proxy_open(const char *); 46 extern MKMAP *mkmap_fail_open(const char *); 47 48 typedef MKMAP *(*MKMAP_OPEN_FN) (const char *); 49 typedef MKMAP_OPEN_FN (*MKMAP_OPEN_EXTEND_FN) (const char *); 50 extern void mkmap_open_register(const char *, MKMAP_OPEN_FN); 51 extern MKMAP_OPEN_EXTEND_FN mkmap_open_extend(MKMAP_OPEN_EXTEND_FN); 52 53 /* LICENSE 54 /* .ad 55 /* .fi 56 /* The Secure Mailer license must be distributed with this software. 57 /* AUTHOR(S) 58 /* Wietse Venema 59 /* IBM T.J. Watson Research 60 /* P.O. Box 704 61 /* Yorktown Heights, NY 10598, USA 62 /*--*/ 63 64 #endif 65