SPDX: license tags (mostly by guesswork)
[exim.git] / src / src / dbfunctions.h
1 /*************************************************
2 *     Exim - an Internet mail transport agent    *
3 *************************************************/
4
5 /* Copyright (c) The Exim Maintainers 2022 */
6 /* Copyright (c) University of Cambridge 1995 - 2021 */
7 /* See the file NOTICE for conditions of use and distribution. */
8 /* SPDX-License-Identifier: GPL-2.0-only */
9
10 #ifndef DBFUNCTIONS_H
11 #define DBFUNCTIONS_H
12
13 /* Functions for reading/writing exim database files */
14
15 void     dbfn_close(open_db *);
16 int      dbfn_delete(open_db *, const uschar *);
17 open_db *dbfn_open(uschar *, int, open_db *, BOOL, BOOL);
18 void    *dbfn_read_with_length(open_db *, const uschar *, int *);
19 void    *dbfn_read_enforce_length(open_db *, const uschar *, size_t);
20 uschar  *dbfn_scan(open_db *, BOOL, EXIM_CURSOR **);
21 int      dbfn_write(open_db *, const uschar *, void *, int);
22
23 /* Macro for the common call to read without wanting to know the length. */
24
25 #define  dbfn_read(a, b) dbfn_read_with_length(a, b, NULL)
26
27 /* Berkeley DB uses a callback function to pass back error details. Its API
28 changed at release 4.3. */
29
30 #if defined(USE_DB) && defined(DB_VERSION_STRING)
31 # if DB_VERSION_MAJOR > 4 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 3)
32 void     dbfn_bdb_error_callback(const DB_ENV *, const char *, const char *);
33 # else
34 void     dbfn_bdb_error_callback(const char *, char *);
35 # endif
36 #endif
37
38 #endif
39 /* End of dbfunctions.h */