]> jfr.im git - irc/quakenet/newserv.git/blob - geoip/libGeoIP/GeoIPUpdate.h
CHANSERV: remove accidental sendemail from SETEMAIL command.
[irc/quakenet/newserv.git] / geoip / libGeoIP / GeoIPUpdate.h
1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
2 /* GeoIP.h
3 *
4 * Copyright (C) 2006 MaxMind LLC
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 #ifndef GEOIPUPDATE_H
22 #define GEOIPUPDATE_H
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 #include <stdarg.h>
29 #include <stdio.h>
30
31 typedef enum {
32 GEOIP_NO_NEW_UPDATES = 1, /* Database up-to-date, no action taken */
33 GEOIP_SUCCESS = 0, /* Success */
34 GEOIP_LICENSE_KEY_INVALID_ERR = -1, /* License Key Invalid */
35 GEOIP_DNS_ERR = -11, /* Unable to resolve hostname */
36 GEOIP_NON_IPV4_ERR = -12, /* Non - IPv4 address */
37 GEOIP_SOCKET_OPEN_ERR = -13, /* Error opening socket */
38 GEOIP_CONNECTION_ERR = -14, /* Unable to connect */
39 GEOIP_GZIP_IO_ERR = -15, /* Unable to write GeoIP.dat.gz file */
40 GEOIP_TEST_IO_ERR = -16, /* Unable to write GeoIP.dat.test file */
41 GEOIP_GZIP_READ_ERR = -17, /* Unable to read gzip data */
42 GEOIP_OUT_OF_MEMORY_ERR = -18, /* Out of memory error */
43 GEOIP_SOCKET_READ_ERR = -19, /* Error reading from socket, see errno */
44 GEOIP_SANITY_OPEN_ERR = -20, /* Sanity check GeoIP_open error */
45 GEOIP_SANITY_INFO_FAIL = -21, /* Sanity check database_info string failed */
46 GEOIP_SANITY_LOOKUP_FAIL = -22, /* Sanity check ip address lookup failed */
47 GEOIP_RENAME_ERR = -23, /* Rename error while installing db, check errno */
48 GEOIP_USER_ID_INVALID_ERR = -24, /* Invalid userID */
49 GEOIP_PRODUCT_ID_INVALID_ERR = -25, /* Invalid product ID or subscription expired */
50 GEOIP_INVALID_SERVER_RESPONSE = -26 /* Server returned invalid response */
51 } GeoIPUpdateCode;
52
53 const char * GeoIP_get_error_message(int i);
54
55 /* Original Update Function, just for MaxMind GeoIP Country database */
56 short int GeoIP_update_database (char * license_key, int verbose, void (*f)( char *));
57
58 /* More generalized update function that works more databases */
59 short int GeoIP_update_database_general (char * user_id, char * license_key,char * data_base_type, int verbose,char ** client_ipaddr, void (*f)( char *));
60
61 /* experimental export */
62 int GeoIP_fprintf(int (*f)(FILE *, char *),FILE *fp, const char *fmt, ...);
63 void GeoIP_printf(void (*f)(char *), const char *fmt, ...);
64
65 #ifdef __cplusplus
66 }
67 #endif
68
69 #endif /* GEOIPUPDATE_H */