cc4c4f6552abfa6a60291e0b240b922a2c2bd49c
[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-or-later */
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 void     dbfn_close_multi(open_db *);
17 int      dbfn_delete(open_db *, const uschar *);
18 open_db *dbfn_open(const uschar *, int, open_db *, BOOL, BOOL);
19 open_db *dbfn_open_multi(const uschar *, open_db *);
20 void    *dbfn_read_with_length(open_db *, const uschar *, int *);
21 void    *dbfn_read_enforce_length(open_db *, const uschar *, size_t);
22 uschar  *dbfn_scan(open_db *, BOOL, EXIM_CURSOR **);
23 int      dbfn_write(open_db *, const uschar *, void *, int);
24 BOOL     dbfn_transaction_start(open_db *);
25 void     dbfn_transaction_commit(open_db *);
26
27 /* Macro for the common call to read without wanting to know the length. */
28
29 #define  dbfn_read(a, b) dbfn_read_with_length(a, b, NULL)
30
31 /* Berkeley DB uses a callback function to pass back error details. Its API
32 changed at release 4.3. */
33
34 #if defined(USE_DB) && defined(DB_VERSION_STRING)
35 # if DB_VERSION_MAJOR > 4 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 3)
36 void     dbfn_bdb_error_callback(const DB_ENV *, const char *, const char *);
37 # else
38 void     dbfn_bdb_error_callback(const char *, char *);
39 # endif
40 #endif
41
42 #endif
43 /* End of dbfunctions.h */