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