File src/dinoex_geoip.c

* by Dirk Meyer (dinoex) * Copyright (C) 2004-2011 Dirk Meyer * * By using this file, you agree to the terms and conditions set * forth in the GNU General Public License. More information is * available in the LICENSE file. * * If you received this file without documentation, it can be * downloaded from http://iroffer.dinoex.net/ * * $Id: dinoex_geoip.c,v 1.25 2011/11/19 11:26:38 cvs Exp $ *


Included Files

include the headers


Preprocessor definitions

#define _LONGLONG 1

#define GEOIP_FLAGS GEOIP_MEMORY_CACHE


Typedef ir_geoip

typedef struct {...} ir_geoip
struct  
   {  
      GeoIP* gi;  
      time_t loaded;  
      char code[8];  
   }  

Local Variables

geoip4
static ir_geoip geoip4
Used in: check_geoip()  
  geoip_shutdown()  

geoip6
static ir_geoip geoip6

Used in: check_geoip6()  
  geoip_shutdown()  

Global Function geoip_new_connection()

check an IRC download against the GeoIP database

void geoip_new_connection ( transfer* const tr )

Prototyped in: src/dinoex_geoip.h
Calls: check_geoip() src/dinoex_geoip.c
  check_geoip6() src/dinoex_geoip.c
  geoip_deny() src/dinoex_geoip.c
  ioutput() src/iroffer_utilities.c
  irlist_get_head() src/iroffer_utilities.c
  irlist_get_next() src/iroffer_utilities.c
  irlist_size() src/iroffer_utilities.c
  mystrdup2() src/dinoex_utilities.c
  no_verifyshell() src/dinoex_utilities.c
  verifyshell() src/dinoex_utilities.c
  strcasecmp()
Called by: t_check_new_connection() src/dinoex_transfer.c
References Variables: gdata src/dinoex_main.c

Global Function geoip_shutdown()

close GeoIP

void geoip_shutdown ( void )

Prototyped in: src/dinoex_geoip.h
Calls: geoip_close() src/dinoex_geoip.c
Called by: rehash_dinoex() src/dinoex_misc.c
  shutdown_dinoex() src/dinoex_misc.c
References Variables: geoip4 src/dinoex_geoip.c
  geoip6 src/dinoex_geoip.c

Global Function http_check_geoip()

check a HTTP connection against the GeoIP database

unsigned int http_check_geoip ( ir_uint32 remoteip )

Prototyped in: src/dinoex_geoip.h
Calls: check_geoip() src/dinoex_geoip.c
  http_check_country() src/dinoex_geoip.c
Called by: is_in_badip4() src/dinoex_badip.c
References Variables: gdata src/dinoex_main.c

Global Function http_check_geoip6()

check a HTTP connection against the GeoIPv6 database

unsigned int http_check_geoip6 ( struct in6_addr* remoteip )

Prototyped in: src/dinoex_geoip.h
Calls: check_geoip6() src/dinoex_geoip.c
  http_check_country() src/dinoex_geoip.c
Called by: is_in_badip6() src/dinoex_badip.c
References Variables: gdata src/dinoex_main.c

Local Function check_geoip()

static const char* check_geoip ( ir_uint32 remoteip )
Calls: geoip_open() src/dinoex_geoip.c
  geoip_return_null() src/dinoex_geoip.c
  geoip_return_reusult() src/dinoex_geoip.c
  GeoIP_country_code_by_addr(), snprintf()
Called by: geoip_new_connection() src/dinoex_geoip.c
  http_check_geoip() src/dinoex_geoip.c
References Variables: gdata src/dinoex_main.c
  geoip4 src/dinoex_geoip.c

Local Function check_geoip6()

static const char* check_geoip6 ( struct in6_addr* remoteip )
Calls: geoip_open() src/dinoex_geoip.c
  geoip_return_null() src/dinoex_geoip.c
  geoip_return_reusult() src/dinoex_geoip.c
  GeoIP_country_code_by_ipnum_v6()
Called by: geoip_new_connection() src/dinoex_geoip.c
  http_check_geoip6() src/dinoex_geoip.c
References Variables: gdata src/dinoex_main.c
  geoip6 src/dinoex_geoip.c

Local Function geoip_close()

static void geoip_close ( ir_geoip* geoip )
Calls: GeoIP_delete()
Called by: geoip_open() src/dinoex_geoip.c
  geoip_shutdown() src/dinoex_geoip.c

Local Function geoip_deny()

static void geoip_deny ( transfer* const tr, const char* country )
Calls: ioutput() src/iroffer_utilities.c
  mydelete2() src/iroffer_utilities.c
  mymalloc2() src/iroffer_utilities.c
  t_closeconn() src/iroffer_transfer.c
  snprintf()
Called by: geoip_new_connection() src/dinoex_geoip.c

Local Function geoip_open()

static void geoip_open ( ir_geoip* geoip, const char* geoipdatabase )
Calls: geoip_close() src/dinoex_geoip.c
  geoip_time() src/dinoex_geoip.c
  ioutput() src/iroffer_utilities.c
  GeoIP_new(), GeoIP_open()
Called by: check_geoip() src/dinoex_geoip.c
  check_geoip6() src/dinoex_geoip.c

Local Function geoip_return_null()

static const char* geoip_return_null ( ir_geoip* geoip )
Called by: check_geoip() src/dinoex_geoip.c
  check_geoip6() src/dinoex_geoip.c
  geoip_return_reusult() src/dinoex_geoip.c

Local Function geoip_return_reusult()

static const char* geoip_return_reusult ( ir_geoip* geoip, const char* result )
Calls: geoip_return_null() src/dinoex_geoip.c
  __sbtolower()
Called by: check_geoip() src/dinoex_geoip.c
  check_geoip6() src/dinoex_geoip.c

Local Function geoip_time()

static time_t geoip_time ( const char* name )
Calls: outerror() src/iroffer_utilities.c
  __error(), stat(), strerror()
Called by: geoip_open() src/dinoex_geoip.c

Local Function http_check_country()

static unsigned int http_check_country ( const char* country )
Calls: no_verifyshell() src/dinoex_utilities.c
  verifyshell() src/dinoex_utilities.c
Called by: http_check_geoip() src/dinoex_geoip.c
  http_check_geoip6() src/dinoex_geoip.c
References Variables: gdata src/dinoex_main.c