1 /*************************************************
2 * Exim - an Internet mail transport agent *
3 *************************************************/
5 /* Copyright (c) The Exim Maintainers 2022 */
6 /* Copyright (c) University of Cambridge 1995 - 2015 */
7 /* See the file NOTICE for conditions of use and distribution. */
8 /* SPDX-License-Identifier: GPL-2.0-or-later */
11 /* The "type" field in each item is a set of bit flags:
13 lookup_querystyle => this is a query-style lookup,
14 else single-key (+ file) style
15 lookup_absfile => an absolute file name is required,
16 (for single-key style only)
19 typedef struct lookup_info {
20 uschar *name; /* e.g. "lsearch" */
21 int type; /* query/singlekey/abs-file */
22 unsigned acq_num; /* acquisition number */
23 void *(*open)( /* open function */
24 const uschar *, /* file name for those that have one */
25 uschar **); /* for error message */
26 BOOL (*check)( /* file checking function */
28 const uschar *, /* file name */
29 int, /* modemask for file checking */
30 uid_t *, /* owners for file checking */
31 gid_t *, /* owngroups for file checking */
32 uschar **); /* for error messages */
33 int (*find)( /* find function */
35 const uschar *, /* file name or NULL */
36 const uschar *, /* key or query */
37 int, /* length of key or query */
38 uschar **, /* for returning answer */
39 uschar **, /* for error message */
40 uint *, /* cache TTL, seconds */
41 const uschar *); /* options */
42 void (*close)( /* close function */
44 void (*tidy)(void); /* tidy function */
45 uschar *(*quote)( /* quoting function */
46 uschar *, /* string to quote */
47 uschar *, /* additional data from quote name */
48 unsigned); /* lookup type index */
49 gstring * (*version_report)( /* diagnostic function */
50 gstring *); /* string to appand to */
53 /* This magic number is used by the following lookup_module_info structure
54 for checking API compatibility. It used to be equivalent to the string"LMM3" */
55 #define LOOKUP_MODULE_INFO_MAGIC 0x4c4d4935
56 /* Version 2 adds: version_report */
57 /* Version 3 change: non/cache becomes TTL in seconds */
58 /* Version 4 add: index on quoting function */
59 /* Version 5 change: version report now adds to a gstring */
61 typedef struct lookup_module_info {
63 lookup_info **lookups;
67 /* End of lookupapi.h */