|
Packit Service |
384592 |
/*
|
|
Packit Service |
384592 |
* ModSecurity for Apache 2.x, http://www.modsecurity.org/
|
|
Packit Service |
384592 |
* Copyright (c) 2004-2013 Trustwave Holdings, Inc. (http://www.trustwave.com/)
|
|
Packit Service |
384592 |
*
|
|
Packit Service |
384592 |
* You may not use this file except in compliance with
|
|
Packit Service |
384592 |
* the License. You may obtain a copy of the License at
|
|
Packit Service |
384592 |
*
|
|
Packit Service |
384592 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
Packit Service |
384592 |
*
|
|
Packit Service |
384592 |
* If any of the files related to licensing are missing or if you have any
|
|
Packit Service |
384592 |
* other questions related to licensing please contact Trustwave Holdings, Inc.
|
|
Packit Service |
384592 |
* directly using the email address security@modsecurity.org.
|
|
Packit Service |
384592 |
*/
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
#ifndef _MSC_GEO_H_
|
|
Packit Service |
384592 |
#define _MSC_GEO_H_
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
#define GEO_STRUCT_INFO_MAX_SIZE 20
|
|
Packit Service |
384592 |
#define GEO_DB_INFO_MAX_SIZE 100
|
|
Packit Service |
384592 |
#define GEO_COUNTRY_OFFSET 0xffff00
|
|
Packit Service |
384592 |
#define GEO_MAX_RECORD_LEN 4
|
|
Packit Service |
384592 |
#define GEO_COUNTRY_UNKNOWN "Unknown"
|
|
Packit Service |
384592 |
#define GEO_CITY_UNKNOWN "Unknown"
|
|
Packit Service |
384592 |
#define GEO_CITY_RECORD_LEN 50
|
|
Packit Service |
384592 |
#define GEO_COUNTRY_DATABASE 1
|
|
Packit Service |
384592 |
#define GEO_CITY_DATABASE_0 6
|
|
Packit Service |
384592 |
#define GEO_CITY_DATABASE_1 2
|
|
Packit Service |
384592 |
#define GEO_COUNTRY_LAST 250
|
|
Packit Service |
384592 |
#define GEO_SEGMENT_RECORD_LENGTH 3
|
|
Packit Service |
384592 |
#define GEO_STATE_BEGIN_REV0 16700000
|
|
Packit Service |
384592 |
#define GEO_STATE_BEGIN_REV1 16000000
|
|
Packit Service |
384592 |
#define GEO_COUNTRY_BEGIN 16776960
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
typedef struct geo_rec geo_rec;
|
|
Packit Service |
384592 |
typedef struct geo_db geo_db;
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
#include <apr_file_io.h>
|
|
Packit Service |
384592 |
#include "modsecurity.h"
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Structures */
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
struct geo_rec {
|
|
Packit Service |
384592 |
const char *country_code;
|
|
Packit Service |
384592 |
const char *country_code3;
|
|
Packit Service |
384592 |
const char *country_name;
|
|
Packit Service |
384592 |
const char *country_continent;
|
|
Packit Service |
384592 |
const char *region;
|
|
Packit Service |
384592 |
const char *city;
|
|
Packit Service |
384592 |
const char *postal_code;
|
|
Packit Service |
384592 |
float latitude;
|
|
Packit Service |
384592 |
float longitude;
|
|
Packit Service |
384592 |
int dma_code;
|
|
Packit Service |
384592 |
int area_code;
|
|
Packit Service |
384592 |
};
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
struct geo_db {
|
|
Packit Service |
384592 |
apr_file_t *db;
|
|
Packit Service |
384592 |
const char *dbfn;
|
|
Packit Service |
384592 |
int dbtype;
|
|
Packit Service |
384592 |
unsigned int ctry_offset;
|
|
Packit Service |
384592 |
};
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
/* Functions */
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
int DSOLOCAL geo_init(directory_config *dcfg, const char *dbfn, char **error_msg);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
int DSOLOCAL geo_lookup(modsec_rec *msr, geo_rec *rec, const char *target, char **error_msg);
|
|
Packit Service |
384592 |
|
|
Packit Service |
384592 |
#endif
|