"Fossies" - the Fresh Open Source Software Archive

Member "bind-9.17.5/lib/dns/include/dns/geoip.h" (4 Sep 2020, 2341 Bytes) of package /linux/misc/dns/bind9/9.17.5/bind-9.17.5.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "geoip.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
    3  *
    4  * This Source Code Form is subject to the terms of the Mozilla Public
    5  * License, v. 2.0. If a copy of the MPL was not distributed with this
    6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
    7  *
    8  * See the COPYRIGHT file distributed with this work for additional
    9  * information regarding copyright ownership.
   10  */
   11 
   12 #ifndef DNS_GEOIP_H
   13 #define DNS_GEOIP_H 1
   14 
   15 /*****
   16 ***** Module Info
   17 *****/
   18 
   19 /*! \file dns/geoip.h
   20  * \brief
   21  * GeoIP/GeoIP2 data types and function prototypes.
   22  */
   23 
   24 #if defined(HAVE_GEOIP2)
   25 
   26 /***
   27  *** Imports
   28  ***/
   29 
   30 #include <stdbool.h>
   31 
   32 #include <isc/lang.h>
   33 #include <isc/magic.h>
   34 #include <isc/netaddr.h>
   35 #include <isc/refcount.h>
   36 
   37 #include <dns/iptable.h>
   38 #include <dns/name.h>
   39 #include <dns/types.h>
   40 
   41 /***
   42  *** Types
   43  ***/
   44 
   45 typedef enum {
   46     dns_geoip_countrycode,
   47     dns_geoip_countrycode3,
   48     dns_geoip_countryname,
   49     dns_geoip_continentcode,
   50     dns_geoip_continent,
   51     dns_geoip_region,
   52     dns_geoip_regionname,
   53     dns_geoip_country_code,
   54     dns_geoip_country_code3,
   55     dns_geoip_country_name,
   56     dns_geoip_country_continentcode,
   57     dns_geoip_country_continent,
   58     dns_geoip_region_countrycode,
   59     dns_geoip_region_code,
   60     dns_geoip_region_name,
   61     dns_geoip_city_countrycode,
   62     dns_geoip_city_countrycode3,
   63     dns_geoip_city_countryname,
   64     dns_geoip_city_region,
   65     dns_geoip_city_regionname,
   66     dns_geoip_city_name,
   67     dns_geoip_city_postalcode,
   68     dns_geoip_city_metrocode,
   69     dns_geoip_city_areacode,
   70     dns_geoip_city_continentcode,
   71     dns_geoip_city_continent,
   72     dns_geoip_city_timezonecode,
   73     dns_geoip_isp_name,
   74     dns_geoip_org_name,
   75     dns_geoip_as_asnum,
   76     dns_geoip_domain_name,
   77     dns_geoip_netspeed_id
   78 } dns_geoip_subtype_t;
   79 
   80 typedef struct dns_geoip_elem {
   81     dns_geoip_subtype_t subtype;
   82     void *          db;
   83     union {
   84         char as_string[256];
   85         int  as_int;
   86     };
   87 } dns_geoip_elem_t;
   88 
   89 struct dns_geoip_databases {
   90     void *country; /* GeoIP2-Country or GeoLite2-Country */
   91     void *city;    /* GeoIP2-CIty or GeoLite2-City */
   92     void *domain;  /* GeoIP2-Domain */
   93     void *isp;     /* GeoIP2-ISP */
   94     void *as;      /* GeoIP2-ASN or GeoLite2-ASN */
   95 };
   96 
   97 /***
   98  *** Functions
   99  ***/
  100 
  101 ISC_LANG_BEGINDECLS
  102 
  103 bool
  104 dns_geoip_match(const isc_netaddr_t *        reqaddr,
  105         const dns_geoip_databases_t *geoip,
  106         const dns_geoip_elem_t *     elt);
  107 
  108 ISC_LANG_ENDDECLS
  109 
  110 #endif /* HAVE_GEOIP2 */
  111 
  112 #endif /* DNS_GEOIP_H */