SPDX: license tags (mostly by guesswork)
[exim.git] / src / src / lookupapi.h
index 9c646e6e654948c314ff29e166cbc50cb138c323..cec8f976b5201cb7f74b15676ecee78d0cb2f590 100644 (file)
@@ -2,8 +2,10 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) University of Cambridge 1995 - 2009 */
+/* Copyright (c) The Exim Maintainers 2022 */
+/* Copyright (c) University of Cambridge 1995 - 2015 */
 /* See the file NOTICE for conditions of use and distribution. */
+/* SPDX-License-Identifier: GPL-2.0-only */
 
 
 /* The "type" field in each item is a set of bit flags:
@@ -18,37 +20,42 @@ typedef struct lookup_info {
   uschar *name;                   /* e.g. "lsearch" */
   int type;                       /* query/singlekey/abs-file */
   void *(*open)(                  /* open function */
-    uschar *,                     /* file name for those that have one */
+    const uschar *,               /* file name for those that have one */
     uschar **);                   /* for error message */
   BOOL (*check)(                  /* file checking function */
     void *,                       /* handle */
-    uschar *,                     /* file name */
+    const uschar *,               /* file name */
     int,                          /* modemask for file checking */
     uid_t *,                      /* owners for file checking */
     gid_t *,                      /* owngroups for file checking */
     uschar **);                   /* for error messages */
   int (*find)(                    /* find function */
     void *,                       /* handle */
-    uschar *,                     /* file name or NULL */
+    const uschar *,               /* file name or NULL */
     const uschar *,               /* key or query */
     int,                          /* length of key or query */
     uschar **,                    /* for returning answer */
     uschar **,                    /* for error message */
-    BOOL *);                      /* to request cache cleanup */
+    uint *,                       /* cache TTL, seconds */
+    const uschar *);             /* options */
   void (*close)(                  /* close function */
     void *);                      /* handle */
   void (*tidy)(void);             /* tidy function */
   uschar *(*quote)(               /* quoting function */
     uschar *,                     /* string to quote */
-    uschar *);                    /* additional data from quote name */
-  void (*version_report)(         /* diagnostic function */
-    FILE *);                      /* fh to write to */
+    uschar *,                     /* additional data from quote name */
+    unsigned);                   /* lookup type index */
+  gstring * (*version_report)(    /* diagnostic function */
+    gstring *);                   /* string to appand to */
 } lookup_info;
 
 /* This magic number is used by the following lookup_module_info structure
-   for checking API compatibility. It's equivalent to the string"LMM2" */
-#define LOOKUP_MODULE_INFO_MAGIC 0x4c4d4d32
+   for checking API compatibility. It used to be equivalent to the string"LMM3" */
+#define LOOKUP_MODULE_INFO_MAGIC 0x4c4d4935
 /* Version 2 adds: version_report */
+/* Version 3 change: non/cache becomes TTL in seconds */
+/* Version 4 add: index on quoting function */
+/* Version 5 change: version report now adds to a gstring */
 
 typedef struct lookup_module_info {
   uint magic;