1 /* $Cambridge: exim/src/src/lookups/whoson.c,v 1.5 2009/11/16 19:50:38 nm4 Exp $ */
3 /*************************************************
4 * Exim - an Internet mail transport agent *
5 *************************************************/
7 /* Copyright (c) University of Cambridge 1995 - 2009 */
8 /* See the file NOTICE for conditions of use and distribution. */
10 /* This code originally came from Robert Wal. */
15 #include <whoson.h> /* Public header */
18 /*************************************************
20 *************************************************/
22 /* See local README for interface description. */
25 whoson_open(uschar *filename, uschar **errmsg)
27 filename = filename; /* Keep picky compilers happy */
29 return (void *)(1); /* Just return something non-null */
33 /*************************************************
35 *************************************************/
37 /* See local README for interface description. */
40 whoson_find(void *handle, uschar *filename, uschar *query, int length,
41 uschar **result, uschar **errmsg, BOOL *do_cache)
44 handle = handle; /* Keep picky compilers happy */
50 switch (wso_query(query, CS buffer, sizeof(buffer)))
53 *result = string_copy(buffer); /* IP in database; return name of user */
57 return FAIL; /* IP not in database */
60 *errmsg = string_sprintf("WHOSON: failed to complete: %s", buffer);
67 /*************************************************
68 * Version reporting entry point *
69 *************************************************/
71 /* See local README for interface description. */
73 #include "../version.h"
76 whoson_version_report(FILE *f)
78 fprintf(f, "Library version: Whoson: Runtime: %s\n", wso_version());
80 fprintf(f, " Exim version %s\n", EXIM_VERSION_STR);
84 static lookup_info _lookup_info = {
85 US"whoson", /* lookup name */
86 lookup_querystyle, /* query-style lookup */
87 whoson_open, /* open function */
88 NULL, /* check function */
89 whoson_find, /* find function */
90 NULL, /* no close function */
91 NULL, /* no tidy function */
92 NULL, /* no quoting function */
93 whoson_version_report /* version reporting */
97 #define whoson_lookup_module_info _lookup_module_info
100 static lookup_info *_lookup_list[] = { &_lookup_info };
101 lookup_module_info whoson_lookup_module_info = { LOOKUP_MODULE_INFO_MAGIC, _lookup_list, 1 };
103 /* End of lookups/whoson.c */