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-only */
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 void *(*open)( /* open function */
23 const uschar *, /* file name for those that have one */
24 uschar **); /* for error message */
25 BOOL (*check)( /* file checking function */
27 const uschar *, /* file name */
28 int, /* modemask for file checking */
29 uid_t *, /* owners for file checking */
30 gid_t *, /* owngroups for file checking */
31 uschar **); /* for error messages */
32 int (*find)( /* find function */
34 const uschar *, /* file name or NULL */
35 const uschar *, /* key or query */
36 int, /* length of key or query */
37 uschar **, /* for returning answer */
38 uschar **, /* for error message */
39 uint *, /* cache TTL, seconds */
40 const uschar *); /* options */
41 void (*close)( /* close function */
43 void (*tidy)(void); /* tidy function */
44 uschar *(*quote)( /* quoting function */
45 uschar *, /* string to quote */
46 uschar *, /* additional data from quote name */
47 unsigned); /* lookup type index */
48 gstring * (*version_report)( /* diagnostic function */
49 gstring *); /* string to appand to */
52 /* This magic number is used by the following lookup_module_info structure
53 for checking API compatibility. It used to be equivalent to the string"LMM3" */
54 #define LOOKUP_MODULE_INFO_MAGIC 0x4c4d4935
55 /* Version 2 adds: version_report */
56 /* Version 3 change: non/cache becomes TTL in seconds */
57 /* Version 4 add: index on quoting function */
58 /* Version 5 change: version report now adds to a gstring */
60 typedef struct lookup_module_info {
62 lookup_info **lookups;
66 /* End of lookupapi.h */