remove it

This commit is contained in:
Jef 2024-09-24 19:20:53 +02:00
parent 7ce05499ff
commit 1be04037cd
310 changed files with 0 additions and 188961 deletions

View File

@ -1,225 +0,0 @@
#include "ADTSHeader.h"
#include "nmrCommon/services/stdServiceImpl.h"
enum
{
ADTS_NOT_PROTECTED = 1,
ADTS_PROTECTED = 0,
ADTS_SYNC = 0xFFF,
ADTS_MAIN = 0x00,
ADTS_LC = 0x01,
ADTS_SSR = 0x10,
ADTS_LTP = 0x11
};
const int aac_adts_parse(const aac_adts_header_t header, const __uint8 *buffer)
{
header->syncword = ((buffer[0] << 4) | (buffer[1] >> 4));
if (header->syncword != ADTS_SYNC)
{
return NErr_LostSynchronization;
}
header->id = ((buffer[1] >> 3) & 1);
header->layer = ((buffer[1] >> 1) & 3);
if (header->layer != 0)
{
return NErr_WrongFormat;
}
header->protection = ((buffer[1]) & 1);
header->profile = ((buffer[2] >> 6) & 3);
header->sample_rate_index = ((buffer[2] >> 2) & 0xF);
if (header->sample_rate_index == 15)
{
return NErr_UnsupportedFormat; // might actually be OK if we can separately signal the sample rate
}
if (header->sample_rate_index > 13)
{
return NErr_Reserved;
}
header->private_bit = ((buffer[2] >> 1) & 1);
header->channel_configuration = ((buffer[2] & 1) << 2) | ((buffer[3] >> 6) & 3);
header->original = ((buffer[3] >> 5) & 1);
header->home = ((buffer[3] >> 4) & 1);
header->frame_length = ((buffer[3] & 3) << 11) | (buffer[4]<<3) | ((buffer[5] >> 5) & 7);
header->buffer_fullness = ((buffer[5] & 0x1F) << 6) | (buffer[6] >> 2);
header->num_data_blocks = (buffer[6] & 3);
return NErr_Success;
}
static const unsigned int aac_sratetab[] =
{
96000,
88200,
64000,
48000,
44100,
32000,
24000,
22050,
16000,
12000,
11025,
8000,
7350,
};
#if 0
const int aac_adts_match(const aac_adts_header_t header1, const aac_adts_header_t header2)
{
if (header1->id != header2->id)
{
return NErr_False;
}
if (header1->profile != header2->profile)
{
return NErr_False;
}
if (header1->sample_rate_index != header2->sample_rate_index)
{
return NErr_False;
}
if (header1->channel_configuration != header2->channel_configuration)
{
return NErr_False;
}
return NErr_True;
}
#endif
const int aac_adts_get_channel_count(const aac_adts_header_t header)
{
switch (header->channel_configuration)
{
case 7:
{
return 8;
}
default:
{
return header->channel_configuration;
}
}
}
const __uint16 getADTSFrameInfo(const char *hdr, unsigned int *samplerate, __uint8 *asc_header)
{
ADTSHeader header = {0};
if (aac_adts_parse(&header, (const __uint8 *)hdr) == NErr_Success)
{
*samplerate = aac_sratetab[header.sample_rate_index];
// we need this when generating flv frames
// as it creates the AudioSpecificConfig
// from the existing ADTS header details
// (is like a mini-ADTS header to create)
if (asc_header)
{
asc_header[0] |= (((header.profile + 1) & 31) << 3) + (header.sample_rate_index >> 1);
asc_header[1] |= ((header.sample_rate_index & 0x1) << 7) + (header.channel_configuration << 3);
}
//*bitrate = (int)(((header.frame_length / 1/*frames*/) * (aac_sratetab[header.sample_rate_index] / 1024.0)) + 0.5) * 8;
return (__uint16)header.frame_length;
}
return 0;
}
const char *AAC_FrameInfo::getVersionName() const
{
if (m_version)
return "v2";
return "v4";
}
const char *AAC_FrameInfo::getAOT() const
{
switch (m_aot)
{
case 2: return "LC";
case 5: return "SBR";
case 29: return "PS";
default: return "unknown profile";
}
}
int getAACFrameLength (const unsigned char *p, unsigned int len)
{
if (len < 6)
return -1;
return ((p[3] & 0x3) << 11) + (p[4] << 3) + ((p[5] & 0xE0) >> 5);
}
int getAACFrameInfo (const unsigned char *p, unsigned int len, AAC_FrameInfo &info)
{
if (len < 6)
return -1;
if ((((long)p[0])<<4 | (p[1]>>4)) != 0xfff)
return -1;
int layer = ((p[1] >> 1) & 3);
if (layer != 0)
return -1;
int sample_rate_index = ((p[2] >> 2) & 0xF);
if (sample_rate_index > 13)
return -1;
int samplerate = aac_sratetab [sample_rate_index];
if (info.m_samplerate)
{
if (info.m_samplerate != samplerate)
return -1;
}
else
info.m_samplerate = samplerate;
info.m_blocks = (p[6] & 0x3) + 1;
info.m_pattern = (((unsigned long)(p[0])<<24) | (p[1]<<16) | (p[2]<<8) | p[0]) & info.m_mask;
return getAACFrameLength (p, len);
}
int AAC_FrameInfo::verifyFrame (const unsigned char *buf, unsigned int len)
{
if (len > 6)
{
unsigned long v = (unsigned long)(buf[0])<<24 | (buf[1]<<16) | (buf[2]<<8) | buf[0];
if ((v & m_mask) == m_pattern)
{
m_blocks = (buf[6] & 0x3) + 1;
m_version = (buf[1] >> 3) & 1; // 1 mpeg2, 0 mpeg4
m_aot = ((buf[2] >> 6) & 3) + 1;
return getAACFrameLength (buf, len);
}
// DLOG ("AAC failed sync, retry..");
return -1;
}
return 0;
}
AAC_FrameInfo::AAC_FrameInfo (unsigned long value) : parserInfo (0xFFFEFDC0, value)
{
m_description = "AAC";
m_blocks = 0;
m_aot = 0;
}
AAC_FrameInfo::AAC_FrameInfo(const unsigned char *p, unsigned int len) : parserInfo()
{
m_mask = 0xFFFEFDC0;
m_description = "AAC";
m_blocks = 0;
getAACFrameInfo (p, len, *this);
}

View File

@ -1,62 +0,0 @@
#pragma once
#ifndef _ADTS_HEADER_H
#define _ADTS_HEADER_H
#include "nmrCommon/intTypes.h"
#include "global.h"
#include "uvox2Common.h"
typedef struct ADTSHeader
{
unsigned int syncword;
unsigned int layer;
unsigned int id;
unsigned int protection;
unsigned int profile;
unsigned int sample_rate_index;
unsigned int private_bit;
unsigned int channel_configuration;
unsigned int original;
unsigned int home;
int frame_length;
unsigned int buffer_fullness;
unsigned int num_data_blocks;
} ADTSHeader, *aac_adts_header_t;
enum
{
NErr_Success = 0,
NErr_True = 0,
NErr_False = 8, // returned from a bool-like function to indicate "false" as opposed to "i had an error while figuring it out"
NErr_UnsupportedFormat = 13,
NErr_LostSynchronization = 17,
NErr_WrongFormat = 24, // data was understood but is indicating a different format than expected. e.g. an layer 2 header being encountered by a layer 3 parser
NErr_Reserved = 25 // typically returned when a parser encounters data with a reserved flag set to true
};
struct AAC_FrameInfo : public parserInfo
{
int m_blocks;
int m_aot;
int verifyFrame (const unsigned char *buf, unsigned int len);
int getUvoxType() { return AAC_LC_DATA; }
const char *getVersionName() const;
const char *getAOT() const;
AAC_FrameInfo (unsigned long value = 0);
AAC_FrameInfo (const unsigned char *p, unsigned int len);
};
int getAACFrameInfo (const unsigned char *hdr, unsigned int len, AAC_FrameInfo &info);
/* must be 7 bytes */
const int aac_adts_parse(const aac_adts_header_t header, const __uint8 *buffer);
const int aac_adts_get_channel_count(const aac_adts_header_t header);
#if 0
const int aac_adts_match(const aac_adts_header_t header1, const aac_adts_header_t header2);
#endif
const __uint16 getADTSFrameInfo(const char *hdr, unsigned int *samplerate, __uint8 *asc_header = 0);
#endif

View File

@ -1,322 +0,0 @@
#include "FLV.h"
#ifdef _WIN32
#include <winsock2.h>
#endif
#include "streamData.h"
using namespace std;
using namespace uniString;
using namespace stringUtil;
/*
** This is a bit messy but it'll generate
** FLV tags for the purpose of streaming.
**
** Where possible values are hard-coded
** so we just re-insert into the output.
*/
#define FLV_SIGNATURE {'F', 'L', 'V'}
#define FLV_VERSION ((__uint8)0x1)
#define FLV_FLAG_VIDEO ((__uint8)0x1)
#define FLV_FLAG_AUDIO ((__uint8)0x4)
#define FLV_HDR_SIZE ((__uint32)0x9000000) // pre-converted to big-endian
// ensure we've got the structures correctly packed
#pragma pack(push, 1)
typedef struct {
__uint8 signature[3]; // FLV_SIGNATURE
__uint8 version; // FLV_VERSION
__uint8 flags; // FLV_FLAG_*
__uint32 header_size; // FLV_HDR_SIZE
__uint32 prev_size; // 0 (this is the size of the previous tag including
// its header in bytes i.e. 11 + the 'data_size'
// of the previous tag). we include this in the
// header so that we're always outputting a valid
// start point before the tag structure is added.
} flv_header;
#pragma pack(pop)
#pragma pack(push, 1)
typedef struct {
__uint8 type; // for first packet set to AMF Metadata ???
__uint8 data_size[3]; // size of packet data only (24)
__uint8 ts_lower[3]; // for first packet set to NULL (24)
__uint8 ts_upper; // extension to create a __uint32 value
__uint8 stream_id[3]; // for first stream of same type set to NULL (24)
/* data comes after this*/
} flv_tag;
#pragma pack(pop)
/*
__uint32 prev_size; // for first packet set to NULL otherwise this is the
// size of the previous tag including its header in B
// and is 11 plus the 'data_size' of the previous tag.
*/
// these are pre-encoded for the correct endianess
// though for metadata usage, we convert them back
#define FLV_MP3_AUDIO ((__uint8)0x20) // (((__uint8)0x2) << 4)
#define FLV_AAC_AUDIO ((__uint8)0xA0) // (((__uint8)0xA) << 4)
#define FLV_SAMPLE_RATE_5 ((__uint8)0x0) // (((__uint8)0x0) << 2)
#define FLV_SAMPLE_RATE_11 ((__uint8)0x4) // (((__uint8)0x1) << 2)
#define FLV_SAMPLE_RATE_22 ((__uint8)0x8) // (((__uint8)0x2) << 2)
#define FLV_SAMPLE_RATE_44 ((__uint8)0xC) // (((__uint8)0x3) << 2)
#define FLV_SAMPLE_SIZE_8 ((__uint8)0x0) // (((__uint8)0x0) << 1)
#define FLV_SAMPLE_SIZE_16 ((__uint8)0x2) // (((__uint8)0x1) << 1)
#define FLV_MONO_AUDIO ((__uint8)0x0)
#define FLV_STEREO_AUDIO ((__uint8)0x1)
// reads 24 bits from data, converts from big endian, and returns as a 32bit int
inline __uint32 Read24(__uint8* data)
{
__uint32 returnVal = 0;
__uint8* swap = (__uint8*)&returnVal;
swap[0] = data[2];
swap[1] = data[1];
swap[2] = data[0];
return returnVal;
}
int dataString(vector<__uint8> &out_data, const char *buf)
{
int amt = (int)strlen(buf);
__uint8 bytes[2] = {(__uint8)((amt >> 8) & 0xff), (__uint8)((amt >> 0) & 0xff)};
// length of the data string
out_data.insert(out_data.end(), (const __uint8*)&bytes, (const __uint8*)&bytes + sizeof(bytes));
// body of the data string
out_data.insert(out_data.end(), (const __uint8*)buf, (const __uint8*)buf + amt);
return amt + 2;
}
int scriptDataType(vector<__uint8> &out_data, const __uint8 type)
{
out_data.insert(out_data.end(), (const __uint8*)&type, ((const __uint8*)&type) + sizeof(type));
return 1;
}
int scriptDataString(vector<__uint8> &out_data, const char *name, const char *value)
{
return dataString(out_data, name) + scriptDataType(out_data, 0x2) + dataString(out_data, value);
}
int scriptDataBool(vector<__uint8> &out_data, const char *name, const bool value)
{
return dataString(out_data, name) + scriptDataType(out_data, 0x1) + scriptDataType(out_data, !!value);
}
int scriptDataDouble(vector<__uint8> &out_data, const char *name, const double value)
{
int amt = dataString(out_data, name) + scriptDataType(out_data, 0x0);
union
{
__uint8 dc[8];
double dd;
} d;
d.dd = value;
unsigned char b[8];
b[0] = d.dc[7];
b[1] = d.dc[6];
b[2] = d.dc[5];
b[3] = d.dc[4];
b[4] = d.dc[3];
b[5] = d.dc[2];
b[6] = d.dc[1];
b[7] = d.dc[0];
out_data.insert(out_data.end(), (const __uint8*)b, (const __uint8*)b + sizeof(b));
return amt + 8;
}
void createMetadataTag(vector<__uint8> &out_data, const bool mp3,
const bool mono, const int bitrate,
const __uint8 flv_sr, const streamData::streamID_t sid)
{
__uint8 m[] = {'\x12', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00'};
out_data.insert(out_data.end(), (const __uint8*)m, (const __uint8*)m + sizeof(m));
__uint32 s = scriptDataType(out_data, 0x2) +
dataString(out_data, "onMetadata") +
// start of the script array data blocks
scriptDataType(out_data, 0x8);
__uint8 data_size[4] = {'\x00', '\x00', '\x00', '\x0C'/* number of items in the array */};
out_data.insert(out_data.end(), (const __uint8*)&data_size, ((const __uint8*)&data_size) + sizeof(data_size));
s += 4;
streamData::streamInfo info;
streamData::extraInfo extra;
streamData::getStreamInfo(sid, info, extra);
s += scriptDataString(out_data, "name", (!info.m_streamName.empty() ? info.m_streamName.hideAsString().c_str() : ""));
// TODO - as we're not updating as we go at the moment, this will be set to the station name so there's something set
s += scriptDataString(out_data, "title", (!info.m_streamName.empty() ? info.m_streamName.hideAsString().c_str() : ""));
//s += scriptDataString(out_data, "title", (!info.m_currentSong.empty() ? info.m_currentSong.hideAsString().c_str() : ""));
s += scriptDataString(out_data, "genre", (!info.m_streamGenre[0].empty() ? info.m_streamGenre[0].hideAsString().c_str() : ""));
//s += scriptDataBool(out_data, "hasMetadata", false/* TODO */);
s += scriptDataBool(out_data, "hasAudio", true);
s += scriptDataBool(out_data, "hasVideo", false);
s += scriptDataBool(out_data, "hasKeyframes", false);
s += scriptDataBool(out_data, "canSeekToEnd", false);
s += scriptDataBool(out_data, "stereo", !mono);
s += scriptDataDouble(out_data, "audiodatarate", (double)bitrate);
s += scriptDataDouble(out_data, "audiocodecid", (double)((mp3 ? FLV_MP3_AUDIO : FLV_AAC_AUDIO) >> 4));
s += scriptDataDouble(out_data, "audiosamplerate", (double)(flv_sr >> 2));
s += scriptDataDouble(out_data, "audiosamplesize", (double)(FLV_SAMPLE_SIZE_16 >> 1));
unsigned char end[] = {'\x00', '\x00', '\x09'};
out_data.insert(out_data.end(), (const __uint8*)end, (const __uint8*)end + sizeof(end));
s += 3;
// now we know how much we've got
// we can update the tags' length
__uint32 s2 = s + 11;
out_data[16] = (s & 0xFF);
s >>= 8;
out_data[15] = (s & 0xFF);
s >>= 8;
out_data[14] = (s & 0xFF);
// we set this at the end so if we terminate the stream
// then there's more chance of it validating correctly.
data_size[3] = (s2 & 0xFF);
s2 >>= 8;
data_size[2] = (s2 & 0xFF);
s2 >>= 8;
data_size[1] = (s2 & 0xFF);
s2 >>= 8;
data_size[0] = (s2 & 0xFF);
out_data.insert(out_data.end(), (const __uint8*)&data_size, ((const __uint8*)&data_size) + sizeof(data_size));
}
void createFLVTag(vector<__uint8> &out_data, const char *buf,
const int amt, int &timestamp, const bool mp3,
const bool mono, const unsigned int samplerate,
const int bitrate, const __uint8 *asc_header,
const streamData::streamID_t sid)
{
if (amt > 0)
{
// we need to generate this early so we've got
// it for being provided in createMetadataTag
__uint8 flv_sr = FLV_SAMPLE_RATE_44;
if (mp3)
{
// how do we handle the formats not allowed...?
switch (samplerate)
{
case 22050:
{
flv_sr = FLV_SAMPLE_RATE_22;
break;
}
case 11025:
{
flv_sr = FLV_SAMPLE_RATE_11;
break;
}
}
}
const bool first = (timestamp == 0);
if (first)
{
const flv_header hdr = {FLV_SIGNATURE, FLV_VERSION, FLV_FLAG_AUDIO, FLV_HDR_SIZE, 0};
out_data.insert(out_data.end(), (const __uint8*)&hdr, ((const __uint8*)&hdr) + sizeof(flv_header));
createMetadataTag(out_data, mp3, mono, bitrate, flv_sr, sid);
if (!mp3)
{
// we send a simple frame at this point just so for AAC the decoder
// is able to be setup correctly as needed else it'll fail to play.
__uint8 p[] = {'\x08', '\x00', '\x00', '\x04', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', (__uint8)'\xAF', '\x00', asc_header[0],
asc_header[1], '\x00', '\x00', '\x00', '\x0F'};
out_data.insert(out_data.end(), (const __uint8*)p, (const __uint8*)p + sizeof(p));
}
}
// if we were to do something else, then we'd need to
// change the initial value as needed for it's format
flv_tag tag = {((__uint8)0x8), {0}, {0}, 0, {0}};
// we need to know the size of things before we output
// the actual frame, so we calculate now and adjust it
// based on the format of the frame needing to be sent
__uint32 v = (first ? (!mp3 ? 2 : 1) : 1 + !mp3) + amt;
tag.data_size[2] = (v & 0xFF);
v >>= 8;
tag.data_size[1] = (v & 0xFF);
v >>= 8;
tag.data_size[0] = (v & 0xFF);
// this sets the 24-bit time
v = timestamp;
tag.ts_lower[2] = (v & 0xFF);
v >>= 8;
tag.ts_lower[1] = (v & 0xFF);
v >>= 8;
tag.ts_lower[0] = (v & 0xFF);
// this sets the extended time
// so we provide a 32-bit time
v >>= 8;
tag.ts_upper = (v & 0xFF);
// depending on the format, we adjust timestamp
// for MP3, we're looking at 26ms / frame
// for AAC, we're looking at 1024 samples / frame
timestamp += (mp3 ? 26 : (1024000 / samplerate));
out_data.insert(out_data.end(), (const __uint8*)&tag, ((const __uint8*)&tag) + sizeof(flv_tag));
// for AAC data, the default has to be set as 16-bit 44kHZ stereo
// though the decoder will actuall figure things out as required.
// for MP3 data, we fill in things based on the frame data found
__uint8 flv_audio_data_tag = ((mp3 ? FLV_MP3_AUDIO : FLV_AAC_AUDIO) | flv_sr | FLV_SAMPLE_SIZE_16 | (!mono ? FLV_STEREO_AUDIO : FLV_MONO_AUDIO));
out_data.insert(out_data.end(), (const __uint8*)&flv_audio_data_tag, ((const __uint8*)&flv_audio_data_tag) + sizeof(flv_audio_data_tag));
if (!mp3)
{
// this is done so we now distinguish the actual
// raw AAC data sans ADTS header vs the required
// AAC sequence header which is sent before the
// first AAC data frame is sent
__uint8 packet_type = 0x1;
out_data.insert(out_data.end(), (const __uint8*)&packet_type, ((const __uint8*)&packet_type) + sizeof(packet_type));
}
// body of the data
out_data.insert(out_data.end(), (const __uint8*)buf, ((const __uint8*)buf) + amt);
// we set this at the end so if we terminate the stream
// then there's more chance of it validating correctly.
v = (11 + Read24(tag.data_size));
__uint8 data_size[4] = {0};
data_size[3] = (v & 0xFF);
v >>= 8;
data_size[2] = (v & 0xFF);
v >>= 8;
data_size[1] = (v & 0xFF);
v >>= 8;
data_size[0] = (v & 0xFF);
out_data.insert(out_data.end(), (const __uint8*)&data_size, ((const __uint8*)&data_size) + sizeof(data_size));
}
}

View File

@ -1,23 +0,0 @@
#pragma once
#ifndef _FLV_HEADER_H
#define _FLV_HEADER_H
#include <stdio.h>
#include <vector>
#include "nmrCommon/intTypes.h"
#ifdef _WIN32
#include <winsock2.h>
#endif
#include "streamData.h"
void createFLVTag(std::vector<__uint8> &out_data, const char *buf,
const int amt, int &timestamp, const bool mp3,
const bool mono, const unsigned int samplerate,
const int bitrate, const __uint8 *asc_header,
const streamData::streamID_t sid);
void createMetadataTag(std::vector<__uint8> &out_data, const bool mp3,
const bool mono, const int bitrate,
const __uint8 flv_sr, const streamData::streamID_t sid);
#endif

View File

@ -1,237 +0,0 @@
SHELL = /bin/sh
.SUFFIXES:
.SUFFIXES: .cpp .o .d .h
OS := $(shell uname | sed 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/')
x64 := $(shell uname -m)
ENDIAN := $(shell uname -m)
ENDIAN := $(patsubst i%86,LITTLE_ENDIAN,$(ENDIAN))
ENDIAN := $(patsubst x86_64,LITTLE_ENDIAN,$(ENDIAN))
ENDIAN := $(patsubst Power Macintosh,BIG_ENDIAN,$(ENDIAN))
CXX=g++ -std=c++11 -Wno-deprecated
##########################################################
########### Platform specific stuff #####################
##########################################################
ifeq ($(OS),LINUX)
### Raspbian is reported as a Linux OS
### and reports 'armv6l' via uname -m
### so we check -m to detect it properly
ifeq ($(x64),armv6l)
#PLATFORM_DEFINES=-DPLATFORM_ARMv6
# this is for GCC 4.6.x to make a legacy compatible compile ??
PLATFORM_DEFINES=-DPLATFORM_ARMv6 -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -ffunction-sections -fdata-sections -Wl,--gc-sections
PLATFORM_LIBS=\
libs/Aol_XML/ARMv6/libexpat.a\
libs/libcurl/ARMv6/libcurl.a\
libs/libcurl/ARMv6/libssl.a\
libs/libcurl/ARMv6/libcrypto.a\
libs/zlib/ARMv6/libz.a\
-lrt\
-lpthread\
-ldl
### the RPi2 is reported as a Linux OS
### and reports 'armv7l' via uname -m
### so we check -m to detect it properly
else ifeq ($(x64),armv7l)
# https://www.raspberrypi.org/forums/viewtopic.php?p=684549#p684549
# this is for GCC 4.6.x
#PLATFORM_DEFINES=-DPLATFORM_ARMv7 -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard
# this is for GCC 4.8.x (default is 4.6.x on Raspbian)
PLATFORM_DEFINES=-DPLATFORM_ARMv7 -mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -Wno-unused-result -Wno-ignored-qualifiers -Wno-long-long -Wno-missing-field-initializers -ffunction-sections -fdata-sections -Wl,--gc-sections
# this is for GCC 4.6.x to make a legacy compatible compile ??
#PLATFORM_DEFINES=-DPLATFORM_ARMv6 -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard
PLATFORM_LIBS=\
libs/Aol_XML/ARMv7/libexpat.a\
libs/libcurl/ARMv7/libcurl.a\
libs/libcurl/ARMv7/libssl.a\
libs/libcurl/ARMv7/libcrypto.a\
libs/zlib/ARMv7/libz.a\
-lrt\
-lpthread\
-ldl
else
PLATFORM_DEFINES=-DPLATFORM_LINUX -Wno-unused-result -Wno-ignored-qualifiers -Wno-long-long -Wno-missing-field-initializers -ffunction-sections -fdata-sections -Wl,--gc-sections
### Linux platform specific includes
### with 32-bit and 64-bit handling
ifeq ($(x64),x86_64)
INCLUDES=-Ideps/x86_64/include
PLATFORM_LIBS=\
-Ldeps/x86_64/lib -lexpat -lcurl -lssl -lcrypto -lpthread -lz -lrt -ldl
else
CXX += -m32
INCLUDES=-Ideps/i686/include
PLATFORM_LIBS=\
-Ldeps/i686/lib -lexpat -lcurl -lssl -lcrypto -lpthread -lz -lrt -ldl
endif
endif
###################################
else
ifeq ($(OS),FREEBSD)
# CXX=g++44
PLATFORM_DEFINES=-DPLATFORM_BSD -Wno-long-long -Wno-missing-field-initializers
PLATFORM_LIBS=\
libs/Aol_XML/BSD/libexpat.a\
libs/libcurl/BSD/libcurl.a\
libs/libcurl/BSD/libssl.a\
libs/libcurl/BSD/libcrypto.a\
libs/zlib/BSD/libz.a\
-lpthread\
# -R /usr/local/lib/gcc44
else
ifeq ($(OS),DARWIN)
PLATFORM_DEFINES=-DPLATFORM_MAC -Wno-long-long -Wno-missing-field-initializers
PLATFORM_LIBS=\
libs/Aol_XML/Darwin/libexpat.a\
libs/libcurl/Darwin/libcurl.a\
libs/libcurl/Darwin/libssl.a\
libs/libcurl/Darwin/libcrypto.a\
libs/zlib/Darwin/libz.a\
-lpthread
else
ERR = $(error Unknown operating system $(OS))
endif
endif
endif
ifneq ($(ENDIAN),LITTLE_ENDIAN)
ifneq ($(ENDIAN),BIG_ENDIAN)
ERR = $(error Unknown endian $(ENDIAN))
endif
endif
##########################################################
##########################################################
##########################################################
##########################################################
##########################################################
INCLUDES += -I. -InmrCommon
#INCLUDES=-I. -InmrCommon -Izlib -Ilibcurl/include -IGeoIP/libGeoIP
LIBS=$(PLATFORM_LIBS)
CPPFLAGS=$(PLATFORM_DEFINES) -MMD -MP -D_REENTRANT -DCURL_STATICLIB -Wno-unused-function -Wno-sign-compare -Wno-unknown-pragmas -Wall -Wextra -pedantic
CFLAGS_RELEASE=-O2 -static-libgcc -static-libstdc++ -rdynamic
CPPFLAGS_RELEASE=$(CPPFLAGS) -O2 -DNDEBUG -g
CFLAGS_DEBUG=-static-libgcc -static-libstdc++ -rdynamic
CPPFLAGS_DEBUG=$(CPPFLAGS) -ggdb -DDEBUG
VPATH=nmrCommon/threading nmrCommon/stacktrace nmrCommon/services nmrCommon/file nmrCommon/unicode webNet aolxml
#VPATH=nmrCommon/threading nmrCommon/stacktrace nmrCommon/services nmrCommon/file nmrCommon/unicode webNet aolxml GeoIP/libGeoIP
C_SOURCES=\
$(wildcard *.c)
#C_SOURCES=\
# $(wildcard *.c)\
# $(wildcard GeoIP/libGeoIP/*.c)
CXX_SOURCES=\
$(wildcard *.cpp)\
$(wildcard nmrCommon/threading/thread.cpp)\
$(wildcard nmrCommon/stacktrace/StackTrace.cpp)\
$(wildcard nmrCommon/services/logger.cpp)\
$(wildcard nmrCommon/services/serviceMain.cpp)\
$(wildcard nmrCommon/services/stdServiceImpl.cpp)\
$(wildcard nmrCommon/file/fileUtils.cpp)\
$(wildcard nmrCommon/unicode/*.cpp)\
$(wildcard webNet/*.cpp)\
$(wildcard aolxml/*.cpp)
SOURCE_FILES=$(C_SOURCES) $(CXX_SOURCES)
OBJECT_FILES=$(addsuffix .o,$(basename $(notdir $(SOURCE_FILES))))
DEBUG_OBJECTS=$(addprefix debug/,$(OBJECT_FILES))
RELEASE_OBJECTS=$(addprefix release/,$(OBJECT_FILES))
.PHONY: default
default: release
release/config.o debug/config.o: unixversion.h
release/serviceMain.o debug/serviceMain.o: unixversion.h
##############################################################
### Create unix version header from Win32 resource file
unixversion.h: sc_serv.rc
@grep --text 'PRODUCTVERSION' sc_serv.rc | sed 's/PRODUCTVERSION/static int & \[VENT\]=\{/' | sed 's/[0-9]*,[0-9]*,[0-9]*,[0-9]*/&\};/' > unixversion_tmp.h
@echo '#define VENT 4' | cat - unixversion_tmp.h > unixversion.h
@rm -f unixversion_tmp.h
################# File rules #########################3
debug/%.o: %.cpp
$(CXX) $(CPPFLAGS_DEBUG) $(INCLUDES) -c $< -o $@
debug/%.o: %.c
$(CXX) $(CPPFLAGS_DEBUG) $(INCLUDES) -c $< -o $@
release/%.o: %.cpp
$(CXX) $(CPPFLAGS_RELEASE) $(INCLUDES) -c $< -o $@
release/%.o: %.c
$(CXX) $(CPPFLAGS_RELEASE) $(INCLUDES) -c $< -o $@
#release/%.o: GeoIP/libGeoIP/%.c
# $(CXX) $(CPPFLAGS_RELEASE) $(INCLUDES) -c $< -o $@
############################################################
sc_serv_debug: $(DEBUG_OBJECTS)
$(CXX) -o sc_serv_debug $(CFLAGS_DEBUG) $(DEBUG_OBJECTS) $(LIBS)
@./sc_serv_debug -v
@echo
sc_serv: sc_serv_notstripped
strip -o sc_serv sc_serv_notstripped
@echo
sc_serv_notstripped: $(RELEASE_OBJECTS)
$(CXX) -o sc_serv_notstripped $(CFLAGS_RELEASE) $(RELEASE_OBJECTS) $(LIBS)
@./sc_serv_notstripped -v
releasedir:
@mkdir -p release
debugdir:
@mkdir -p debug
.PHONY: clean
.PHONY: release
.PHONY: debug
release: releasedir sc_serv
release_nostrip: releasedir sc_serv_notstripped
debug: debugdir sc_serv_debug
clean:
@rm -rf debug
@rm -rf release
@rm -f unixversion.h
.PHONY: err
err: ; $(ERR)
##################################################3
ifeq ($(MAKECMDGOALS),release)
-include $(RELEASE_OBJECTS:.o=.d)
else
ifneq ($(MAKECMDGOALS),clean)
-include $(DEBUG_OBJECTS:.o=.d)
endif
endif

View File

@ -1 +0,0 @@
T.J. Mather <tjmather@maxmind.com>

View File

@ -1,509 +0,0 @@
[ Note that while the core GeoIP library is licensed under the
LGPL, the libGeoIPUpdate library depends on md5.c and types.h
which are licensed under the GPL. ]
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

View File

@ -1,628 +0,0 @@
1.4.8
* Fix GEOIP_DOMAIN_EDITION_V6 ( Boris Zentner )
* Add new Datatypes GEOIP_NETSPEED_EDITION_REV1_V6 and
GEOIP_NETSPEED_EDITION_REV1 ( Boris Zentner )
* Fix possible directory traversal weakness in geoipupdate-pureperl.pl with
malicious update server ( Boris Zentner )
* Fix GEOIP_ORG_EDITION_V6 and GEOIP_ISP_EDITION_V6 ( Boris Zentner )
1.4.7
* Upd timezone.c Add SX, BQ and CW remove AN and FX ( Boris Zentner )
* Add support for the new types in geoiplookup6 ( Boris Zentner )
* Add new database types GEOIP_CITY_EDITION_REV0_V6,
GEOIP_CITY_EDITION_REV1_V6, GEOIP_DOMAIN_EDITION_V6,
GEOIP_ORG_EDITION_V6 and GEOIP_ISP_EDITION_V6 ( Boris Zentner )
* Remove AN and FX. Add SX, BQ and CW ( Boris Zentner )
* Fix possible segfault in geoipupdate if the connection disappear
unexpected. ( Boris Zentner )
* Add sanity check for geoipupdate-pureperl.pl ( Boris Zentner )
* Add GEOIP_USERTYPE_EDITION and GEOIP_USERTYPE_EDITION_V6
datatypes ( Boris Zentner )
* Add new functions GeoIP_is_private_ipnum_v4 and GeoIP_is_private_v4
( Boris Zentner )
* Add new functions GeoIP_teredo and GeoIP_enable_teredo.
teredo is enabled by default ( Boris Zentner )
* Fix output of geoiplookup for unknown or private regions.
( Boris Zentner )
* Fix geoipupdate-pureperl.pl to accept more product codes.
( Boris Zentner )
* Fix minor output issue in geoipupdate -v ( Boris Zentner )
* Add support for various databases. ( Boris Zentner )
* Add experimental teredo support ( Boris Zentner )
* Fix possible buffer overflow in conjunction with
http_proxies ( Elso Andras )
* Remove memcpy/bcopy macro for BSD ( Boris Zentner )
* Add GeoIP_lib_version and GeoIP_cleanup ( Ladar Levison )
* Upd Makefile.vc ( Thomas Winzig )
* Fix typo in DK,18,Midtjylland ( Boris Zentner )
* Update libGeoIP/regionName.c with FIPS codes 20100810 ( Boris Zentner )
* Fix continent codes ( Boris Zentner )
* Fix 3letter country codes for ATA, BVT, IOT, CXR, CCK, ATF, HMD,
MYT, SGS and UMI ( Boris Zentner )
* Fix typo/segfault in GeoIP_id_by_name_v6 ( Boris Zentner )
* Update libGeoIP/regionName.c with FIPS codes 20100529 ( Boris Zentner )
* Remove buffered IO functions, to fix issues with dup'ed file
descriptors ( Boris Zentner )
* Fix very minor memleak in geoipupdate ( Boris Zentner )
* Add GEOIP_CITYCONFIDENCEDIST_EDITION, GEOIP_LARGE_COUNTRY_EDITION
and GEOIP_LARGE_COUNTRY_EDITION_V6 database types ( Boris Zentner )
* Update libGeoIP/regionName.c with FIPS codes 20100422 ( Boris Zentner )
* Update libGeoIP/regionName.c with FIPS codes 20100420 ( Boris Zentner )
* Update libGeoIP/regionName.c with FIPS codes 20100221 ( Boris Zentner )
* Add missing timezones ( Boris Zentner )
* Add missing include for Windows 2000 ( Jaap Keute )
* 'GeoIP Database up to date' and 'Updated database' prints to stdout
instead of stderr ( Boris Zentner )
* Add missing GeoIPRecord_delete to geoiplookup.c ( Piotr Kaczuba )
* Add some IPv4 helper functions
unsigned long GeoIP_addr_to_num(const char *addr);
char * GeoIP_num_to_addr(unsigned long ipnum); ( Boris Zentner )
* Fix default name for the accuracy radius database to GeoIPDistance.dat ( Boris Zentner )
* Add GEOIP_CITYCONFIDENCE_EDITION database type. ( Boris Zentner )
* geoiplookup use GeoIPDistance.dat files if avail ( Boris Zentner )
* Fix geoiplookup/geoiplookup6 output, when the databaseinfo string is
not avail. ( Boris Zentner )
* Change continent code for RU from AS to EU ( Boris Zentner )
* Add GEOIP_ACCURACYRADIUS_EDITION database type. ( Boris Zentner )
* Add GEOIP_LOCATIONA_EDITION the database to map back from binary to
the csv database ( Boris Zentner )
* Change Turkey's continent code from Asia to Europe ( Boris Zentner )
* Rename _iso_8859_1__utf8 to _GeoIP_iso_8859_1__utf8 ( Boris Zentner )
* GEOIP_ORG_EDITION, GEOIP_ISP_EDITION, GEOIP_DOMAIN_EDITION and
GEOIP_ASNUM_EDITION databases return UTF8 results, if gi->charset is set
to GEOIP_CHARSET_UTF8 ( Boris Zentner )
* Avoid unnecesary call to gettimeofday when GEOIP_CHECK_CACHE is not set ( John Douglass )
* Delayed loading of changed database files for 60 seconds. To avoid
reading halve written databases ( Boris Zentner )
* Update README.OSX for Leopard and Snow Leopard ( Boris Zentner )
* Add more IPv6 functions ( Boris Zentner )
const char *GeoIP_country_code_by_addr_v6 (GeoIP* gi, const char *addr);
const char *GeoIP_country_code_by_name_v6 (GeoIP* gi, const char *host);
const char *GeoIP_country_code3_by_addr_v6 (GeoIP* gi, const char *addr);
const char *GeoIP_country_code3_by_name_v6 (GeoIP* gi, const char *host);
const char *GeoIP_country_name_by_addr_v6 (GeoIP* gi, const char *addr);
const char *GeoIP_country_name_by_name_v6 (GeoIP* gi, const char *host);
* Make sure that GeoIP_*_v6 functions refuse GEOIP_PROXY_EDITION and
GEOIP_NETSPEED_EDITION databases ( Boris Zentner )
* Update libGeoIP/regionName.c with FIPS codes from 20090723 ( Boris Zentner )
* Fix geoipupdate's -v option to not change the license filename ( Thom May )
* Fix geoipupdate's exit code ( Thom May )
* Add support for ASNUM_EDITION ( Boris Zentner )
* Fix -i output for larger values, sign issue ( Boris Zentner )
* Add -i flag for more information on netmask, range_by_ip and the current network range ( Boris Zentner )
* Add support for DOMAIN_EDITION database type ( Boris Zentner )
* Fix apps/geoipupdate-pureperl.pl output layer on W32 ( Boris Zentner )
1.4.6 2009-02-25
* Fix geoipupdate's my_printf function ( Boris Zentner )
* Fix typo in apps/geoipupdate-pureperl.pl replace PerlIO::Gzip with PerlIO::gzip ( Boris Zentner )
* Update region codes in libGeoIP/regionName.c ( Boris Zentner )
* Fix regioncode/generate_regionName.pl to handle regioncodes with ',' correct ( Boris Zentner )
* Update fips codes 20090201 ( Boris Zentner )
* Fix unicode builds on WIN32 and eliminate some warnings ( Stu Redman )
* Fix sign error in _iso_8859_1__utf8 for PPC64 ( Boris Zentner )
* Change WIN32 to _WIN32, since _WIN32 is defined by default. _WIN32 is also defined for WIN64 machines ( Boris Zentner )
! Remove the WSAStartup call from GeoIP_open. All Applications need to call WSAStartup and WSACleanup to initialize the Windows Socket library. Before they use any of the GeoIP_*_by_name functions. ( Boris Zentner )
* geoiplookup and test-geoip-* output N/A instead of (null) ( Boris Zentner )
* Silence various warnings. ( Boris Zentner )
* Add more timezone region's for Australia
* Fix possible segfault in apps/geoiplookup with null pointers in non gnu printf implementations for example solaris ( Boris Zentner )
* Add README.OSX to build fat binaries easy ( Boris Zentner )
* Silence vasprintf warning via AC_GNU_SOURCE ( Boris Zentner )
* Add several Makefiles to build a static GeoIP.lib for w32 ( Stanislaw Pusep and Randy Kobes )
* Silence signedness warnings ( Peter Volkov )
* Remove --with-city configure option. ( Boris Zentner )
* Remove configure's --with-dbdir option. Use the similar --datadir instead ( Peter Volkov )
* Various autotools improvements and cleanups. Including parallel
build fix ( Peter Volkov )
* Fix libGeoIP/timeZone.c ( Martin Haller )
* Fix timezone/generate_timeZone.pl ( Boris Zenter )
* Sync FIPS codes again Jan 14th, 2009 ( Boris Zentner )
* Fix CA,NL regioncode. ( Boris Zentner )
* Change logic in generate_regionName.pl and GeoIP_region_name_by_code to handle any mixture of two letter fips codes matching [A-Z0-9]{2} the change allow GZ and WE region codes ( Boris Zentner )
* Sync regionName.c with http://www.maxmind.com/app/fips10_4 from Dec 17th, 2008 ( Boris Zentner )
* Fix _GeoIP_lookupaddress for 64bit big endian systems like ppc64 ( Peter Volkov )
* Add proper WIN32/64 support ( Gerald Combs )
* Escape - in all manpages ( Patrick Matthaei )
* Add manpage for geoiplookup6 ( Boris Zentner )
* Fix -d command line option ( Klaus Heinz )
* GeoIPUpdate.c use vasprintf if avail, otherwise try vsnprintf and sprintf ( Boris Zentner )
* avoid pre/postincrement and assignment on the same variable ( Boris Zentner )
1.4.5 2008-09-16
* metro_code replace the depreciated dma_code field ( Boris Zentner )
* Add new function GeoIP_range_by_ip_delete
r = GeoIP_range_by_ip(gi, '24.24.24.24');
...
GeoIP_range_by_ip_delete(r); ( Boris Zentner )
* Fix small memoryleak and wrap around in GeoIP_range_by_ip ( Boris Zentner )
* CHECK_CACHE stat the database file not faster than once a second anymore ( Patrick McManus )
* Fixed a typo in the geoipupdate(1) manpage and also an non-existent path on Debian (Patrick Matthäi)
* Fixes two little format errors (hyphen used as minus sign) in both manpages (Patrick Matthäi)
* Sync regionName.c with a recent fips code list ( Boris Zentner )
* Fix segfault when open failed for a custom file (-f) ( Boris Zentner )
* Fix sync geoiplookup's man page with the code ( Klaus Heinz )
* remove unused code from GeoIP_country_name_by_addr and GeoIP_country_code3_by_addr ( Boris Zentner )
* Fix geoiplookup and geoiplookup6 to distinguish between failed namelookups and unknown ips ( Boris Zentner )
* add geoiplookup6 that can handle the new database type GEOIP_COUNTRY_EDITION_V6 ( Boris Zentner )
* add new functions to handle ipv6
GEOIP_API const char *GeoIP_country_name_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum);
GEOIP_API const char *GeoIP_country_code_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum);
GEOIP_API const char *GeoIP_country_code3_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum);
GEOIP_API char *GeoIP_org_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum);
GEOIP_API char *GeoIP_org_by_addr_v6 (GeoIP* gi, const char *addr);
GEOIP_API char *GeoIP_org_by_name_v6 (GeoIP* gi, const char *name);
GEOIP_API int GeoIP_id_by_addr_v6 (GeoIP* gi, const char *addr);
GEOIP_API int GeoIP_id_by_name_v6 (GeoIP* gi, const char *host);
GEOIP_API int GeoIP_id_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum);
GEOIP_API GeoIPRegion * GeoIP_region_by_addr_v6 (GeoIP* gi, const char *addr);
GEOIP_API GeoIPRegion * GeoIP_region_by_name_v6 (GeoIP* gi, const char *host);
GEOIP_API GeoIPRegion * GeoIP_region_by_ipnum_v6 (GeoIP *gi, geoipv6_t ipnum);
GEOIP_API void GeoIP_assign_region_by_inetaddr_v6(GeoIP* gi, geoipv6_t inetaddr, GeoIPRegion *gir);
GEOIP_API char *GeoIP_name_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum);
GEOIP_API char *GeoIP_name_by_addr_v6 (GeoIP* gi, const char *addr);
GEOIP_API char *GeoIP_name_by_name_v6 (GeoIP* gi, const char *name);
# allowed input for addr
2001:4860:0:1001::68
::85.8.93.71
::1
::5508::5d47
::ffff:5508::5d47
# allowed input for host
ipv6.google.com
2001:4860:0:1001::68
::85.8.93.71
::1
::5508::5d47
::ffff:5508::5d47
( Boris Zentner )
* Fix geoiplookup usage string ( add -d -f ) ( Boris Zentner )
* Added GeoIP_range_by_ip, returns the start and end IP address for the range containing the IP address.
This range has a constant value in the GeoIP database.
* Add geoipupdate-pureperl.pl a alternative geoipupdate version. with Proxy Server support via via the "http_proxy" environment variable. Easy to customize. ( Boris Zentner )
* Add WIN64 since WIN32 is not defined on WIN64 Systems ( Boris Zentner )
* Fix WIN32 compilation by encircle all MMAP functions with #ifdef WIN32 #endif pairs. MMAP is not avail in W32 ( Boris Zentner )
* Update timezone/generate_timeZone.pl ( Boris Zentner )
* Update libGeoIP/timeZone.c ( Boris Zentner )
* Added GeoIP_printf and GeoIP_fprintf as a experimental feature to
libGeoIPUpdate. ( Boris Zentner, Andrew Droffner )
* Added cast in _iso_8859_1__utf8 function to fix NetWare/Win32 compilation issue (Guenter Knauf)
* Add HTTP Proxy Server support for geoipupdate via the "http_proxy"
environment variable.
ie: export http_proxy="http://proxy-hostname:port"
( Andrew Droffner, Derek Nicol )
* Notice, that __YOU__ need to free the results of
GeoIP_database_info
GeoIP_name_by_ipnum
GeoIP_name_by_addr
GeoIP_name_by_name
GeoIP_org_by_ipnum
GeoIP_org_by_addr
GeoIP_org_by_name
not libgeoip
( Boris Zentner, Andrew Cheung )
* Fixed segfault with geoiplookup, if used with a custom_file database, that
could not be opened. ( Boris Zentner )
* Add Usage info for options -f and -d in geoipupdate ( Boris Zentner )
* Fixed segfault with geoipupdate when called with a illformed license file
( Boris Zentner )
* Update add more timezones to GeoIP_time_zone_by_country_and_region
( Boris Zentner )
* Add array access functions so programs can avoid accessing the
arrays directly which whould break binary compatability (Ludwig Nussel at SUSE)
* Updated README to state API is only thread-safe if GEOIP_CHECK_CACHE is not used
1.4.4 2008-1-21
* Updated original geoipupdate to return "Invalid product ID or subscription expired"
* Added BL/Saint Barthelemy, MF/Saint Martin (ISO-3166-1 additions)
* Check for illegal IP strings, return 0 if IP is not well formed IPv4 e.g. 1.2.3.4.5 and 1.2.3
* Clarified that while core GeoIP library is LGPL, libGeoIPUpdate depends on md5.c and types.h which are GPL.
* speedup the conversion from ipstring to ipnum in _GeoIP_addr_to_num. Doubles the speed of GEOIP_MEMORY_CACHE and GEOIP_MMAP_CACHE
* Added new mmap shared memory caching option, GEOIP_MMAP_CACHE (Peter Shipley, LookSmart)
- mmaps: our maps are shared, but we need only private readonly pages
1.4.3 2007-8-30
! CHANGE with geoiplookup facility: -v flag now returns database info for all databases, not just GeoIP Country
* Added ability to get netmask of network block from last lookup using GeoIP_last_netmask
* Fixed GeoIP_database_info bug with GeoLite City
* Replaced 4 with sizeof(char*) to fix issues with geoipupdate on 64 Bit machines
* Added GeoIP_set_charset function - enables UTF8 output of city name if GEOIP_CHARSET_UTF8 flag is passed
to GeoIP_set_charset
* Fixed segfault issue if calling GeoIP_db_avail before opening a database
* Added continent_code to GeoIP City's record struct (Frank Mather)
1.4.2 2007-2-8
* Added -d flag to enable custom path for geoipupdate utility program (Frank Mather)
* Replaced _WIN32 with WIN32 since WIN32 is already set by compilers
* Moved var definitions to top of code, defined size_t (Guenter Knauf)
* Added Makefile.win32, Makefile.netware, get_ver.awk, geoip.ico to EXTRA_DIST in Makefile.am (Guenter Knauf)
1.4.1 2007-1-2
* Replaced CS/Serbia and Montenegro with RS/Serbia, removed ZR/Zaire, added ME/Montenegro
* Added AX/Aland Islands, GG/Guernsey, IM/Isle of Man, JE/Jersey (ISO-3166-1 changes)
* Added GeoIP_time_zone_by_country_and_region, to lookup zoneinfo timezone by country and region (Frank Mather)
* Added GeoIP_region_name_by_code, to lookup region name from region code (Frank Mather)
* added -f and -d flags to enable custom paths for geoiplookup utility program (Frank Mather)
* Added benchmarks for GeoIP Region and City in test/benchmark.c (Frank Mather)
* Fixed build issue when using --as-needed flag (Diego 'Flameeyes' Pettenò)
* Add sanity checking for filename returned by MaxMind.com server for geoipupdate filename
(Dean Gaudet, arctic.org)
* Fixed memory leaks under error conditions, buffer overflow using sprintf,
and issue where a corrupted cache file could core dump the file
(Nick Galbreath, Right Media Inc)
1.4.0 2006-8-7
* Changed license from GPL to LGPL, so that PHP Extension can be included in PECL (Olivier Hill)
* Rewrote GEOIP_CHECK_CACHE code, fixed numerous bugs
- CheckCache now works if GeoIP file is overwriten by mv command
- Fixed bug where CheckCache kept reloading in GEOIP_STANDARD_MODE
- Fixed segfault issue in GEOIP_MEMORY_CACHE mode
- Fixed garbage data appearing in GEOIP_INDEX_CACHE mode
- Fixed realloc in case realloc returns new memory block (Andre Morozov of Stone Steps)
* Updated geoipupdate to print status messages for each database instead of just last database
* Check that gi is not null before running code in GeoIP_delete
* Fixed alpha-3 codes ordering, replaced TLS,TKM,TUN,TON with TKM,TUN,TON,TLS
* TP/East Timor changed to TL/Timor-Leste, reflecting changes in ISO-3166
* Added Netware and Windows makefiles (Guenter Knauf)
* Fixed NetWare compiler issue with char block[block_size] declaration (Guenter Knauf)
* Updated geoipupdate example to run weekly
1.3.17 2006-5-14
* Fixed headers for Windows/Netware compilation (Guenter Knauf)
* Fixed Received Error -21 (Sanity check database_info string failed)
when running geoipupdate with GeoIP Country when UserId and
productIds were not specified. Bug was introduced in 1.3.15.
1.3.16 2006-4-17
* Fixed compliation error in GeoIPUpdate.c
1.3.15 2006-4-14
* Updated README documentation
* Updated geoipupdate so that it writes file as it is uncompressed instead
of storing entire GeoIP.dat file in memory (Frank Mather)
* Updated geoiplookup so that it returns GeoIP Domain Name if available
(Frank Mather)
* Updated geoipupdate so that it reports whether databases are updated
in non-verbose mode (Frank Mather)
1.3.14 2005-9-7
* Check if byte, ushort, ulong, u16, u32 are defined in configure
script. Fixes compilation issue on FreeBSD systems.
* Check for Big Endian byte order (needed for MD5 code in geoipupdate
to work properly on Mac OS X and other Big Endian processors)
* Fixed GEOIP_CHECK_CACHE mode when used with GEOIP_STANDARD to
only refresh upon file change
* Fixed memory leak when refreshing file in GEOIP_CHECK_CACHE mode
* Updated ltmain.sh to support Debian GNU/k*BSD bug #315425 (Marek Habersack)
* Added lookup functions using IP numeric representation as input (Frank Mather)
* Removed geoipexport
* Replaced Yugoslavia with Serbia and Montenegro
* Updated geoiplookup to only perform country lookup once instead of twice by using GeoIP_id_by_name
1.3.13 2005-8-1
* Fixed autoconf weirdness that resulted in libraries being
installed without .so suffix
1.3.12 2005-7-19
* Removed -lGeoIP from libGeoIPUpdate_la_LIBADD - fixes compilation error
if GeoIP isn't already installed (Thomas Steudten)
1.3.11 2005-7-7
* Fixed gcc warnings and bug. Use int
instead of char for checking the return value of getopt in geoipupdate.c.
Moved the internal functions to GeoIP_internal.h to get rid
of those 'implicit declaration' warnings. (Ludwig Nussel/SUSE)
* Cleaned up name space by prefixing internal functions with
_GeoIP* (Ludwig Nussel/SUSE)
* Memory Leak fix for GeoIP City if fread error
* Added more verbose error messages for geoipupdate (Frank Mather)
* Added check for zlib.h to configure.in
1.3.10 2005-4-17
* Added types.h to Makefile.am - fixes compilation error
1.3.9 2005-4-14
* fixed bug with GEOIP_INDEX_CACHE (Frank Mather)
* fixed segfault issue if GeoIP.dat not found (Frank Mather)
* Updated MD5 checksum code to use GnuPG code which works
on 64bit machines (Frank Mather)
* Fixed memory leak in test-geoip-isp.c and test-geoip-org.c
* Added support for GeoIP Domain Names in geoipupdate
1.3.8 2004-11-7
* Updated geoipupdate to report invalid userID and productID errors
* Check if gethostbyname_r is version that returns int or is other version
- should fix compile errors on Solaris and FreeBSD
* Updated URL to get license key, userId, and product Ids in conf/GeoIP.conf.default
* Updated test case, removed www.asahi.com
* Added support for GEOIP_INDEX_CACHE - which just caches
the most frequently access index portion of the database, resulting
in faster lookups than GEOIP_STANDARD, but less memory usage than
GEOIP_MEMORY_CACHE (Frank Mather)
1.3.7 2004-10-5
* Updated test case, removed www.bundesregierung.de added www.asahi.com
1.3.6 2004-8-8
* Check for gethostbyname_r support in configure (Mac OS X doesn't support gethostbyname_r)
* Made GeoIP City code thread safe
* Fixed bug with geoipupdate reading in product ids
* Added support for GeoIP Netspeed geoipupdate
* Fix memleak in lookupaddress (Ludwig Nussel/SUSE)
* Add prototype for _full_path_to to make 64bit clean
(Ludwig Nussel/SUSE)
* Add return values to test programs (Ludwig Nussel/SUSE)
1.3.5 2004-7-5
* Added more documentation to README file
* Made GEOIP_CHECK_CACHE work with GEOIP_STANDARD mode - reloads filehandle
in case file changes.
* Added GeoIP_country_code_by_ipnum and GeoIP_id_by_ipnum to use
existing ulong IP Address in numeric form instead of having to
convert it to string (Boris Hajduk)
* Made code thread safe by replacing gethostbyname with gethostbyname_r
1.3.4 2004-6-4
* Fixed bug where *.gz file(s) didn't get removed after geoipupdate
1.3.3 2004-6-2
* Added support for NetSpeed lookup to geoiplookup
* inet_addr patch for 64 bit systems (Thomas Steudten)
* Added Support for automated downloads of GeoIP Region, City, ISP and Organization databases (Frank Mather)
* INADDR_NONE Patch for Solaris 9 (John Young)
1.3.2 2004-4-20
* Added support for Maxmind NetSpeed
MinGW patch from Stanislaw Pusep
I was re-compiling Geolizer (http://sysd.org/log.php#glzr) on Win32 so I firstly needed to put up-to-date Win32 compatibility of libGeoIP itself. Fortunately MinGW plataform evolved a lot since last time I used it to compile libGeoIP. I'm sending you the patch with changes required for libGeoIP to work on both Win32 and UN*X. UN*X behavior is unaffected. Now, detailed explanation of what I did at all:
1) Made correct header imports for both Win32 and UN*X. UN*X imports netdb.h & netinet/in.h and Win32 imports windows.h & winsock.h
2) Win32 gethostbyname() is only able to resolve hostnames, it can't convert "127.0.0.1" string to 32-bit IP address. Thus I added lookupaddress() function that safely resolves any string to IP address and replaced all gethostbyname() calls by it.
3) Database files were referenced by pre-compiled static strings. I malloc()ed buffers for file names so they can be changed "on fly". Thus, on Win32 version GeoIP.dat & other files are being seeked in the same directory as executable file or library.
4) Added README.MinGW file with brief explanation on how to get GeoIP working under MinGW system.
1.3.1 2003-11-11
* Check for stdint.h in autoconf (Sean Chittenden)
* prevent the geoipupdate man page from trying to install itself directly in the system directory (Gyepi Sam)
1.3.0 2003-09-29
* Fixed includes to compile on Windows (Fabrice Colin)
* Removed the _addr_to_num() calls from GeoIP_*_by_name()
* _seek_record() optimizations (Maurice Cinquini)
 1) Use a single buf ptr inside the loops.
    Set to the stack buffer or the cached memory the start of the function.
 2) Unroll the i=0,1 loop to allow constant folding.
 3) Unroll the j loop for the common case of j = STANDARD_RECORD_LENGTH
    (I've already done the above changes see attached function.)
    With gcc -O2 calculating x[0] and x[1] for STANDARD_RECORD_LENGTH now
    only takes 15 (was > 100) i80x86 instructions with 6 byte accesses of RAM. 4) only calculate x[0], x[1] when needed, may be a bigger win
than the above since all the other optimizations above only reduced
CPU instructions operating on CPU cached RAM.
! IMPORTANT API Change: Changed GeoIPRegion to have region in structure. Saves space and a malloc.
Since GeoIPRegion.region is no longer a pointer but an in-structure
array so test the first byte of region == 0 rather testing if the region
pointer is NULL. (Maurice Cinquini)
* Added GeoIP_assign_region_by_inetaddr which doesn't do any mallocs and made all other region APIs go thru it (Maurice Cinquini)
* Replaced _h_addr_to_num() with ntohl() and removed _h_addr_to_num() (Maurice Cinquini)
* Fixed bug when IP address not found in region rev1 database (Jason Linhart)
* Added added extern "C" to GeoIPCity.h fixes problems when included in C++ library
1.2.2 2003-08-10
* Added support for GeoIP ISP Edition identifier
* Fixed bug in GeoIP_database_info (Jason Linhart)
* Added support for GeoIP AS Number Edition
! renamed GeoIP_org_by_* functions to GeoIP_name_by_* to reduce confusion
since these functions are used by GeoIP ISP and GeoIP ASNum as well
as GeoIP Organization
* Added support for GeoIP Proxy Edition
! renamed GeoIP_country_id_by_* functions to GeoIP_id_by_*
1.2.1 2003-07-12
* Added GeoIP_record_id_by_addr and GeoIP_next_record functions
* Added support for new GeoIP Region format, including Canadian Provinces
1.2.0 2003-04-26
* Added support for GeoIP City format revision 1, including dma code and area code
* geoiplookup returns results from GeoIP Region, City, ISP and Organization databases
* Standardized location for GeoIP Region, City, ISP and Organization databases
* Added GeoIP_open_type to open database from default location for other dbs besides country
* Added check to make sure that the appropriate database is loaded for each lookup method
* Updated update code to check for first 12 characters of license key
* Added GeoIP_country_continent array to lookup continent by country ID
1.1.9 2003-03-10
* merged windows patch into main code base (Kenneth R. Robinette)
* Changed const int to #define for windows compatibility
1.1.8 2003-03-04
* Fixed bug with city database introduced in 1.1.6
1.1.7 2003-03-04
* Fixed bug introduced in 1.1.6 when run in GEOIP_STANDARD mode
* Added test to test GEOIP_STANDARD
1.1.6 2003-03-03
* Added spec for building RPMs (Ryan Weaver)
* Added support for 4byte records for Organization database
* Changed Taiwan, Province of China to Taiwan
1.1.5 2003-02-10
* Added support for GeoIP Organization database
1.1.4 2002-12-30
* Cast number to int in _num_to_addr in geoipexport (Ralf S. Engelschall)
* Removed printf debug statements from geoipexport
* correct library build ordering (Ralf S. Engelschall)
* ulong -> unsigned long (Sean Chittenden)
1.1.3 2002-12-24
* Added GeoIPUpdate.h to EXTRA_DISTS
* Compile fixes for Solaris, FreeBSD (Michael McClennen, Corris Randall)
* Handle NULL in printf in test-geoip-region
1.1.2 2002-12-16
* Added support for postal codes
* Added geoipexport, program to export bit binary file to
binary tree format and csv format
* Split update code into separate library, GeoIPUpdate.la
* Allow passing NULL callback to GeoIP_update_database function
(Sean Chittenden)
* Added geoipexport program, exports to CSV file
* Added GeoIP_database_edition method
* Changed DATADIR to GEOIPDATADIR
1.1.1 2002-11-07
* Fixed segfault issue with GeoIPRegion_delete
* Handle test failures where lookup returns NULL more gracefully
1.1.0 2002-11-06
* Perform sanity checking before installing datebase using geoipupdate
* Removed file locking, since we install file by renaming instead of writing to it.
* Fixed geoipupdate to check for NULL return value
* Added constants for different editions
* Added O1 code for "Other country", used in per-country city editions
* fixed multi-line string literals warning in test-geoip.c
* Use enum constants for GeoIP_update_database values
* Added GEOIP_CHECK_CACHE option (not working yet)
1.0.10 2002-10-28
* IMPORTANT API Change - Return NULL instead of '--' and 'N/A'
Be sure to check the return value for NULL to avoid segmentation faults!!!!
* Added callback to print messages from GeoIP_update_database
* Moved GeoIPConfFile to geoipupdate.c
* Changed databaseSegments to unsigned int (Chris Gibbs)
* Fixed compiler warnings (Chris Gibbs)
* API Change - GeoIPRegion region member set to NULL when no region available
* Change short int to int (Chris Gibbs)
* Added write/read file locking for GeoIPUpdate.c/GeoIP.c
1.0.9 2002-10-16
* removed -ansi from Makefile.am to avoid compile error on Solaris 8
* Compile fix for FreeBSD Stable (Kimura Fuyuki)
1.0.8 2002-10-05
* Included header required for *BSD (Akinori Musha)
1.0.7 2002-10-05
* Fixed compilation error with GeoIPUpdate.c
1.0.6 2002-10-04
* Moved update code into separate file
* Added md5 checksums to update code
* Fixed memory leak when running geoiplookup -v
* Moved const RECORD_LENGTH to #define RECORD_LENGTH for Windows compatibility
(Randy Kobes)
* Cleaned up GeoIP_new code
1.0.5 2002-09-23
* Supports GeoIP Regional Edition
* Macau is now "Macao" per ISO 3166-1 change
* Romania "ROM" is now "ROU" per ISO 3166-1 change
* Added #define for memcpy -> BSD's bcopy (Chris Gibbs)
* Removed "private" functions from GeoIP.h
1.0.4 2002-08-27
* rewrote _seek_country to use loop instead of recursion for faster performance
* Removed "orphan" nodes from demo database resulting in smaller size (Jason Linhart)
* Moved changes for building windows DLL into separate patch
* Fixed segfaults when passed malformed IP addresses
1.0.3 2002-08-26
* Added more changes for windows compatibility
(Stanislaw Pusep)
* Added benchmark program
1.0.2 2002-08-21
* Open database using "rb" for windows compatibility
(Stanislaw Pusep)
* Removed superfluous inet_ntop command (Stanislaw Pusep)
1.0.1 2002-08-20
* Fixed bug with resolving hostnames
* More fixes for compiler warnings (Chris Gibbs)
* Changed int to unsigned int in _is_ipaddr (Chris Gibbs)
1.0.0 2002-08-12
* Changed license to GPL
* Don't perform Reverse DNS lookups on IP addresses
* Only include getopt.h on Linux (OpenPKG patch)
* Avoid the_license_key_str warning (OpenPKG patch)
* Added license for March 2002 database
0.3.0 2002-08-04
* Added support for 'A2', Satellite Providers
0.2.8 2002-07-30
* Handle malformed input gracefully
* Added section to README on Solaris workarounds
* Added geoipupdate man page
0.2.7 2002-07-27
* Added section to README on automatic updates
* link to socket library on solaris
0.2.6 2002-07-25
* optimized GeoIP_open (Chris Gibbs)
* check for partial file read in GeoIP_open (Chris Gibbs)
* optimized _addr_to_num() (Chris Gibbs)
* changed write and read to send and recv for sockets
* Only install GeoIP.conf and GeoIP.dat if not already installed
0.2.5 2002-07-22
* Added verbose option to GeoIP_update_database
0.2.4 2002-07-22
* Fix for GeoIP_update_database
0.2.3 2002-07-22
* Fixes for FreeBSD
* All calls to malloc are checked for NULL pointer (Chris Gibbs)
* Fixed spelling of "Kazakhstan" (Chris Gibbs)
* Initialize cache_buf to NULL (Chris Gibbs)
* More memory leak fixes (Chris Gibbs)
0.2.2 2002-07-18
* Added update database function
* Fixed memory leak in GeoIP_new (Chris Gibbs)
0.2.1 2002-07-03
* Added support for anonymous proxies
0.2.0 2002-06-23
* Added new memory caching option for improved performance
0.1.7 2002-05-29
* Only add -lnsl for systems that support libnsl
* Added decl for 3 letter country code array to GeoIP.h
0.1.6 2002-05-25
* Added 3 letter country code
0.1.5 2002-05-23
* Added -lnsl fixed compile errors
0.1.4 2002-05-11
* Fixed bugs in demo March 2002 database
0.1.3 2002-04-21
* Fixed bug related to signed int (Brian Grossman)
* Better error handling when hostname not found
* Fixed bug when netmask=32 for netblock
0.1.2 2002-04-20
* Added two new functions, GeoIP_country_id_by_addr
and GeoIP_country_id_by_name.
* Made GeoIP_country_code and GeoIP_country_name
viewable outside of library, to be with with
GeoIP_country_id_by_* functions.
0.1.1 2002-04-07
* GeoIP.h is now installed to includedir
* constructor and destructor are now provided by
GeoIP_new, GeoIP_open, and GeoIP_delete
0.1.0 2002-04-07
* Initial release

View File

@ -1,80 +0,0 @@
Name: @PACKAGE@
Version: @VERSION@
Summary: GeoIP is a C library finds the location of an IP address.
Release: 1
Group: System Environment/Libraries
URL: http://www.maxmind.com/app/c
Vendor: MaxMind LLC
Source0: http://www.maxmind.com/download/geoip/api/c/GeoIP-%{version}.tar.gz
License: GPL
BuildRoot: %{_tmppath}/%{name}-%{version}-root
%description
GeoIP is a C library that enables the user to find geographical and
network information of an IP address.
Included is a free GeoLite Country database
that is updated at the beginning of every month.
To download the latest free GeoLite Country database, go to:
http://www.maxmind.com/app/geoip_country
There is also a free city-level geolocation database, GeoLite City,
available from:
http://www.maxmind.com/app/geolitecity
%package devel
Summary: GeoIP headers, libraries
Group: Development/Libraries
Requires: %name = %{version}
%description devel
This package contain the devel files for GeoIP.
%prep
%setup -q
%build
%configure
make
make check
%install
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
%makeinstall
# Fixup permissions on shared libraries so that findreqs will work right.
chmod 755 $RPM_BUILD_ROOT/%{_libdir}/*
%clean
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%defattr(-,root,root)
%doc AUTHORS COPYING ChangeLog README TODO
%attr(0755,root,root) %{_libdir}/*.so.*.*
%{_bindir}/*
%{_sysconfdir}/*
%dir %{_datadir}/GeoIP
%{_datadir}/GeoIP/*
%{_libdir}/*.so
%{_mandir}/*/*
%files devel
%{_includedir}/*
%{_libdir}/*.a
%{_libdir}/*.la
%changelog
* Fri Apr 14 2006 Thomas Mather <tjmather@maxmind.com>
- Updated description to reference free GeoLite City database
* Thu Jul 7 2005 Thomas Mather <tjmather@maxmind.com>
- Updated description to reflect monthly updates for free country database.
* Mon Sep 8 2003 Dr. Peter Bieringer
- Fix for RHL 9, created a new devel package definition.
* Thu Feb 27 2003 Ryan Weaver <ryanw@falsehope.com>
- Initial RPM Build

View File

@ -1,183 +0,0 @@
Index: GeoIP.c
===================================================================
RCS file: /home/maxmind/geoip/c/libGeoIP/GeoIP.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- GeoIP.c 25 Aug 2002 22:42:48 -0000 1.32
+++ GeoIP.c 27 Aug 2002 06:50:02 -0000 1.33
@@ -23,16 +23,24 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#ifndef _WIN32
#include <netdb.h>
+#endif /* _WIN32 */
#include <assert.h>
#include <sys/types.h> /* for fstat */
#include <sys/stat.h> /* for fstat */
#include "zlib.h"
#include "time.h"
+#ifndef _WIN32
+#include <unistd.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/socket.h>
+#else
+#include <io.h>
+#include <windows.h>
+#endif /* _WIN32 */
#define COUNTRY_BEGIN 16776960;
const int RECORD_LENGTH = 3;
@@ -57,9 +65,66 @@
const char *GeoIPUpdateHost = "updates.maxmind.com";
const char *GeoIPHTTPRequest = "GET /app/update?license_key=%s HTTP/1.0\nHost: updates.maxmind.com\n\n";
+#ifdef _WIN32
+char * _dat_in_module_path () {
+ HMODULE GeoIPdll;
+ struct _stat st;
+ int i;
+ char * buf;
+
+ buf = (char *) malloc(MAX_PATH);
+
+ GeoIPdll = GetModuleHandle("GeoIP.dll");
+ if (!GeoIPdll)
+ {
+ GeoIPdll = GetModuleHandle(NULL);
+ if (!GeoIPdll)
+ return NULL;
+ }
+ GetModuleFileName(GeoIPdll, buf, MAX_PATH);
+ for (i = strlen(buf); (i >= 0) && (buf[i] != '\\'); i--);
+ if (i)
+ {
+ buf[i] = '\0';
+ strcat(buf, "\\");
+ strcat(buf, GeoIPDBFileName);
+ if (_stat(buf, &st) == 0)
+ return buf;
+ }
+
+ free(buf);
+ return NULL;
+}
+
+char * _dat_path_in_regkey () {
+ DWORD lpdwDisposition, type, size = MAX_PATH;
+ HKEY hkGeoIP;
+ char * buf, * filename;
+
+ buf = (char *) malloc(MAX_PATH);
+ filename = (char *) malloc(MAX_PATH);
+
+ if (RegCreateKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\MaxMind\\GeoIP", 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hkGeoIP, &lpdwDisposition) != ERROR_SUCCESS)
+ return NULL;
+ if (RegQueryValueEx(hkGeoIP, "DATADIR", 0, &type, buf, &size) != ERROR_SUCCESS)
+ strcpy(buf, "%SystemRoot%\\SYSTEM32");
+ if (RegSetValueEx(hkGeoIP, "DATADIR", 0, REG_EXPAND_SZ, buf, strlen(buf)) != ERROR_SUCCESS)
+ return NULL;
+ ExpandEnvironmentStrings(buf, filename, MAX_PATH);
+
+ free(buf);
+ strcat(filename, "\\");
+ strcat(filename, GeoIPDBFileName);
+
+ return filename;
+}
+#endif /* _WIN32 */
+
GeoIP* GeoIP_new (int flags) {
char * filename;
GeoIP * gi;
+
+#ifndef _WIN32
filename = malloc(sizeof(char) * (strlen(DATADIR)+strlen(GeoIPDBFileName)+2));
if (filename == NULL)
return NULL;
@@ -67,6 +132,17 @@
strcat(filename, DATADIR);
strcat(filename, "/");
strcat(filename, GeoIPDBFileName);
+#else
+ filename = _dat_in_module_path();
+ if (filename == NULL)
+ filename = _dat_path_in_regkey();
+ if (filename == NULL)
+ {
+ fprintf(stderr,"Unable to query registry for database location\n");
+ return NULL;
+ }
+#endif /* _WIN32 */
+
gi = GeoIP_open (filename, flags);
free(filename);
return gi;
@@ -96,7 +172,7 @@
}
gi->cache = (unsigned char *) malloc(sizeof(unsigned char) * buf.st_size);
if (gi->cache != NULL) {
- if (fread(gi->cache, sizeof(unsigned char), buf.st_size, gi->GeoIPDatabase) != buf.st_size) {
+ if (fread(gi->cache, sizeof(unsigned char), buf.st_size, gi->GeoIPDatabase) != (unsigned) buf.st_size) {
fprintf(stderr,"Error reading file %s\n",filename);
free(gi->cache);
free(gi);
Index: GeoIP.h
===================================================================
RCS file: /home/maxmind/geoip/c/libGeoIP/GeoIP.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- GeoIP.h 20 Aug 2002 00:52:00 -0000 1.19
+++ GeoIP.h 27 Aug 2002 06:50:02 -0000 1.20
@@ -45,25 +45,31 @@
extern const char * GeoIP_country_name[246];
extern const char * GeoIPConfFile;
-GeoIP* GeoIP_new(int flags);
-GeoIP* GeoIP_open(char * filename, int flags);
-void GeoIP_delete(GeoIP* gi);
-const char *GeoIP_country_code_by_addr (GeoIP* gi, const char *addr);
-const char *GeoIP_country_code_by_name (GeoIP* gi, const char *host);
-const char *GeoIP_country_code3_by_addr (GeoIP* gi, const char *addr);
-const char *GeoIP_country_code3_by_name (GeoIP* gi, const char *host);
-const char *GeoIP_country_name_by_addr (GeoIP* gi, const char *addr);
-const char *GeoIP_country_name_by_name (GeoIP* gi, const char *host);
-short int GeoIP_country_id_by_addr (GeoIP* gi, const char *addr);
-short int GeoIP_country_id_by_name (GeoIP* gi, const char *host);
+#ifdef _WIN32
+#define GEOIP_API __declspec(dllexport)
+#else
+#define GEOIP_API
+#endif /* _WIN32 */
-char *GeoIP_database_info (GeoIP* gi);
-short int GeoIP_update_database (GeoIP* gi, char * license_key, int verbose);
+GEOIP_API GeoIP* GeoIP_new(int flags);
+GEOIP_API GeoIP* GeoIP_open(char * filename, int flags);
+GEOIP_API void GeoIP_delete(GeoIP* gi);
+GEOIP_API const char *GeoIP_country_code_by_addr (GeoIP* gi, const char *addr);
+GEOIP_API const char *GeoIP_country_code_by_name (GeoIP* gi, const char *host);
+GEOIP_API const char *GeoIP_country_code3_by_addr (GeoIP* gi, const char *addr);
+GEOIP_API const char *GeoIP_country_code3_by_name (GeoIP* gi, const char *host);
+GEOIP_API const char *GeoIP_country_name_by_addr (GeoIP* gi, const char *addr);
+GEOIP_API const char *GeoIP_country_name_by_name (GeoIP* gi, const char *host);
+GEOIP_API short int GeoIP_country_id_by_addr (GeoIP* gi, const char *addr);
+GEOIP_API short int GeoIP_country_id_by_name (GeoIP* gi, const char *host);
-int _seek_country (GeoIP* gi, const int offset, unsigned long ipnum, int depth);
-unsigned long _addr_to_num (const char *addr);
-unsigned long _h_addr_to_num (unsigned char *addr);
-short int _is_ipaddr (const char *name);
+GEOIP_API char *GeoIP_database_info (GeoIP* gi);
+GEOIP_API short int GeoIP_update_database (GeoIP* gi, char * license_key, int verbose);
+
+GEOIP_API int _seek_country (GeoIP* gi, const int offset, unsigned long ipnum, int depth);
+GEOIP_API unsigned long _addr_to_num (const char *addr);
+GEOIP_API unsigned long _h_addr_to_num (unsigned char *addr);
#ifdef __cplusplus
}

View File

@ -1,365 +0,0 @@
Installation Instructions
*************************
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
2006, 2007, 2008, 2009 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved. This file is offered as-is,
without warranty of any kind.
Basic Installation
==================
Briefly, the shell commands `./configure; make; make install' should
configure, build, and install this package. The following
more-detailed instructions are generic; see the `README' file for
instructions specific to this package. Some packages provide this
`INSTALL' file but do not implement all of the features documented
below. The lack of an optional feature in a given package is not
necessarily a bug. More recommendations for GNU packages can be found
in *note Makefile Conventions: (standards)Makefile Conventions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, and a
file `config.log' containing compiler output (useful mainly for
debugging `configure').
It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=config.cache' or simply `-C') that saves
the results of its tests to speed up reconfiguring. Caching is
disabled by default to prevent problems with accidental use of stale
cache files.
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If you are using the cache, and at
some point `config.cache' contains results you don't want to keep, you
may remove or edit it.
The file `configure.ac' (or `configure.in') is used to create
`configure' by a program called `autoconf'. You need `configure.ac' if
you want to change it or regenerate `configure' using a newer version
of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system.
Running `configure' might take a while. While running, it prints
some messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package, generally using the just-built uninstalled binaries.
4. Type `make install' to install the programs and any data files and
documentation. When installing into a prefix owned by root, it is
recommended that the package be configured and built as a regular
user, and only the `make install' phase executed with root
privileges.
5. Optionally, type `make installcheck' to repeat any self-tests, but
this time using the binaries in their final installed location.
This target does not install anything. Running this target as a
regular user, particularly if the prior `make install' required
root privileges, verifies that the installation completed
correctly.
6. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
7. Often, you can also type `make uninstall' to remove the installed
files again. In practice, not all packages have tested that
uninstallation works correctly, even though it is required by the
GNU Coding Standards.
8. Some packages, particularly those that use Automake, provide `make
distcheck', which can by used by developers to test that all other
targets like `make install' and `make uninstall' work correctly.
This target is generally not run by end users.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. Run `./configure --help'
for details on some of the pertinent environment variables.
You can give `configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here
is an example:
./configure CC=c99 CFLAGS=-g LIBS=-lposix
*Note Defining Variables::, for more details.
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you can use GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'. This
is known as a "VPATH" build.
With a non-GNU `make', it is safer to compile the package for one
architecture at a time in the source code directory. After you have
installed the package for one architecture, use `make distclean' before
reconfiguring for another architecture.
On MacOS X 10.5 and later systems, you can create libraries and
executables that work on multiple system types--known as "fat" or
"universal" binaries--by specifying multiple `-arch' options to the
compiler but only a single `-arch' option to the preprocessor. Like
this:
./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
CPP="gcc -E" CXXCPP="g++ -E"
This is not guaranteed to produce working output in all cases, you
may have to build one architecture at a time and combine the results
using the `lipo' tool if you have problems.
Installation Names
==================
By default, `make install' installs the package's commands under
`/usr/local/bin', include files under `/usr/local/include', etc. You
can specify an installation prefix other than `/usr/local' by giving
`configure' the option `--prefix=PREFIX', where PREFIX must be an
absolute file name.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
PREFIX as the prefix for installing programs and libraries.
Documentation and other data files still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=DIR' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them. In general, the
default for these options is expressed in terms of `${prefix}', so that
specifying just `--prefix' will affect all of the other directory
specifications that were not explicitly provided.
The most portable way to affect installation locations is to pass the
correct locations to `configure'; however, many packages provide one or
both of the following shortcuts of passing variable assignments to the
`make install' command line to change installation locations without
having to reconfigure or recompile.
The first method involves providing an override variable for each
affected directory. For example, `make install
prefix=/alternate/directory' will choose an alternate location for all
directory configuration variables that were expressed in terms of
`${prefix}'. Any directories that were specified during `configure',
but not in terms of `${prefix}', must each be overridden at install
time for the entire installation to be relocated. The approach of
makefile variable overrides for each directory variable is required by
the GNU Coding Standards, and ideally causes no recompilation.
However, some platforms have known limitations with the semantics of
shared libraries that end up requiring recompilation when using this
method, particularly noticeable in packages that use GNU Libtool.
The second method involves providing the `DESTDIR' variable. For
example, `make install DESTDIR=/alternate/directory' will prepend
`/alternate/directory' before all installation names. The approach of
`DESTDIR' overrides is not required by the GNU Coding Standards, and
does not work on platforms that have drive letters. On the other hand,
it does better at avoiding recompilation issues, and works well even
when some directory options were not specified in terms of `${prefix}'
at `configure' time.
Optional Features
=================
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Some packages offer the ability to configure how verbose the
execution of `make' will be. For these packages, running `./configure
--enable-silent-rules' sets the default to minimal output, which can be
overridden with `make V=1'; while running `./configure
--disable-silent-rules' sets the default to verbose, which can be
overridden with `make V=0'.
Particular systems
==================
On HP-UX, the default C compiler is not ANSI C compatible. If GNU
CC is not installed, it is recommended to use the following options in
order to use an ANSI C compiler:
./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
and if that doesn't work, install pre-built binaries of GCC for HP-UX.
On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
parse its `<wchar.h>' header file. The option `-nodtk' can be used as
a workaround. If GNU CC is not installed, it is therefore recommended
to try
./configure CC="cc"
and if that doesn't work, try
./configure CC="cc -nodtk"
On Solaris, don't put `/usr/ucb' early in your `PATH'. This
directory contains several dysfunctional programs; working variants of
these programs are available in `/usr/bin'. So, if you need `/usr/ucb'
in your `PATH', put it _after_ `/usr/bin'.
On Haiku, software installed for all users goes in `/boot/common',
not `/usr/local'. It is recommended to use the following options:
./configure --prefix=/boot/common
Specifying the System Type
==========================
There may be some features `configure' cannot figure out
automatically, but needs to determine by the type of machine the package
will run on. Usually, assuming the package is built to be run on the
_same_ architectures, `configure' can figure that out, but if it prints
a message saying it cannot guess the machine type, give it the
`--build=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name which has the form:
CPU-COMPANY-SYSTEM
where SYSTEM can have one of these forms:
OS
KERNEL-OS
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the machine type.
If you are _building_ compiler tools for cross-compiling, you should
use the option `--target=TYPE' to select the type of system they will
produce code for.
If you want to _use_ a cross compiler, that generates code for a
platform different from the build platform, you should specify the
"host" platform (i.e., that on which the generated programs will
eventually be run) with `--host=TYPE'.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Defining Variables
==================
Variables not defined in a site shell script can be set in the
environment passed to `configure'. However, some packages may run
configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
them in the `configure' command line, using `VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc
causes the specified `gcc' to be used as the C compiler (unless it is
overridden in the site shell script).
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
an Autoconf bug. Until the bug is fixed you can use this workaround:
CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
`configure' Invocation
======================
`configure' recognizes the following options to control how it
operates.
`--help'
`-h'
Print a summary of all of the options to `configure', and exit.
`--help=short'
`--help=recursive'
Print a summary of the options unique to this package's
`configure', and exit. The `short' variant lists options used
only in the top level, while the `recursive' variant lists options
also present in any nested packages.
`--version'
`-V'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`--cache-file=FILE'
Enable the cache: use and save the results of the tests in FILE,
traditionally `config.cache'. FILE defaults to `/dev/null' to
disable caching.
`--config-cache'
`-C'
Alias for `--cache-file=config.cache'.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`--prefix=DIR'
Use DIR as the installation prefix. *note Installation Names::
for more details, including other options available for fine-tuning
the installation locations.
`--no-create'
`-n'
Run the configure checks, but stop before creating any output
files.
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.

View File

@ -1,11 +0,0 @@
INCLUDES = -Wall -ansi
SUBDIRS = \
libGeoIP \
apps \
conf \
data \
test \
man
EXTRA_DIST = README.OSX READMEwin32static.txt README.MinGW READMEwin32.txt GeoIPWinDLL.patch TODO bootstrap GeoIP.spec GeoIP.spec.in Makefile.netware Makefile.vc Makefile.win32 get_ver.awk geoip.ico

View File

@ -1,707 +0,0 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = .
DIST_COMMON = README $(am__configure_deps) $(srcdir)/GeoIP.spec.in \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \
TODO config.guess config.sub depcomp install-sh ltmain.sh \
missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(install_sh) -d
CONFIG_CLEAN_FILES = GeoIP.spec
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-dvi-recursive install-exec-recursive \
install-html-recursive install-info-recursive \
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
distdir dist dist-all distcheck
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
{ test ! -d "$(distdir)" \
|| { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr "$(distdir)"; }; }
am__relativize = \
dir0=`pwd`; \
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
sed_rest='s,^[^/]*/*,,'; \
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
sed_butlast='s,/*[^/]*$$,,'; \
while test -n "$$dir1"; do \
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
if test "$$first" != "."; then \
if test "$$first" = ".."; then \
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
else \
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
if test "$$first2" = "$$first"; then \
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
else \
dir2="../$$dir2"; \
fi; \
dir0="$$dir0"/"$$first"; \
fi; \
fi; \
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
done; \
reldir="$$dir2"
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GEOIP_VERSION_INFO = @GEOIP_VERSION_INFO@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
INCLUDES = -Wall -ansi
SUBDIRS = \
libGeoIP \
apps \
conf \
data \
test \
man
EXTRA_DIST = README.OSX READMEwin32static.txt README.MinGW READMEwin32.txt GeoIPWinDLL.patch TODO bootstrap GeoIP.spec GeoIP.spec.in Makefile.netware Makefile.vc Makefile.win32 get_ver.awk geoip.ico
all: all-recursive
.SUFFIXES:
am--refresh:
@:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \
$(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(top_srcdir)/configure: $(am__configure_deps)
$(am__cd) $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
$(am__aclocal_m4_deps):
GeoIP.spec: $(top_builddir)/config.status $(srcdir)/GeoIP.spec.in
cd $(top_builddir) && $(SHELL) ./config.status $@
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool config.lt
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
$(RECURSIVE_CLEAN_TARGETS):
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
$(am__remove_distdir)
test -d "$(distdir)" || mkdir "$(distdir)"
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
$(am__relativize); \
new_distdir=$$reldir; \
dir1=$$subdir; dir2="$(top_distdir)"; \
$(am__relativize); \
new_top_distdir=$$reldir; \
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
($(am__cd) $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$new_top_distdir" \
distdir="$$new_distdir" \
am__remove_distdir=: \
am__skip_length_check=: \
am__skip_mode_fix=: \
distdir) \
|| exit 1; \
fi; \
done
-test -n "$(am__skip_mode_fix)" \
|| find "$(distdir)" -type d ! -perm -755 \
-exec chmod u+rwx,go+rx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r "$(distdir)"
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir)
dist-lzma: distdir
tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
$(am__remove_distdir)
dist-xz: distdir
tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz
$(am__remove_distdir)
dist-tarZ: distdir
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__remove_distdir)
dist-shar: distdir
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
$(am__remove_distdir)
dist-zip: distdir
-rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir)
$(am__remove_distdir)
dist dist-all: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lzma*) \
lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
*.tar.xz*) \
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
chmod -R a-w $(distdir); chmod a+w $(distdir)
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
test -d $(distdir)/_build || exit 0; \
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& am__cwd=`pwd` \
&& $(am__cd) $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \
&& ({ \
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist \
&& rm -rf $(DIST_ARCHIVES) \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
&& cd "$$am__cwd" \
|| exit 1
$(am__remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
distuninstallcheck:
@$(am__cd) '$(distuninstallcheck_dir)' \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
@if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: check-recursive
all-am: Makefile
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-libtool \
distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
html-am:
info: info-recursive
info-am:
install-data-am:
install-dvi: install-dvi-recursive
install-dvi-am:
install-exec-am:
install-html: install-html-recursive
install-html-am:
install-info: install-info-recursive
install-info-am:
install-man:
install-pdf: install-pdf-recursive
install-pdf-am:
install-ps: install-ps-recursive
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am:
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
install-am install-strip tags-recursive
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am am--refresh check check-am clean clean-generic \
clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \
dist-gzip dist-lzma dist-shar dist-tarZ dist-xz dist-zip \
distcheck distclean distclean-generic distclean-libtool \
distclean-tags distcleancheck distdir distuninstallcheck dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
install-info install-info-am install-man install-pdf \
install-pdf-am install-ps install-ps-am install-strip \
installcheck installcheck-am installdirs installdirs-am \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags tags-recursive uninstall uninstall-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -1,301 +0,0 @@
###################################################################
#
## Makefile for building GeoIP stuff (NetWare version - gnu make)
## To build the binaries you need awk, GNU make and gcc / nlmconv
## or Metrowerks CodeWarrior CommandlineTools.
## Usage: make -f Makefile.netware [all|dist|clean|distclean]
##
## hacked by: Guenter Knauf
#
###################################################################
# Edit the path below to point to the base of your Novell NDK.
ifndef NDKBASE
NDKBASE = c:/novell
endif
# Edit the path below to point to your zlib sources and libs.
ifndef ZLIBSDK
ZLIBSDK = d:/projects/cw/zlib-1.2.3
endif
ifndef DISTDIR
DISTDIR = GeoIP-$(GEOIP_VERSION_STR)-bin-nw
endif
ARCHIVE = $(DISTDIR).zip
# Edit the vars below to change NLM target settings.
TARGETS := $(patsubst apps/%.c,%.nlm,$(wildcard apps/*.c))
DESCR = $(subst .def,,$(notdir $@)) $(GEOIP_VERSION_STR)
COMPANY = MaxMind LLC
COPYR = Copyright (C) 2003-2006 MaxMind LLC All Rights Reserved.
WWWURL = http://www.maxmind.com/app/c
MTSAFE = YES
STACK = 64000
#SCREEN = none
DATADIR = sys:/etc/GeoIP
CONFDIR = sys:/etc
# Comment the line below if you dont want to link with the static libz.lib.
LSTATIC = 1
# Edit the var below to point to your lib architecture.
ifndef LIBARCH
LIBARCH = LIBC
endif
# must be equal to DEBUG or NDEBUG
DB = NDEBUG
# DB = DEBUG
# Optimization: -O<n> or debugging: -g
ifeq ($(DB),NDEBUG)
OPT = -O2
OBJDIR = release
else
OPT = -g
OBJDIR = debug
endif
OBJLIB = lib-$(OBJDIR)
# Include the version info retrieved from header.
-include $(OBJDIR)/version.inc
# Global tools and toolflags used with all compilers.
ZIP = zip -qzR9
CP = cp -afv
MV = mv -fv
# RM = rm -f
# if you want to mark the target as MTSAFE you will need a tool for
# generating the xdc data for the linker; here's a minimal tool:
# http://www.gknw.com/development/prgtools/mkxdc.zip
MPKXDC = mkxdc
# The following line defines your compiler.
ifdef METROWERKS
CC = mwccnlm
else
CC = gcc
endif
# Global flags for all compilers
CFLAGS = $(OPT) -D$(DB) -DNETWARE -nostdinc
CFLAGS += -DGEOIPDATADIR=\"$(DATADIR)\"
CFLAGS += -DSYSCONFDIR=\"$(CONFDIR)\"
ifeq ($(CC),mwccnlm)
LD = mwldnlm
LDFLAGS = -nostdlib $(PRELUDE) $(LDLIBS) $(LIBOBJS) $(OBJDIR)/$(basename $@).o -o $@ -commandfile
AR = mwldnlm
ARFLAGS = -type library -w nocmdline $(OBJDIR)/*.o -o
LIBEXT = lib
CFLAGS += -msgstyle gcc -gccinc -opt nointrinsics -proc 586
CFLAGS += -relax_pointers
#CFLAGS += -w on
ifeq ($(LIBARCH),LIBC)
PRELUDE = $(SDK_LIBC)/imports/libcpre.o
CFLAGS += -align 4
else
PRELUDE = "$(METROWERKS)/Novell Support/Libraries/runtime/prelude.obj"
# CFLAGS += -include "$(METROWERKS)/Novell Support/Headers/nlm_prefix.h"
CFLAGS += -align 1
endif
else
LD = nlmconv
LDFLAGS = -T
AR = ar
ARFLAGS = -cq
LIBEXT = lib
CFLAGS += -fno-builtin -fpack-struct -fpcc-struct-return -fno-strict-aliasing
CFLAGS += -Wall -Wno-unused #-Wno-format # -pedantic
ifeq ($(LIBARCH),LIBC)
PRELUDE = $(SDK_LIBC)/imports/libcpre.gcc.o
else
PRELUDE = $(SDK_CLIB)/imports/clibpre.gcc.o
CFLAGS += -include $(NDKBASE)/nlmconv/genlm.h
endif
endif
DESCR += ($(LIBARCH)) - $(CC) build
NDK_ROOT = $(NDKBASE)/ndk
SDK_CLIB = $(NDK_ROOT)/nwsdk
SDK_LIBC = $(NDK_ROOT)/libc
ifeq ($(LIBARCH),LIBC)
INCLUDES += -I$(SDK_LIBC)/include -I$(SDK_LIBC)/include/nks
# INCLUDES += -I$(SDK_LIBC)/include/winsock
CFLAGS += -D_POSIX_SOURCE
# CFLAGS += -D__ANSIC__
else
INCLUDES += -I$(SDK_CLIB)/include/nlm -I$(SDK_CLIB)/include
# INCLUDES += -I$(SDK_CLIB)/include/nlm/obsolete
CFLAGS += -DNETDB_USE_INTERNET
endif
INCLUDES += -I./libGeoIP
INCLUDES += -I$(ZLIBSDK)
CFLAGS += $(INCLUDES)
ifeq ($(MTSAFE),YES)
XDCOPT = -n
endif
ifeq ($(MTSAFE),NO)
XDCOPT = -u
endif
LIBPATH += -L$(ZLIBSDK)/nw/release
ifdef LSTATIC
LDLIBS += $(ZLIBSDK)/nw/release/libz.$(LIBEXT)
else
IMPORTS += @$(ZLIBSDK)/nw/release/libz.imp
MODULES += libz
endif
ifeq ($(findstring linux,$(OSTYPE)),linux)
DL = '
#-include $(NDKBASE)/nlmconv/ncpfs.inc
endif
vpath %.c ./apps ./libGeoIP
LIBOBJS = $(OBJLIB)/GeoIP.o $(OBJLIB)/GeoIPCity.o
UPDOBJS = $(OBJLIB)/GeoIPUpdate.o $(OBJLIB)/md5.o
LIBOBJS += $(UPDOBJS)
.PRECIOUS: $(OBJLIB)/%.o $(OBJDIR)/%.o $(OBJDIR)/%.def
all: prebuild $(TARGETS)
prebuild: $(OBJLIB) $(OBJDIR) $(OBJDIR)/version.inc
dist: $(DISTDIR) all $(DISTDIR)/readme_bin.txt
@$(CP) *.nlm $(DISTDIR)
@$(CP) Changelog $(DISTDIR)
@$(CP) README $(DISTDIR)
@$(CP) conf/GeoIP.conf.default $(DISTDIR)
@$(CP) data/GeoIP.dat $(DISTDIR)
@echo Creating $(ARCHIVE)
@$(ZIP) $(ARCHIVE) $(DISTDIR)/* < $(DISTDIR)/readme_bin.txt
clean:
-$(RM) -r $(OBJDIR) $(OBJLIB)
-$(RM) $(TARGETS)
distclean:
-$(RM) -r $(DISTDIR)
-$(RM) $(ARCHIVE)
%.nlm: $(OBJDIR)/%.def $(LIBOBJS) $(OBJDIR)/%.o $(OBJDIR)/%.xdc
@echo Linking $@
@-$(RM) $@
@$(LD) $(LDFLAGS) $<
$(DISTDIR):
@mkdir $@
$(OBJDIR):
@mkdir $@
$(OBJLIB):
@mkdir $@
$(OBJDIR)/%.o: %.c
# @echo Compiling $<
$(CC) $(CFLAGS) -c $< -o $@
$(OBJLIB)/%.o: %.c
# @echo Compiling $<
$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/version.inc: configure.in $(OBJDIR)
@echo Creating $@
@awk -f get_ver.awk $< > $@
$(OBJDIR)/%.xdc: Makefile.netware
@echo Creating $@
@$(MPKXDC) $(XDCOPT) $@
$(OBJDIR)/%.def: Makefile.netware
@echo Creating $@
@echo $(DL)# DEF file for linking with $(LD)$(DL) > $@
@echo $(DL)# Do not edit this file - it is created by make!$(DL) >> $@
@echo $(DL)# All your changes will be lost!!$(DL) >> $@
@echo $(DL)#$(DL) >> $@
@echo $(DL)copyright "$(COPYR)"$(DL) >> $@
@echo $(DL)description "$(DESCR)"$(DL) >> $@
@echo $(DL)version $(GEOIP_VERSION)$(DL) >> $@
ifdef NLMTYPE
@echo $(DL)type $(NLMTYPE)$(DL) >> $@
endif
ifdef STACK
@echo $(DL)stack $(STACK)$(DL) >> $@
endif
ifdef SCREEN
@echo $(DL)screenname "$(SCREEN)"$(DL) >> $@
else
@echo $(DL)screenname "DEFAULT"$(DL) >> $@
endif
ifeq ($(DB),DEBUG)
@echo $(DL)debug$(DL) >> $@
endif
@echo $(DL)threadname "$(subst .def,,$(notdir $@))"$(DL) >> $@
ifdef XDCOPT
@echo $(DL)xdcdata $(@:.def=.xdc)$(DL) >> $@
endif
ifeq ($(LDRING),0)
@echo $(DL)flag_on 16$(DL) >> $@
endif
ifeq ($(LDRING),3)
@echo $(DL)flag_on 512$(DL) >> $@
endif
ifeq ($(LIBARCH),CLIB)
@echo $(DL)start _Prelude$(DL) >> $@
@echo $(DL)exit _Stop$(DL) >> $@
@echo $(DL)import @$(SDK_CLIB)/imports/clib.imp$(DL) >> $@
@echo $(DL)import @$(SDK_CLIB)/imports/threads.imp$(DL) >> $@
@echo $(DL)import @$(SDK_CLIB)/imports/nlmlib.imp$(DL) >> $@
@echo $(DL)module clib$(DL) >> $@
else
@echo $(DL)flag_on 64$(DL) >> $@
@echo $(DL)pseudopreemption$(DL) >> $@
@echo $(DL)start _LibCPrelude$(DL) >> $@
@echo $(DL)exit _LibCPostlude$(DL) >> $@
@echo $(DL)check _LibCCheckUnload$(DL) >> $@
@echo $(DL)import @$(SDK_LIBC)/imports/libc.imp$(DL) >> $@
@echo $(DL)import @$(SDK_LIBC)/imports/netware.imp$(DL) >> $@
@echo $(DL)module libc$(DL) >> $@
endif
ifdef MODULES
@echo $(DL)module $(MODULES)$(DL) >> $@
endif
ifdef EXPORTS
@echo $(DL)export $(EXPORTS)$(DL) >> $@
endif
ifdef IMPORTS
@echo $(DL)import $(IMPORTS)$(DL) >> $@
endif
ifeq ($(LD),nlmconv)
ifdef LDLIBS
@echo $(DL)input $(LDLIBS)$(DL) >> $@
endif
@echo $(DL)input $(PRELUDE)$(DL) >> $@
@echo $(DL)input $(LIBOBJS)$(DL) >> $@
@echo $(DL)input $(@:.def=.o)$(DL) >> $@
@echo $(DL)output $(notdir $(@:.def=.nlm))$(DL) >> $@
endif
$(DISTDIR)/readme_bin.txt: Makefile.netware
@echo Creating $@
@echo $(DL)This is a binary distribution for NetWare platform.$(DL) > $@
@echo $(DL)GeoIP version $(GEOIP_VERSION_STR)$(DL) >> $@
ifndef LSTATIC
@echo $(DL)These binaries depend on libz.nlm in the search path!$(DL) >> $@
endif
@echo $(DL)Please download the complete GeoIP package for$(DL) >> $@
@echo $(DL)any further documentation:$(DL) >> $@
@echo $(DL)$(WWWURL)$(DL) >> $@
info:
@echo Targets to build: $(TARGETS)

View File

@ -1,84 +0,0 @@
#NMAKE makefile for Windows developers.
#Produces a static library (GeoIP.lib).
#################################################################
# configuration section
################################################################
# place to put the GeoIP.dat database file
# !!! Please keep the 2 \\ as directory separators !!!
#
GEOIPDATADIR="C:\\Windows\\SYSTEM32"
#
# System inc, lib, and bin directories
!ifndef INSTDIR
INSTDIR="C:\GeoIP-1.4.5"
!endif
# Location where GeoIP.lib should be installed my "make install"
INSTALL_LIB=$(INSTDIR)\Lib
#Location where .h files should be installed by "make install".
INSTALL_INC=$(INSTDIR)\Include
#Location where programs should be installed by "make install".
INSTALL_BIN=$(INSTDIR)\Bin
################################################################
# end configuration section
################################################################
DATA_DIR=data
DATA_FILE=GeoIP.dat
LIB_DIR = libGeoIP
TEST_DIR=test
APP_DIR=apps
GEOIP_LIB = GeoIP.lib
APP_PROGRAMS = geoiplookup.exe
TEST_PROGRAMS = benchmark.exe test-geoip.exe
all: GeoIP.lib test_progs app_progs
$(GEOIP_LIB):
cd $(LIB_DIR)
$(MAKE) -nologo -f Makefile.vc GEOIPDATADIR=$(GEOIPDATADIR)
cd ..
test_progs:
cd $(TEST_DIR)
$(MAKE) -nologo -f Makefile.vc
cd ..
app_progs:
cd $(APP_DIR)
$(MAKE) -nologo -f Makefile.vc
cd ..
test: $(GEOIP_LIB) test_progs
cd $(TEST_DIR)
benchmark.exe
test-geoip.exe
cd ..
install: $(GEOIP_LIB) app_progs
cd $(LIB_DIR)
copy $(GEOIP_LIB) $(INSTALL_LIB)
copy *.h $(INSTALL_INC)
cd ..\$(APP_DIR)
copy $(APP_PROGRAMS) $(INSTALL_BIN)
cd ..\$(DATA_DIR)
copy $(DATA_FILE) $(GEOIPDATADIR)
cd ..
clean:
del $(LIB_DIR)\*.obj $(LIB_DIR)\*.lib \
$(APP_DIR)\*.obj $(APP_DIR)\*.exe \
$(TEST_DIR)\*.obj $(TEST_DIR)\*.exe

View File

@ -1,232 +0,0 @@
###################################################################
#
## Makefile for building GeoIP stuff (Win32 version - gnu make)
## To build the binaries you need awk, GNU make and MingW32 gcc
## or Metrowerks CodeWarrior CommandlineTools.
## Usage: make -f Makefile.win32 [all|dist|clean|distclean]
##
## hacked by: Guenter Knauf
#
###################################################################
# Edit the path below to point to your zlib sources and libs.
ifndef ZLIBSDK
ZLIBSDK = d:/projects/mingw32/zlib-1.2.3
endif
ifndef DISTDIR
DISTDIR = GeoIP-$(GEOIP_VERSION_STR)-bin-w32
endif
ARCHIVE = $(DISTDIR).zip
# Edit the vars below to change EXE target settings.
TARGETS := $(patsubst apps/%.c,%.exe,$(wildcard apps/*.c))
DESCR = $(subst .rc,,$(notdir $@)) $(GEOIP_VERSION_STR)
COMPANY = MaxMind LLC
COPYR = © 2003-2006 MaxMind LLC All Rights Reserved.
WWWURL = http://www.maxmind.com/app/c
LICENSE = Licensed under LGPL
ICON = geoip.ico
DATADIR = c:/GeoIP
CONFDIR = c:/GeoIP
# Comment the line below if you dont want to link with the static libz.lib.
LSTATIC = 1
# must be equal to DEBUG or NDEBUG
DB = NDEBUG
# DB = DEBUG
# Optimization: -O<n> or debugging: -g
ifeq ($(DB),NDEBUG)
OPT = -O2
OBJDIR = release
else
OPT = -g
OBJDIR = debug
endif
OBJLIB = lib-$(OBJDIR)
# Include the version info retrieved from header.
-include $(OBJDIR)/version.inc
# Global tools and toolflags used with all compilers.
ZIP = zip -qzR9
CP = cp -afv
MV = mv -fv
# RM = rm -f
RE = reimp -d
DLLTOOL = dlltool
DTFLAGS = -k
# The following line defines your compiler.
ifdef METROWERKS
CC = mwcc
else
CC = gcc
endif
# Global flags for all compilers
CFLAGS = $(OPT) -D$(DB) -D_WIN32
# -nostdinc
CFLAGS += -DHAVE_STDINT_H
CFLAGS += -DGEOIPDATADIR=\"$(DATADIR)\"
CFLAGS += -DSYSCONFDIR=\"$(CONFDIR)\"
ifeq ($(CC),mwcc)
LD = mwld
LDFLAGS = -nostdlib
LIBPATH = -lr "$(METROWERKS)/MSL" -lr "$(METROWERKS)/Win32-x86 Support/Libraries"
CWLIBS = -lMSL_Runtime_x86.lib -lMSL_C_x86.lib -lMSL_Extras_x86.lib
LDLIBS = -lkernel32.lib -luser32.lib $(CWLIBS)
AR = mwld
ARFLAGS = -type library -w nocmdline $(OBJDIR)/*.o -o
LIBEXT = lib
RC = mwwinrc
CFLAGS += -nostdinc
CFLAGS += -msgstyle gcc -gccinc -opt nointrinsics -proc 586
CFLAGS += -relax_pointers
#CFLAGS += -w on
CFLAGS += -ir "$(METROWERKS)/MSL" -ir "$(METROWERKS)/Win32-x86 Support/Headers"
else
LD = gcc
LDFLAGS = -s
AR = ar
ARFLAGS = -cq
LIBEXT = a
RC = windres
RCFLAGS = -I rc -O coff -i
CFLAGS += -Wall -Wno-unused # -Wno-format #-pedantic
endif
INCLUDES += -I./libGeoIP
INCLUDES += -I$(ZLIBSDK)
CFLAGS += $(INCLUDES)
LDLIBS += -lwsock32
LIBPATH += -L$(ZLIBSDK)
ifdef LSTATIC
LDLIBS += -lz
else
LDLIBS += -lzdll
endif
ifeq ($(findstring linux,$(OSTYPE)),linux)
DL = '
#-include $(NDKBASE)/nlmconv/ncpfs.inc
endif
vpath %.c ./apps ./libGeoIP
LIBOBJS = $(OBJLIB)/GeoIP.o $(OBJLIB)/GeoIPCity.o
UPDOBJS = $(OBJLIB)/GeoIPUpdate.o $(OBJLIB)/md5.o
LIBOBJS += $(UPDOBJS)
.PRECIOUS: $(OBJLIB)/%.o $(OBJDIR)/%.o $(OBJDIR)/%.rc
all: prebuild $(TARGETS)
prebuild: $(OBJLIB) $(OBJDIR) $(OBJDIR)/version.inc
dist: $(DISTDIR) all $(DISTDIR)/readme_bin.txt
@$(CP) *.exe $(DISTDIR)
@$(CP) Changelog $(DISTDIR)
@$(CP) README $(DISTDIR)
@$(CP) conf/GeoIP.conf.default $(DISTDIR)
@$(CP) data/GeoIP.dat $(DISTDIR)
@echo Creating $(ARCHIVE)
@$(ZIP) $(ARCHIVE) $(DISTDIR)/* < $(DISTDIR)/readme_bin.txt
clean:
-$(RM) -r $(OBJDIR) $(OBJLIB)
-$(RM) $(TARGETS)
distclean:
-$(RM) -r $(DISTDIR)
-$(RM) $(ARCHIVE)
%.exe: $(OBJDIR)/%.res $(LIBOBJS) $(OBJDIR)/%.o
@echo Linking $@
@-$(RM) $@
$(LD) $(LDFLAGS) -o $@ $^ $(LIBPATH) $(LDLIBS)
# $(LD) $(LDFLAGS) $(LIBPATH) $(LIBFILES) -o $@ $^
$(DISTDIR):
@mkdir $@
$(OBJDIR):
@mkdir $@
$(OBJLIB):
@mkdir $@
$(OBJDIR)/%.o: %.c
# @echo Compiling $<
$(CC) $(CFLAGS) -c $< -o $@
$(OBJLIB)/%.o: %.c
# @echo Compiling $<
$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/version.inc: configure.in $(OBJDIR)
@echo Creating $@
@awk -f get_ver.awk $< > $@
$(OBJDIR)/%.res: $(OBJDIR)/%.rc
@echo Creating $@
@$(RC) $(RCFLAGS) $< -o $@
$(OBJDIR)/%.rc: Makefile.win32
@echo 1 VERSIONINFO > $@
@echo FILEVERSION $(GEOIP_VERSION),0 >> $@
@echo PRODUCTVERSION $(GEOIP_VERSION),0 >> $@
@echo FILEFLAGSMASK 0x3fL >> $@
@echo FILEOS 0x40004L >> $@
@echo FILEFLAGS 0x0L >> $@
@echo FILETYPE 0x1L >> $@
@echo FILESUBTYPE 0x0L >> $@
@echo BEGIN >> $@
@echo BLOCK "StringFileInfo" >> $@
@echo BEGIN >> $@
@echo BLOCK "040904E4" >> $@
@echo BEGIN >> $@
@echo VALUE "LegalCopyright","$(COPYR)\0" >> $@
ifdef COMPANY
@echo VALUE "CompanyName","$(COMPANY)\0" >> $@
endif
ifdef LICENSE
@echo VALUE "License","$(LICENSE)\0" >> $@
endif
@echo VALUE "ProductName","$(basename $(notdir $@))\0" >> $@
@echo VALUE "ProductVersion","$(GEOIP_VERSION_STR)\0" >> $@
@echo VALUE "FileDescription","$(DESCR)\0" >> $@
@echo VALUE "FileVersion","$(GEOIP_VERSION_STR)\0" >> $@
@echo VALUE "InternalName","$(basename $(notdir $@))\0" >> $@
@echo VALUE "OriginalFilename","$(basename $(notdir $@)).exe\0" >> $@
@echo VALUE "WWW","$(WWWURL)\0" >> $@
@echo END >> $@
@echo END >> $@
@echo BLOCK "VarFileInfo" >> $@
@echo BEGIN >> $@
@echo VALUE "Translation", 0x409, 1252 >> $@
@echo END >> $@
@echo END >> $@
ifdef ICON
@echo 10 ICON DISCARDABLE "$(ICON)" >> $@
endif
$(DISTDIR)/readme_bin.txt: Makefile.win32
@echo Creating $@
@echo $(DL)This is a binary distribution for Win32 platform.$(DL) > $@
@echo $(DL)GeoIP version $(GEOIP_VERSION_STR)$(DL) >> $@
ifndef LSTATIC
@echo $(DL)These binaries depend on zlib1.dll in the search path!$(DL) >> $@
endif
@echo $(DL)Please download the complete GeoIP package for$(DL) >> $@
@echo $(DL)any further documentation:$(DL) >> $@
@echo $(DL)$(WWWURL)$(DL) >> $@
info:
@echo Targets to build: $(TARGETS)

View File

@ -1,208 +0,0 @@
GeoIP 1.4.8
-----------
*** Experimental IPv6 notice ***
- the experimental IPv6 part of libGeoIP may change in the future.
- It is possible, that geoiplookup and geoiplookup6 will merged.
***
The new perl script geoipupdate-pureperl.pl is a drop in replacement for
geoipupdate. Useful, if you like to customize, pre or postprocess new or
old databases. To archive the databases or signal apache whatever.
Another advantage is, that geoipupdate-pureperl.pl is able to handle proxy
requests even with authentication.
IMPORTANT API Change for 1.3.x and above users for GeoIP Region database
GeoIPRegion.region is no longer a pointer but an in-structure
array so test the first byte of region == 0 rather testing if the region
pointer is NULL.
IMPORTANT API Change for 1.1.x and above users - as of GeoIP 1.1.0 the
GeoIP_country_xxx_by_xxx functions return NULL if a country can not
be found (it used to return '--' or 'N/A'. Be sure to check the
return value for NULL, to avoid segmentation faults!
GeoIP is a C library that enables the user to find geographical and
network information of an IP address.
Included is a free GeoLite Country database
that is updated at the beginning of every month.
To download the latest free GeoLite Country database, go to:
http://www.maxmind.com/app/geoip_country
There is also a free city-level geolocation database, GeoLite City,
available from:
http://www.maxmind.com/app/geolitecity
We also offer commercial GeoIP databases with greater accuracy and
additional network information, for more details, see:
http://www.maxmind.com/app/products
As of version 1.4.5 geoipupdate can handle updates via HTTP Proxy Server.
If the environ variable http_proxy="http://proxy-host:port" is set.
The username:password (as in FTP URLs) is not supported!
Thanks to Andrew Droffner for the patch!
As of version 1.3.6, the GeoIP C library is thread safe, as long as
GEOIP_CHECK_CACHE is not used.
This module can be used to automatically select the geographically closest
mirror, to analyze your web server logs to determine the countries of your
visitors, for credit card fraud detection, and for software export controls.
If you use GeoIP to block access from high risk countries in order
to reduce fraud or abuse, you should also block access from known
proxy servers. For more details, see:
http://www.maxmind.com/app/proxy
To install, run:
./configure
make
make check
make install
The GeoIP C library relies on GNU make, not on BSD make
MEMORY CACHING AND OTHER OPTIONS
There are four options available:
GEOIP_STANDARD - read database from filesystem, uses least memory.
GEOIP_MEMORY_CACHE - load database into memory, faster performance
but uses more memory
GEOIP_CHECK_CACHE - check for updated database. If database has been updated,
reload filehandle and/or memory cache.
GEOIP_INDEX_CACHE - just cache
the most frequently accessed index portion of the database, resulting
in faster lookups than GEOIP_STANDARD, but less memory usage than
GEOIP_MEMORY_CACHE - useful for larger databases such as
GeoIP Organization and GeoIP City. Note, for GeoIP Country, Region
and Netspeed databases, GEOIP_INDEX_CACHE is equivalent to GEOIP_MEMORY_CACHE
GEOIP_MMAP_CACHE - load database into mmap shared memory ( MMAP is not avail for WIN32 )
The options can be combined using bit operators. For example you can
use both GEOIP_MEMORY_CACHE and GEOIP_CHECK_CACHE by calling:
GeoIP_open("/path/to/GeoIP.dat", GEOIP_MEMORY_CACHE | GEOIP_CHECK_CACHE);
By default, the city name is returned in iso-8859-1 charset. To obtain the
city name in utf8 instead, run:
GeoIP_set_charset(gi, GEOIP_CHARSET_UTF8);
To get the netmask of the netblock of the last lookup, use GeoIP_last_netblock(gi).
EXAMPLES
See
test/
test-geoip.c
test-geoip-region.c
test-geoip-city.c
test-geoip-isp.c
test-geoip-org.c
test-geoip-netspeed.c
for examples of how to use the API. The test-geoip.c program works with both the GeoLite and
GeoIP Country databases. The test-geoip-city.c program works with both the GeoLite and
GeoIP City databases. The other example programs require the paid databases available
from http://www.maxmind.com/app/products
AUTOMATIC UPDATES
MaxMind offers a service where you can have your database updated
automically each week. For more details see:
http://www.maxmind.com/app/license_key
RESOURCES Mailinglists
Please join the very low traffic mailinglists you are interested in.
http://sourceforge.net/mail/?group_id=66844
Preformance Patches.
Patrick McManus provide a patch to enhance the lookupspeed in MEMORY_CACHE mode. If you feel, that the current MEMORY_CACHE mode is to slow try the patch:
http://sourceforge.net/mailarchive/forum.php?forum_name=geoip-c-discuss&max_rows=25&style=nested&viewmonth=200803
TROUBLESHOOTING
If you run into trouble building your application with GeoIP support, try adding -fms-extensions to your CFLAGS. If you use Solaris and there C-Compiler use -features=extensions instead. These options enable unnamed union support and fix problems like: 'improper member use: dma_code' or 'GeoIPRecord' has no member named 'dma_code'.
Note that it is recommended that you use GNU make. Also, if you are using
OpenBSD, GeoIP requires OpenBSD 3.1 or greater.
if you get "cannot load shared object file: No such file or directory"
error, add the directory libGeoIP.so was installed to to /etc/ld.so.conf
and run ldconfig
On Solaris, if you get a
ld: fatal: relocations remain against allocatable but non-writable sections
error, try running
# make clean
# ./configure --disable-shared
# make
If you get a "ar : command not found" error, make sure that ar is
in your path. On Solaris, ar is typically found in /usr/ccs/bin
If you get a "geoipupdate.c:24: getopt.h: No such file or directory"
error, run
# export CPPFLAGS="-I/usr/local/include"
(assuming that getopt.h is in /usr/local/include)
If you get a "zlib.h: No such file or directory" error, make sure
that the zlib development libraries are installed on your server.
These are typically included in a "zlib-devel" package.
If you get a "bad interpreter: No such file or directory" error
when running ./configure, make sure that there are no DOS
returns in the configure script. To remove DOS returns,
run perl -pi -e 's!\r!!g' configure.
If gcc fails while consuming a large amount of memory, try
compiling with CFLAGS=-O1 (or -O0) instead of the default -O2.
It seems that some
versions of gcc have a bug and consume 1 GB of memory when optimizing
certain source files (the other source file where this was reported is
from XORG X-Server). It happens at least with gcc 3.3.1 and with gcc
4.2(.0). Thanks to Kai Schätzl for the report.
If GEOIP_MMAP_CACHE doesn't work on a 64bit machine, try adding
the flag "MAP_32BIT" to the mmap call.
If you get a "passing argument 3 of 'gethostbyname_r' from incompatible pointer type"
error on AIX, download and/or untar a fresh copy of GeoIP. ( To avoid cached
results from a previous ./configure run )
cd ./GeoIP-1.4.6
then edit the file ./configure
and delete these two lines:
#define HAVE_GETHOSTBYNAME_R 1
#define GETHOSTBYNAME_R_RETURNS_INT 1
then save the configure script
and build it as usual
./configure
make
sudo make install
To submit a patch, please contact support@maxmind.com

View File

@ -1,13 +0,0 @@
# how to build under MinGW/MSYS:
# (first you need to build & "install" zlib)
export "CFLAGS=-O3 -I/usr/local/include"
export "LDFLAGS=-L/usr/local/lib -lwsock32"
./configure
make
cp data/GeoIP.dat test/
make check
# note that GeoIP.dat file should be placed in the
# same place as GeoIP-enabled executable modules!
# there's NO DEFAULT PATH concept on Win32 :)

View File

@ -1,35 +0,0 @@
#!/bin/sh
#
# Building OSX fat binaries is easy.
#
# - start in a clean directory.
# - copy the shell script below to a file and edit the file to your needs.
#
# 1.) modify export GEOIP_ARCH='-arch i386 -arch x86_64 -arch ppc -arch ppc64'
# to include all architectures you need.
# 2.) add whatever you want to the ./configure line.
# 3.) execute the script.
# 4.) do a 'make install'
#
#
# make clean or make distclean before building this
#
# tell systems before leopard that we like to build for 10.5 or higher
# with MACOSX_DEPLOYMENT_TARGET=10.5
# starting with leopard we have to add -mmacosx-version-min=10.5
# to the CFLAGS and export MACOSX_DEPLOYMENT_TARGET!?
## for tiger, leopard and snow leopard you might use this
## export GEOIP_ARCH='-arch i386 -arch x86_64 -arch ppc -arch ppc64'
## export MACOSX_DEPLOYMENT_TARGET=10.4
## export LDFLAGS=$GEOIP_ARCH
## export CFLAGS="-mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk $GEOIP_ARCH"
# here we go for leopard and snow leopard
export GEOIP_ARCH='-arch i386 -arch x86_64 -arch ppc'
export MACOSX_DEPLOYMENT_TARGET=10.5
export LDFLAGS=$GEOIP_ARCH
export CFLAGS="-g -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk $GEOIP_ARCH"
./configure --disable-dependency-tracking
perl -i.bak -pe'/^archive_cmds=/ and !/\bGEOIP_ARCH\b/ and s/-dynamiclib\b/-dynamiclib \\\$(GEOIP_ARCH)/' ./libtool
make

View File

@ -1,44 +0,0 @@
=======================================================
Environmental variables:
1. GeoIPDBFileName is hardcoded to "\\windows\\system32\\GeoIP.dat" on
windows in GeoIP.c
2. #ifdef DLL is used to determine whether you want to have a DLL built
in GeoIP.h
You may want to change these depending on your system configuration
and compiler.
=======================================================
Thanks to Chris Gibbs for supplying these instructions.
The GeoIP C library should work under windows. Note that it requires the zlib
DLL.
To install zlib with GeoIP:
i) Downloda the zlib prebuilt DLL and static library from
http://www.winimage.com/zLibDll/ look for "pre-built zlib DLL".
Unzip it to some location on your hard drive, and in Project-->Settings ,
go to the Link tab, and add the following 3 libraries:
ws2_32.lib
zlib.lib
zlibstat.lib
iii) Go to Tools-->Options, then the Directories tab, and add library paths to
the locations of the zlib static libraries. You will also need to add the
include path to zlib.h to the include paths.
iv) NOTE: These instructions are for MS VC++ 6.0, but should be similar for
previous versions, and for VC .NET.
=======================================================
Building GeoIP as a DLL
Stanislaw Pusep has contributed a patch for building GeoIP as a DLL.
You can find the patch in GeoIPWinDLL.patch
Note a modified version of this patch is now merged into the main code.

View File

@ -1,17 +0,0 @@
To make a static GeoIP.lib, edit the top level
Makefile.vc to reflect where the GeoIP.dat database
file should be placed, as well as the locations
of the lib, include, and bin directories for installation.
Then give the command
nmake /f Makefile.vc
This will build the GeoIP.lib library, as well as available
application and test programs. The command
nmake /f Makefile.vc test
will run available tests in the test/ subdirectory.
nmake /f Makefile.vc install
will then copy the lib and header files to the locations
specified in the top-level Makefile.vc, as well as
available application programs in the apps/ subdirectory.
nmake /f Makefile.vc clean
will remove intermediate object and executable files.

View File

@ -1,54 +0,0 @@
Rutger Okhuizen 7/31/2006
Implement waiting algorithm for GEOIP_CHECK_CACHE,
so stat is called on every lookup.
-----------------------
Maurice Cinquini
*** ifndef WIN32 on netdb.h ? ***
In GeoIPCity.c you don't "#ifndef WIN32" the netdb.h include,
but in GeoIP.c you do.  Which one is right?
*** Warnings in GeoIP-1.2.1 before I made changes ***
GeoIPUpdate.c:73: warning: implicit declaration of function `_setup_dbfilename'
    I suggest a GeoIP_private.h file to include prototypes for
    _setup_dbfilename and other private functions also used by GeoIPCity.c
*** Drop the GeoIP_*_by_addr API calls ***
And now that I think of it, why do you need a seperate
GeoIP_region_by_addr and GeoIP_region_by_name since
the later does the work of the former just as efficently.
For backward compatibility you could #define GeoIP_region_by_addr
to GeoIP_region_by_name
Performance improvements suggested by Jason Linhart
1. cluster nodes to improve disk performance when using GEOIP_STANDARD
2. evaluate preformance of replacing binary tree with nodes containing 4 children
Write function to list countries, sorted by name. Chris Gibbs contributed this which could be
used:
int GeoIP_country_sorted_index[246] = {
0, 5, 8, 61, 14, 3, 11, 7, 12, 6, 13, 9, 17, 1, 16, 15, 18, 32, 25, 21,
20,36, 22, 37, 27, 28, 33, 30, 19, 35, 34, 31, 104, 29, 24, 23, 26,
114, 47, 38, 52,121, 41, 207, 46, 48, 53, 39, 49, 116, 42, 40, 45,
50, 44, 97, 51, 54, 55, 58, 57, 59, 60, 216, 62, 64, 203, 87, 66,
63, 68, 2, 71, 73, 70, 69, 74, 75, 80, 170,208, 76, 84, 79, 56, 81,
82, 88, 83, 78, 86, 91, 90, 85, 92, 93, 98, 95, 228, 96,94, 99, 107,
103, 100, 106, 105, 101, 102, 108, 109, 111, 110, 122, 112, 115,
118,119, 120, 113, 123, 132, 124, 129, 128, 133, 126, 130, 131,
143, 139, 137,151,153, 150, 140, 148, 138, 145, 146, 149, 238,
152, 72, 136, 135, 142, 147, 134,154, 141, 155, 164, 163, 161,
10, 156, 166, 160, 157, 159, 165, 158, 144, 162, 167,173, 180,
178, 168, 171, 181, 169, 172, 176, 174, 179, 177, 182, 183, 184,
185,186, 193, 117, 125, 175, 229, 236, 198, 202, 187, 199, 189,
197, 192, 196,194,188, 200, 240, 89, 67, 127, 190, 201, 195, 205,
191, 43, 204, 220, 211, 221,210,209, 212, 215, 218, 214, 217,
213,206, 219, 223, 222, 4, 77, 225, 224, 226,227,234, 230, 233,
231,232, 235, 65, 237, 239, 242, 241, 243, 244, 245};

File diff suppressed because it is too large Load Diff

View File

@ -1,26 +0,0 @@
INCLUDES = \
-I$(top_srcdir)/libGeoIP \
-Wall
AM_CPPFLAGS = -DSYSCONFDIR=\"$(sysconfdir)\" -Wall
DEPS = $(top_builddir)/libGeoIP/libGeoIP.la
LDADDS = $(top_builddir)/libGeoIP/libGeoIP.la
bin_PROGRAMS = geoiplookup geoiplookup6 geoipupdate
geoiplookup_SOURCES = geoiplookup.c
geoiplookup_LDFLAGS =
geoiplookup_DEPENDENCIES = $(top_builddir)/libGeoIP/libGeoIP.la
geoiplookup_LDADD = $(top_builddir)/libGeoIP/libGeoIP.la
geoiplookup6_SOURCES = geoiplookup6.c
geoiplookup6_LDFLAGS =
geoiplookup6_DEPENDENCIES = $(top_builddir)/libGeoIP/libGeoIP.la
geoiplookup6_LDADD = $(top_builddir)/libGeoIP/libGeoIP.la
geoipupdate_SOURCES = geoipupdate.c
geoipupdate_LDFLAGS =
geoipupdate_DEPENDENCIES = $(top_builddir)/libGeoIP/libGeoIP.la $(top_builddir)/libGeoIP/libGeoIPUpdate.la
geoipupdate_LDADD = $(top_builddir)/libGeoIP/libGeoIPUpdate.la $(top_builddir)/libGeoIP/libGeoIP.la
EXTRA_DIST = geoipupdate-pureperl.pl Makefile.vc

View File

@ -1,544 +0,0 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
bin_PROGRAMS = geoiplookup$(EXEEXT) geoiplookup6$(EXEEXT) \
geoipupdate$(EXEEXT)
subdir = apps
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__installdirs = "$(DESTDIR)$(bindir)"
PROGRAMS = $(bin_PROGRAMS)
am_geoiplookup_OBJECTS = geoiplookup.$(OBJEXT)
geoiplookup_OBJECTS = $(am_geoiplookup_OBJECTS)
geoiplookup_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(geoiplookup_LDFLAGS) $(LDFLAGS) -o $@
am_geoiplookup6_OBJECTS = geoiplookup6.$(OBJEXT)
geoiplookup6_OBJECTS = $(am_geoiplookup6_OBJECTS)
geoiplookup6_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(geoiplookup6_LDFLAGS) $(LDFLAGS) -o $@
am_geoipupdate_OBJECTS = geoipupdate.$(OBJEXT)
geoipupdate_OBJECTS = $(am_geoipupdate_OBJECTS)
geoipupdate_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(geoipupdate_LDFLAGS) $(LDFLAGS) -o $@
DEFAULT_INCLUDES = -I.@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
SOURCES = $(geoiplookup_SOURCES) $(geoiplookup6_SOURCES) \
$(geoipupdate_SOURCES)
DIST_SOURCES = $(geoiplookup_SOURCES) $(geoiplookup6_SOURCES) \
$(geoipupdate_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GEOIP_VERSION_INFO = @GEOIP_VERSION_INFO@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
INCLUDES = \
-I$(top_srcdir)/libGeoIP \
-Wall
AM_CPPFLAGS = -DSYSCONFDIR=\"$(sysconfdir)\" -Wall
DEPS = $(top_builddir)/libGeoIP/libGeoIP.la
LDADDS = $(top_builddir)/libGeoIP/libGeoIP.la
geoiplookup_SOURCES = geoiplookup.c
geoiplookup_LDFLAGS =
geoiplookup_DEPENDENCIES = $(top_builddir)/libGeoIP/libGeoIP.la
geoiplookup_LDADD = $(top_builddir)/libGeoIP/libGeoIP.la
geoiplookup6_SOURCES = geoiplookup6.c
geoiplookup6_LDFLAGS =
geoiplookup6_DEPENDENCIES = $(top_builddir)/libGeoIP/libGeoIP.la
geoiplookup6_LDADD = $(top_builddir)/libGeoIP/libGeoIP.la
geoipupdate_SOURCES = geoipupdate.c
geoipupdate_LDFLAGS =
geoipupdate_DEPENDENCIES = $(top_builddir)/libGeoIP/libGeoIP.la $(top_builddir)/libGeoIP/libGeoIPUpdate.la
geoipupdate_LDADD = $(top_builddir)/libGeoIP/libGeoIPUpdate.la $(top_builddir)/libGeoIP/libGeoIP.la
EXTRA_DIST = geoipupdate-pureperl.pl Makefile.vc
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu apps/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu apps/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
for p in $$list; do echo "$$p $$p"; done | \
sed 's/$(EXEEXT)$$//' | \
while read p p1; do if test -f $$p || test -f $$p1; \
then echo "$$p"; echo "$$p"; else :; fi; \
done | \
sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
-e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
sed 'N;N;N;s,\n, ,g' | \
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
if ($$2 == $$4) files[d] = files[d] " " $$1; \
else { print "f", $$3 "/" $$4, $$1; } } \
END { for (d in files) print "f", d, files[d] }' | \
while read type dir files; do \
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
test -z "$$files" || { \
echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
} \
; done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
files=`for p in $$list; do echo "$$p"; done | \
sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
-e 's/$$/$(EXEEXT)/' `; \
test -n "$$list" || exit 0; \
echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(bindir)" && rm -f $$files
clean-binPROGRAMS:
@list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
echo " rm -f" $$list; \
rm -f $$list || exit $$?; \
test -n "$(EXEEXT)" || exit 0; \
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
geoiplookup$(EXEEXT): $(geoiplookup_OBJECTS) $(geoiplookup_DEPENDENCIES)
@rm -f geoiplookup$(EXEEXT)
$(geoiplookup_LINK) $(geoiplookup_OBJECTS) $(geoiplookup_LDADD) $(LIBS)
geoiplookup6$(EXEEXT): $(geoiplookup6_OBJECTS) $(geoiplookup6_DEPENDENCIES)
@rm -f geoiplookup6$(EXEEXT)
$(geoiplookup6_LINK) $(geoiplookup6_OBJECTS) $(geoiplookup6_LDADD) $(LIBS)
geoipupdate$(EXEEXT): $(geoipupdate_OBJECTS) $(geoipupdate_DEPENDENCIES)
@rm -f geoipupdate$(EXEEXT)
$(geoipupdate_LINK) $(geoipupdate_OBJECTS) $(geoipupdate_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/geoiplookup.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/geoiplookup6.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/geoipupdate.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS)
installdirs:
for dir in "$(DESTDIR)$(bindir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am: install-binPROGRAMS
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-binPROGRAMS
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
clean-generic clean-libtool ctags distclean distclean-compile \
distclean-generic distclean-libtool distclean-tags distdir dvi \
dvi-am html html-am info info-am install install-am \
install-binPROGRAMS install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
pdf pdf-am ps ps-am tags uninstall uninstall-am \
uninstall-binPROGRAMS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -1,25 +0,0 @@
#NMAKE makefile for Windows developers.
#Produces a static library (GeoIP.lib).
COMPILER=cl
LINK = link -nologo
CFLAGS=-DWIN32 -MD -nologo
GEOIPINC = -I..\libGeoIP
CC1 = $(COMPILER) $(CFLAGS) $(GEOIPINC)
GEOIPLIB = ..\libGeoIP\GeoIP.lib
EXTRA_LIBS= advapi32.lib wsock32.lib
AR=lib
APPS: geoiplookup.exe
geoiplookup.exe: geoiplookup.c
$(CC1) -c geoiplookup.c
$(LINK) geoiplookup.obj $(GEOIPLIB)

View File

@ -1,401 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
/* geoiplookup.c
*
* Copyright (C) 2006 MaxMind LLC
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "GeoIP.h"
#include "GeoIPCity.h"
#include "GeoIP_internal.h"
#if defined(_WIN32)
# ifndef uint32_t
typedef unsigned int uint32_t;
# endif
#endif
void geoiplookup(GeoIP* gi,char *hostname,int i);
void usage() {
fprintf(stderr,"Usage: geoiplookup [-d custom_dir] [-f custom_file] [-v] [-i] <ipaddress|hostname>\n");
}
/* extra info used in _say_range_ip */
int info_flag = 0;
int main (int argc, char *argv[]) {
char * hostname = NULL;
char * db_info;
GeoIP * gi;
int i;
char *custom_directory = NULL;
char *custom_file = NULL;
int version_flag = 0;
if (argc < 2) {
usage();
exit(1);
}
i = 1;
while (i < argc) {
if (strcmp(argv[i],"-v") == 0) {
version_flag = 1;
} else if (strcmp(argv[i],"-i") == 0) {
info_flag = 1;
} else if (strcmp(argv[i],"-f") == 0) {
if ((i+1) < argc){
i++;
custom_file = argv[i];
}
} else if (strcmp(argv[i],"-d") == 0) {
if ((i+1) < argc){
i++;
custom_directory = argv[i];
}
} else {
hostname = argv[i];
}
i++;
}
if (hostname == NULL) {
usage();
exit(1);
}
if (custom_directory != NULL) {
GeoIP_setup_custom_directory(custom_directory);
}
_GeoIP_setup_dbfilename();
if (custom_file != NULL) {
gi = GeoIP_open(custom_file, GEOIP_STANDARD);
if (NULL == gi) {
printf("%s not available, skipping...\n", custom_file);
} else {
i = GeoIP_database_edition(gi);
if (version_flag == 1) {
db_info = GeoIP_database_info(gi);
printf("%s: %s\n",GeoIPDBDescription[i],db_info == NULL ? "": db_info );
free(db_info);
} else {
geoiplookup(gi,hostname,i);
}
}
GeoIP_delete(gi);
} else {
/* iterate through different database types */
for (i = 0; i < NUM_DB_TYPES; ++i) {
if (GeoIP_db_avail(i)) {
gi = GeoIP_open_type(i, GEOIP_STANDARD);
if (NULL == gi) {
printf("%s not available, skipping...\n", GeoIPDBDescription[i]);
} else {
if (version_flag == 1) {
db_info = GeoIP_database_info(gi);
printf("%s: %s\n",GeoIPDBDescription[i], db_info == NULL ? "" : db_info );
free(db_info);
} else {
geoiplookup(gi,hostname,i);
}
}
GeoIP_delete(gi);
}
}
}
return 0;
}
static const char * _mk_NA( const char * p ){
return p ? p : "N/A";
}
static void _mk_conf_str( unsigned char val , char * to, int size){
if ( ( val & 0x7f ) == 0x7f ){
snprintf(to, 5, "N/A");
return;
}
snprintf(to, 5, "%d", val);
return;
}
static unsigned long
__addr_to_num(const char *addr)
{
unsigned int c, octet, t;
unsigned long ipnum;
int i = 3;
octet = ipnum = 0;
while ((c = *addr++)) {
if (c == '.') {
if (octet > 255)
return 0;
ipnum <<= 8;
ipnum += octet;
i--;
octet = 0;
} else {
t = octet;
octet <<= 3;
octet += t;
octet += t;
c -= '0';
if (c > 9)
return 0;
octet += c;
}
}
if ((octet > 255) || (i != 0))
return 0;
ipnum <<= 8;
return ipnum + octet;
}
/* ptr must be a memory area with at least 16 bytes */
static char *__num_to_addr_r (unsigned long ipnum, char * ptr) {
char *cur_str;
int octet[4];
int num_chars_written, i;
cur_str = ptr;
for (i = 0; i<4; i++) {
octet[3 - i] = ipnum % 256;
ipnum >>= 8;
}
for (i = 0; i<4; i++) {
num_chars_written = sprintf(cur_str, "%d", octet[i]);
cur_str += num_chars_written;
if (i < 3) {
cur_str[0] = '.';
cur_str++;
}
}
return ptr;
}
void _say_range_by_ip(GeoIP * gi, uint32_t ipnum ) {
unsigned long last_nm, mask, low, hi;
char ipaddr[16];
char tmp[16];
char ** range;
if ( info_flag == 0 )
return; /* noop unless extra information is requested */
range = GeoIP_range_by_ip( gi, __num_to_addr_r( ipnum, ipaddr ) );
if ( range == NULL )
return;
printf ( " ipaddr: %s\n", ipaddr );
printf( " range_by_ip: %s - %s\n", range[0], range[1] );
last_nm = GeoIP_last_netmask(gi);
mask = 0xffffffff << ( 32 - last_nm );
low = ipnum & mask;
hi = low + ( 0xffffffff & ~mask );
printf( " network: %s - %s ::%ld\n",
__num_to_addr_r( low, ipaddr ),
__num_to_addr_r( hi, tmp ),
last_nm
);
printf( " ipnum: %u\n", ipnum );
printf( " range_by_num: %lu - %lu\n", __addr_to_num(range[0]), __addr_to_num(range[1]) );
printf( " network num: %lu - %lu ::%lu\n", low, hi, last_nm );
GeoIP_range_by_ip_delete(range);
}
void
geoiplookup(GeoIP * gi, char *hostname, int i)
{
const char *country_code;
const char *country_name;
const char *domain_name;
const char *asnum_name;
int netspeed;
int country_id;
GeoIPRegion *region;
GeoIPRecord *gir;
const char *org;
uint32_t ipnum;
ipnum = _GeoIP_lookupaddress(hostname);
if (ipnum == 0) {
printf("%s: can't resolve hostname ( %s )\n", GeoIPDBDescription[i], hostname);
}
else {
if (GEOIP_DOMAIN_EDITION == i) {
domain_name = GeoIP_name_by_ipnum(gi, ipnum);
if (domain_name == NULL) {
printf("%s: IP Address not found\n", GeoIPDBDescription[i]);
}
else {
printf("%s: %s\n", GeoIPDBDescription[i], domain_name);
_say_range_by_ip(gi, ipnum);
}
}
else if (GEOIP_LOCATIONA_EDITION == i || GEOIP_ACCURACYRADIUS_EDITION == i || GEOIP_ASNUM_EDITION == i || GEOIP_USERTYPE_EDITION == i || GEOIP_REGISTRAR_EDITION == i || GEOIP_NETSPEED_EDITION_REV1 == i ) {
asnum_name = GeoIP_name_by_ipnum(gi, ipnum);
if (asnum_name == NULL) {
printf("%s: IP Address not found\n", GeoIPDBDescription[i]);
}
else {
printf("%s: %s\n", GeoIPDBDescription[i], asnum_name);
_say_range_by_ip(gi, ipnum);
}
}
else if (GEOIP_COUNTRY_EDITION == i) {
country_id = GeoIP_id_by_ipnum(gi, ipnum);
country_code = GeoIP_country_code[country_id];
country_name = GeoIP_country_name[country_id];
if (country_id == 0) {
printf("%s: IP Address not found\n", GeoIPDBDescription[i]);
}
else {
printf("%s: %s, %s\n", GeoIPDBDescription[i], country_code, country_name);
_say_range_by_ip(gi, ipnum);
}
}
else if (GEOIP_REGION_EDITION_REV0 == i || GEOIP_REGION_EDITION_REV1 == i) {
region = GeoIP_region_by_ipnum(gi, ipnum);
if (NULL == region || region->country_code[0] == '\0' ) {
printf("%s: IP Address not found\n", GeoIPDBDescription[i]);
}
else {
printf("%s: %s, %s\n", GeoIPDBDescription[i], region->country_code, region->region);
_say_range_by_ip(gi, ipnum);
GeoIPRegion_delete(region);
}
}
else if (GEOIP_CITY_EDITION_REV0 == i) {
gir = GeoIP_record_by_ipnum(gi, ipnum);
if (NULL == gir) {
printf("%s: IP Address not found\n", GeoIPDBDescription[i]);
}
else {
printf("%s: %s, %s, %s, %s, %f, %f\n", GeoIPDBDescription[i], gir->country_code, _mk_NA(gir->region),
_mk_NA(gir->city), _mk_NA(gir->postal_code), gir->latitude, gir->longitude);
_say_range_by_ip(gi, ipnum);
GeoIPRecord_delete(gir);
}
}
else if (GEOIP_CITY_EDITION_REV1 == i) {
gir = GeoIP_record_by_ipnum(gi, ipnum);
if (NULL == gir) {
printf("%s: IP Address not found\n", GeoIPDBDescription[i]);
}
else {
printf("%s: %s, %s, %s, %s, %f, %f, %d, %d\n", GeoIPDBDescription[i], gir->country_code, _mk_NA(gir->region), _mk_NA(gir->city), _mk_NA(gir->postal_code),
gir->latitude, gir->longitude, gir->metro_code, gir->area_code);
_say_range_by_ip(gi, ipnum);
GeoIPRecord_delete(gir);
}
}
else if (GEOIP_CITYCONFIDENCE_EDITION == i) {
gir = GeoIP_record_by_ipnum(gi, ipnum);
if (NULL == gir) {
printf("%s: IP Address not found\n", GeoIPDBDescription[i]);
}
else {
char country_str[5], region_str[5], city_str[5], postal_str[5];
_mk_conf_str(gir->country_conf, country_str, 5);
_mk_conf_str(gir->region_conf, region_str, 5);
_mk_conf_str(gir->city_conf, city_str, 5);
_mk_conf_str(gir->postal_conf, postal_str, 5);
printf("%s: %s, %s, %s, %s, %f, %f, %d, %d, %s, %s, %s, %s\n", GeoIPDBDescription[i], gir->country_code, _mk_NA(gir->region), _mk_NA(gir->city), _mk_NA(gir->postal_code),
gir->latitude, gir->longitude, gir->metro_code, gir->area_code,
country_str, region_str, city_str, postal_str
);
_say_range_by_ip(gi, ipnum);
GeoIPRecord_delete(gir);
}
}
else if (GEOIP_CITYCONFIDENCEDIST_EDITION == i) {
gir = GeoIP_record_by_ipnum(gi, ipnum);
if (NULL == gir) {
printf("%s: IP Address not found\n", GeoIPDBDescription[i]);
}
else {
char country_str[5], region_str[5], city_str[5], postal_str[5], accuracy_radius_str[5];
_mk_conf_str(gir->country_conf, country_str, 5);
_mk_conf_str(gir->region_conf, region_str, 5);
_mk_conf_str(gir->city_conf, city_str, 5);
_mk_conf_str(gir->postal_conf, postal_str, 5);
if (gir->accuracy_radius != 1023){
sprintf(accuracy_radius_str, "%d", gir->accuracy_radius );
} else {
strcpy(accuracy_radius_str,"N/A");}
printf("%s: %s, %s, %s, %s, %f, %f, %d, %d, %s, %s, %s, %s, %s\n", GeoIPDBDescription[i], gir->country_code, _mk_NA(gir->region), _mk_NA(gir->city), _mk_NA(gir->postal_code),
gir->latitude, gir->longitude, gir->metro_code, gir->area_code,
country_str, region_str, city_str, postal_str, accuracy_radius_str
);
_say_range_by_ip(gi, ipnum);
GeoIPRecord_delete(gir);
}
}
else if (GEOIP_ORG_EDITION == i || GEOIP_ISP_EDITION == i) {
org = GeoIP_org_by_ipnum(gi, ipnum);
if (org == NULL) {
printf("%s: IP Address not found\n", GeoIPDBDescription[i]);
}
else {
printf("%s: %s\n", GeoIPDBDescription[i], org);
_say_range_by_ip(gi, ipnum);
}
}
else if (GEOIP_NETSPEED_EDITION == i) {
netspeed = GeoIP_id_by_ipnum(gi, ipnum);
if (netspeed == GEOIP_UNKNOWN_SPEED) {
printf("%s: Unknown\n", GeoIPDBDescription[i]);
}
else if (netspeed == GEOIP_DIALUP_SPEED) {
printf("%s: Dialup\n", GeoIPDBDescription[i]);
}
else if (netspeed == GEOIP_CABLEDSL_SPEED) {
printf("%s: Cable/DSL\n", GeoIPDBDescription[i]);
}
else if (netspeed == GEOIP_CORPORATE_SPEED) {
printf("%s: Corporate\n", GeoIPDBDescription[i]);
}
_say_range_by_ip(gi, ipnum);
}
else {
/*
* Silent ignore IPv6 databases. Otherwise we get annoying
* messages whenever we have a mixed environment IPv4 and
* IPv6
*/
/*
* printf("Can not handle database type -- try geoiplookup6\n");
*/
;
}
}
}

View File

@ -1,255 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
/* geoiplookup.c
*
* Copyright (C) 2006 MaxMind LLC
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <GeoIP.h>
#include <GeoIPCity.h>
#include <GeoIP_internal.h>
void geoiplookup(GeoIP* gi,char *hostname,int i);
void usage() {
fprintf(stderr,"Usage: geoiplookup [-d custom_dir] [-f custom_file] [-v] <ipaddress|hostname>\n");
}
int main (int argc, char *argv[]) {
char * hostname = NULL;
char * db_info;
GeoIP * gi;
int i;
char *custom_directory = NULL;
char *custom_file = NULL;
int version_flag = 0;
if (argc < 2) {
usage();
exit(1);
}
i = 1;
while (i < argc) {
if (strcmp(argv[i],"-v") == 0) {
version_flag = 1;
} else if (strcmp(argv[i],"-f") == 0) {
if ((i+1) < argc){
i++;
custom_file = argv[i];
}
} else if (strcmp(argv[i],"-d") == 0) {
if ((i+1) < argc){
i++;
custom_directory = argv[i];
}
} else {
hostname = argv[i];
}
i++;
}
if (hostname == NULL) {
usage();
exit(1);
}
if (custom_directory != NULL) {
GeoIP_setup_custom_directory(custom_directory);
}
_GeoIP_setup_dbfilename();
if (custom_file != NULL) {
gi = GeoIP_open(custom_file, GEOIP_STANDARD);
if (NULL == gi) {
printf("%s not available, skipping...\n", custom_file);
} else {
i = GeoIP_database_edition(gi);
if (version_flag == 1) {
db_info = GeoIP_database_info(gi);
printf("%s: %s\n",GeoIPDBDescription[i],db_info == NULL ? "": db_info );
free(db_info);
} else {
geoiplookup(gi,hostname,i);
}
}
GeoIP_delete(gi);
} else {
/* iterate through different database types */
for (i = 0; i < NUM_DB_TYPES; ++i) {
if (GeoIP_db_avail(i)) {
gi = GeoIP_open_type(i, GEOIP_STANDARD);
if (NULL == gi) {
printf("%s not available, skipping...\n", GeoIPDBDescription[i]);
} else {
if (version_flag == 1) {
db_info = GeoIP_database_info(gi);
printf("%s: %s\n",GeoIPDBDescription[i],db_info);
free(db_info);
} else {
geoiplookup(gi,hostname,i);
}
}
GeoIP_delete(gi);
}
}
}
return 0;
}
static const char * _mk_NA( const char * p ){
return p ? p : "N/A";
}
void
geoiplookup(GeoIP * gi, char *hostname, int i)
{
const char *country_code;
const char *country_name;
const char *domain_name;
const char *asnum_name;
int netspeed;
int country_id;
GeoIPRegion *region;
GeoIPRecord *gir;
const char *org;
geoipv6_t ipnum;
ipnum = _GeoIP_lookupaddress_v6(hostname);
if (__GEOIP_V6_IS_NULL(ipnum)) {
printf("%s: can't resolve hostname ( %s )\n", GeoIPDBDescription[i], hostname);
}
else {
#if 0
if (GEOIP_DOMAIN_EDITION_V6 == i) {
domain_name = GeoIP_name_by_name_v6(gi, hostname);
if (domain_name == NULL) {
printf("%s: IP Address not found\n", GeoIPDBDescription[i]);
}
else {
printf("%s: %s\n", GeoIPDBDescription[i], domain_name);
}
}
#endif
if (GEOIP_LOCATIONA_EDITION_V6 == i || GEOIP_ASNUM_EDITION_V6 == i || GEOIP_USERTYPE_EDITION_V6 == i || GEOIP_REGISTRAR_EDITION_V6 == i || GEOIP_DOMAIN_EDITION_V6 == i || GEOIP_ORG_EDITION_V6 == i || GEOIP_ISP_EDITION_V6 == i || GEOIP_NETSPEED_EDITION_REV1_V6 == i ) {
asnum_name = GeoIP_name_by_ipnum_v6(gi, ipnum);
if (asnum_name == NULL) {
printf("%s: IP Address not found\n", GeoIPDBDescription[i]);
}
else {
printf("%s: %s\n", GeoIPDBDescription[i], asnum_name);
// _say_range_by_ip(gi, ipnum);
}
}
else if (GEOIP_CITY_EDITION_REV0_V6 == i) {
gir = GeoIP_record_by_name_v6(gi, hostname);
if (NULL == gir) {
printf("%s: IP Address not found\n", GeoIPDBDescription[i]);
}
else {
printf("%s: %s, %s, %s, %s, %f, %f\n", GeoIPDBDescription[i], gir->country_code, _mk_NA(gir->region),
_mk_NA(gir->city), _mk_NA(gir->postal_code), gir->latitude, gir->longitude);
}
}
else if (GEOIP_CITY_EDITION_REV1_V6 == i) {
gir = GeoIP_record_by_name_v6(gi, hostname);
if (NULL == gir) {
printf("%s: IP Address not found\n", GeoIPDBDescription[i]);
}
else {
printf("%s: %s, %s, %s, %s, %f, %f, %d, %d\n", GeoIPDBDescription[i], gir->country_code, _mk_NA(gir->region), _mk_NA(gir->city), _mk_NA(gir->postal_code),
gir->latitude, gir->longitude, gir->metro_code, gir->area_code);
}
}
else if (GEOIP_COUNTRY_EDITION_V6 == i) {
country_id = GeoIP_id_by_ipnum_v6(gi, ipnum);
country_code = GeoIP_country_code[country_id];
country_name = GeoIP_country_name[country_id];
if (country_id == 0) {
printf("%s: IP Address not found\n", GeoIPDBDescription[i]);
}
else {
printf("%s: %s, %s\n", GeoIPDBDescription[i], country_code, country_name);
}
}
}
#if 0
else
if (GEOIP_REGION_EDITION_REV0 == i || GEOIP_REGION_EDITION_REV1 == i) {
region = GeoIP_region_by_name_v6(gi, hostname);
if (NULL == region) {
printf("%s: IP Address not found\n", GeoIPDBDescription[i]);
}
else {
printf("%s: %s, %s\n", GeoIPDBDescription[i], region->country_code, region->region);
}
}
else if (GEOIP_CITY_EDITION_REV0 == i) {
gir = GeoIP_record_by_name(gi, hostname);
if (NULL == gir) {
printf("%s: IP Address not found\n", GeoIPDBDescription[i]);
}
else {
printf("%s: %s, %s, %s, %s, %f, %f\n", GeoIPDBDescription[i], gir->country_code, gir->region,
gir->city, gir->postal_code, gir->latitude, gir->longitude);
}
}
else if (GEOIP_CITY_EDITION_REV1 == i) {
gir = GeoIP_record_by_name(gi, hostname);
if (NULL == gir) {
printf("%s: IP Address not found\n", GeoIPDBDescription[i]);
}
else {
printf("%s: %s, %s, %s, %s, %f, %f, %d, %d\n", GeoIPDBDescription[i], gir->country_code, gir->region, gir->city, gir->postal_code,
gir->latitude, gir->longitude, gir->metro_code, gir->area_code);
}
}
else if (GEOIP_ORG_EDITION == i || GEOIP_ISP_EDITION == i) {
org = GeoIP_org_by_name_v6(gi, hostname);
if (org == NULL) {
printf("%s: IP Address not found\n", GeoIPDBDescription[i]);
}
else {
printf("%s: %s\n", GeoIPDBDescription[i], org);
}
}
else if (GEOIP_NETSPEED_EDITION == i) {
netspeed = GeoIP_id_by_name_v6(gi, hostname);
if (netspeed == GEOIP_UNKNOWN_SPEED) {
printf("%s: Unknown\n", GeoIPDBDescription[i]);
}
else if (netspeed == GEOIP_DIALUP_SPEED) {
printf("%s: Dialup\n", GeoIPDBDescription[i]);
}
else if (netspeed == GEOIP_CABLEDSL_SPEED) {
printf("%s: Cable/DSL\n", GeoIPDBDescription[i]);
}
else if (netspeed == GEOIP_CORPORATE_SPEED) {
printf("%s: Corporate\n", GeoIPDBDescription[i]);
}
}
#endif
}

View File

@ -1,260 +0,0 @@
#!/usr/bin/perl
=pod
/*
*
* Copyright (C) 2008 MaxMind LLC
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
=cut
=pod
pure perl version of geoipupdate. can handle anything, that
GeoIP_update_database
GeoIP_update_database_general
handle. It is a drop in replacement for geoipupdate, as opposide to geoipupdate is the
pp version able to handle proxy requests even with authentication and can be used with
https
=cut
use strict;
use warnings;
our $VERSION = '0.07';
use 5.008;
use Data::Dumper;
use Digest::MD5;
use File::Spec;
use File::Basename;
use Getopt::Std;
use HTTP::Request::Common;
use LWP::UserAgent;
use PerlIO::gzip;
use URI;
my $ua = LWP::UserAgent->new( agent => "pp_geoipupdate/$VERSION" );
$ua->env_proxy;
## --- for auth proxies use
## $ua->proxy(['http', 'ftp'] => 'http://username:password@proxy.myorg.com');
my $license_file = 'GeoIP.conf';
my $update_host = 'updates.maxmind.com';
my $proto = 'http';
my %opts;
if ( !getopts( 'hvf:d:', \%opts ) or $opts{h} ) {
print STDERR
"Usage: geoipupdate [-hv] [-f license_file] [-d custom directory]\n";
exit @ARGV ? 1 : 0;
}
my $rootdir = File::Spec->rootdir;
$opts{d} ||= File::Spec->catfile( $rootdir, qw/ usr local share GeoIP / );
$opts{f} ||=
File::Spec->catfile( $rootdir, qw/ usr local etc /, $license_file );
die "dir $opts{d} does not exist or is not readable or is not a directory\n"
unless -d $opts{d};
die "license_file $opts{f} does not exist, is not readable or is not a file\n"
unless -f $opts{f};
#
# --- parse license file
#
open my $fh, '<', $opts{f}
or die "Error opening GeoIP Configuration file $opts{f}\n";
print "Opened License file $opts{f}\n" if $opts{v};
my ( $user_id, $license_key, @product_ids );
{
local $_;
while (<$fh>) {
next if /^\s*#/; # skip comments
/^\s*UserId\s+(\d+)/ and $user_id = $1, next;
/^\s*LicenseKey\s+(\S{12})/ and $license_key = $1, next;
/^\s*ProductIds\s+(\d+(?:[a-zA-Z]{2,3})?(?:\s+\d+(?:[a-zA-Z]{2,3})?)*)/
and @product_ids = split( /\s+/, $1 ), next;
}
}
if ( $opts{v} ) {
print "User id $user_id\n" if $user_id;
print "Read in license key $license_key\n";
print "Product ids @product_ids\n";
}
if ($user_id) {
for my $product_id (@product_ids) {
# update the databases using the user id string,
# the license key string and the product id for each database
eval {
GeoIP_update_database_general( $user_id, $license_key,
$product_id, $opts{v} );
};
my $err = $@;
die $err if $err and $err !~ /^No new updates available/i;
print $err;
}
} else {
# Old format with just license key for MaxMind GeoIP Country database updates
# here for backwards compatibility
eval { GeoIP_update_database( $license_key, $opts{v} ); };
my $err = $@;
die $err if $err and $err !~ /^No new updates available/i;
print $err;
}
exit 0;
sub GeoIP_update_database_general {
my ( $user_id, $license_key, $product_id, $verbose, $client_ipaddr ) = @_;
my $u = URI->new("$proto://$update_host/app/update_getfilename");
$u->query_form( product_id => $product_id );
print 'Send request ' . $u->as_string, "\n" if ($verbose);
my $res = $ua->request( GET $u->as_string, Host => $update_host );
die $res->status_line unless ( $res->is_success );
# make sure to use only the filename for security reason
my $geoip_filename = File::Spec->catfile( $opts{d}, basename($res->content) );
# /* get MD5 of current GeoIP database file */
my $old_md5 = _get_hexdigest($geoip_filename);
print "MD5 sum of database $geoip_filename is $old_md5\n" if $verbose;
unless ($client_ipaddr) {
print 'Send request ' . $u->as_string, "\n" if ($verbose);
# /* get client ip address from MaxMind web page */
$res = $ua->request( GET "$proto://$update_host/app/update_getipaddr",
Host => $update_host );
die $res->status_line unless ( $res->is_success );
$client_ipaddr = $res->content;
}
print "client ip address: $client_ipaddr\n" if $verbose;
my $hex_digest2 =
Digest::MD5->new->add( $license_key, $client_ipaddr )->hexdigest;
print "md5sum of ip address and license key is $hex_digest2\n" if $verbose;
my $mk_db_req_cref = sub {
$u->path('/app/update_secure');
$u->query_form(
db_md5 => shift,
challenge_md5 => $hex_digest2,
user_id => $user_id,
edition_id => $product_id
);
print 'Send request ' . $u->as_string, "\n" if ($verbose);
return $ua->request( GET $u->as_string, Host => $update_host );
};
$res = $mk_db_req_cref->($old_md5);
die $res->status_line unless ( $res->is_success );
# print Dumper($res);
print "Downloading gzipped GeoIP Database...\n" if $verbose;
_gunzip_and_replace(
$res->content,
$geoip_filename,
sub {
# as sanity check request a update for the new downloaded file
# md5 of the new unpacked file
my $new_md5 = _get_hexdigest(shift);
return $mk_db_req_cref->($new_md5);
}
);
print "Done\n" if $verbose;
}
sub GeoIP_update_database {
my ( $license_key, $verbose ) = @_;
my $geoip_filename = File::Spec->catfile( $opts{d}, 'GeoIP.dat' );
# /* get MD5 of current GeoIP database file */
my $hexdigest = _get_hexdigest($geoip_filename);
print "MD5 sum of database $geoip_filename is $hexdigest\n" if $verbose;
my $u = URI->new("$proto://$update_host/app/update");
$u->query_form( license_key => $license_key, md5 => $hexdigest );
print 'Send request ' . $u->as_string, "\n" if ($verbose);
my $res = $ua->request( GET $u->as_string, Host => $update_host );
die $res->status_line unless ( $res->is_success );
print "Downloading gzipped GeoIP Database...\n" if $verbose;
_gunzip_and_replace( $res->content, $geoip_filename );
print "Done\n" if $verbose;
}
# --- hexdigest of the file or 00000000000000000000000000000000
sub _get_hexdigest {
my $md5 = '0' x 32;
if ( open my $fh, '<:raw', shift ) {
$md5 = Digest::MD5->new->addfile($fh)->hexdigest;
}
return $md5;
}
sub _gunzip_and_replace {
my ( $content, $geoip_filename, $sanity_check_c ) = @_;
my $max_retry = 1;
my $tmp_fname = $geoip_filename . '.test';
{
# --- error if our content does not start with the gzip header
die $content || 'Not a gzip file' if substr( $content, 0, 2 ) ne "\x1f\x8b";
# --- uncompress the gzip data
{
local $_;
open my $gin, '<:gzip', \$content or die $!;
open my $gout, '>:raw', $tmp_fname or die $!;
print {$gout} $_ while (<$gin>);
}
# --- sanity check
if ( defined $sanity_check_c ) {
die "Download failed" if $max_retry-- <= 0;
my $res = $sanity_check_c->($tmp_fname);
die $res->status_line unless ( $res->is_success );
$content = $res->content;
redo if ( $content !~ /^No new updates available/ );
}
}
# --- install GeoIP.dat.test -> GeoIP.dat
rename( $tmp_fname, $geoip_filename ) or die $!;
}

View File

@ -1,283 +0,0 @@
/* geoipupdate.c
*
* Copyright (C) 2006 MaxMind LLC
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "GeoIP.h"
#include "GeoIPUpdate.h"
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#ifdef __linux__
#include <getopt.h>
#endif
#include <ctype.h>
#define PRODUCT_ID_TOKEN "ProductIds"
#define USER_ID_TOKEN "UserId"
#define LICENSE_KEY_TOKEN "LicenseKey"
#define LICENSE_KEY_LENGTH 12
const char *GeoIPConfFile = "GeoIP.conf";
void usage() {
fprintf(stderr,"Usage: geoipupdate [-hv] [-f license_file] [-d custom directory]\n");
}
void my_printf(char * str) {
printf("%s", str);
}
void print_status (int err, char * license_file) {
if (err == GEOIP_NO_NEW_UPDATES) {
fprintf(stdout,"GeoIP Database up to date\n");
} else if (err == GEOIP_LICENSE_KEY_INVALID_ERR) {
fprintf(stderr,"Invalid License Key in %s - Please visit http://www.maxmind.com/app/products for a subscription\n",license_file);
} else if (err == GEOIP_USER_ID_INVALID_ERR){
fprintf(stderr,"Invalid UserID\n");
} else if (err == GEOIP_PRODUCT_ID_INVALID_ERR){
fprintf(stderr,"Invalid product ID or subscription expired\n");
} else if (err < 0) {
fprintf(stderr,"Received Error %d (%s) when attempting to update GeoIP Database\n",err, GeoIP_get_error_message(err));
} else {
fprintf(stdout,"Updated database\n");
}
}
int main (int argc, char *argv[]) {
int verbose = 0;
char * license_file = NULL;
FILE * license_fh;
int n = 40;
int line_index = 0;
unsigned char *lineptr = malloc(sizeof(char) * n);
char *a_license_key_str, *a_ptr;
char *the_license_key_str = "";
char * the_reference_empty_license_key_str = the_license_key_str;
char *a_user_id_str = NULL;
/* the string that holds the user id */
char *the_user_id_str = NULL;
/* the integer that holds the length of the string the_user_id_str */
int the_user_id_strl = 0;
/* the integer that holds the alloc length of the string the_user_id_str */
int the_user_id_stral = 0;
char *a_product_id_str = NULL;
char **the_product_id_str = NULL;
int *the_product_id_strl = NULL;
int *the_product_id_stral = NULL;
int num_product_ids = 0;
char * client_ipaddr = NULL;
char * custom_directory = NULL;
int c;
int err = 0;
int i;
opterr = 0;
while ((c = getopt (argc, argv, "hvf:d:")) != -1)
switch (c) {
case 'h':
usage();
exit(0);
case 'v':
verbose = 1;
break;
case 'f':
license_file = optarg;
break;
case 'd':
custom_directory = optarg;
break;
case '?':
if (isprint (optopt))
fprintf (stderr, "Unknown option `-%c'.\n", optopt);
else
fprintf (stderr,
"Unknown option character `\\x%x'.\n",
optopt);
usage();
exit(1);
default:
abort();
}
if (custom_directory != NULL) {
GeoIP_setup_custom_directory(custom_directory);
}
if (license_file == NULL) {
license_file = malloc(sizeof(char) * (strlen(SYSCONFDIR)+strlen(GeoIPConfFile)+2));
license_file[0] = '\0';
strcat(license_file, SYSCONFDIR);
strcat(license_file, "/");
strcat(license_file, GeoIPConfFile);
}
license_fh = fopen(license_file,"r");
if (license_fh == NULL) {
fprintf(stderr,"Error opening GeoIP Configuration file %s\n",license_file);
exit(1);
}
if (verbose == 1)
printf("Opened License file %s\n", license_file);
do {
c = fgetc(license_fh);
if (line_index >= n) {
n += 20;
lineptr = realloc(lineptr, n);
}
if (c == 10 || c == EOF) {
lineptr[line_index++] = '\0';
line_index = 0;
if (lineptr[0] == '#')
continue;
/* get the product ids from the config file */
a_product_id_str = strstr((char *)lineptr, PRODUCT_ID_TOKEN);//search for a product id token in the line
if (a_product_id_str != NULL) {
a_ptr = a_product_id_str;
/* set pos at the end of product id token */
a_ptr += strlen(PRODUCT_ID_TOKEN) + 1;
while (a_ptr[0] == ' ') {
/* skip spaces */
a_ptr++;
}
/* alloc the array of product ids */
the_product_id_str = (char **) malloc((num_product_ids+1) * sizeof(char*)); /* array of strings */
the_product_id_strl = (int *) malloc((num_product_ids+1) * sizeof(char*)); /* array of string lengths */
the_product_id_stral = (int *) malloc((num_product_ids+1) * sizeof(char*)); /* array of string alloc lengths */
while (a_ptr[0] != '\0') {
/* add new product id to the array of product ids */
the_product_id_str[num_product_ids] = (char *) malloc(20); /* the string */
the_product_id_strl[num_product_ids] = 0; /* the length of the string */
the_product_id_stral[num_product_ids] = 20; /* the alloc length of the string */
while ((a_ptr[0] != ' ') & (a_ptr[0] != '\0')) {
if (the_product_id_strl[num_product_ids] >= the_product_id_stral[num_product_ids]) {
/* if the length of the string is equal or more than
* alloc length of the string then realloc the string and
* increase the alloc length by 20 */
the_product_id_stral[num_product_ids] = the_product_id_stral[num_product_ids] + 20;
the_product_id_str[num_product_ids] = (char *) realloc(the_product_id_str[num_product_ids],the_product_id_stral[num_product_ids]+4);
}
/* read the product id from the line in the config file */
the_product_id_str[num_product_ids][the_product_id_strl[num_product_ids]] = a_ptr[0];
the_product_id_strl[num_product_ids]++;
a_ptr++;
}
the_product_id_str[num_product_ids][the_product_id_strl[num_product_ids]] = 0;
while ((a_ptr[0] == ' ') & (a_ptr[0] != '\0')) {
a_ptr++;//skip spaces
}
/* new product id add, realloc the arrays */
num_product_ids = num_product_ids + 1;
/* array of string */
the_product_id_str = (char **) realloc(the_product_id_str,(num_product_ids+1) * sizeof(char*));
/* array of string lengths */
the_product_id_strl = (int *) realloc(the_product_id_strl,(num_product_ids+1) * sizeof(char*));
/* array of string alloc lengths */
the_product_id_stral = (int *) realloc(the_product_id_stral,(num_product_ids+1) * sizeof(char*));
}
}
/* get the user id from the config file */
a_user_id_str = strstr((char *)lineptr, USER_ID_TOKEN); /* search for a user id token in the line */
if (a_user_id_str != NULL) {
a_ptr = a_user_id_str;
/* set the position at the end of user id token */
a_ptr += strlen(USER_ID_TOKEN) + 1;
while (a_ptr[0] == ' ') {
/* skip spaces */
a_ptr++;
}
/* get the string that has the user id */
the_user_id_stral = 20;
the_user_id_str = (char *)malloc(the_user_id_stral);
/* loop while the chars are numbers */
while ((a_ptr[0] >= '0') & (a_ptr[0] <= '9')) {
the_user_id_str[the_user_id_strl++] = a_ptr[0];
a_ptr++;
if (the_user_id_strl >= the_user_id_stral) {
/* if the length of user id string is greater or equal to
* the alloc length of user id string then
* add 20 to the alloc length and realloc the user id string */
the_user_id_stral += 20;
the_user_id_str = realloc(the_user_id_str,the_user_id_stral);
}
}
the_user_id_str[the_user_id_strl] = 0; /* add NUL char */
}
a_license_key_str = strstr((char *)lineptr, LICENSE_KEY_TOKEN);
if (a_license_key_str != NULL) {
a_ptr = a_license_key_str;
a_ptr += strlen(LICENSE_KEY_TOKEN) + 1;
while (a_ptr[0] == ' ') {
a_ptr++;
}
the_license_key_str = malloc(sizeof(char) * (LICENSE_KEY_LENGTH + 1));
strncpy(the_license_key_str, a_ptr, LICENSE_KEY_LENGTH);
the_license_key_str[LICENSE_KEY_LENGTH] = '\0';
}
} else {
lineptr[line_index++] = c;
}
} while (c != EOF);
free(lineptr);
fclose(license_fh);
if (verbose == 1) {
printf("Read in license key %s\n", the_license_key_str);
printf("number of product ids %d \n",num_product_ids);
}
if (the_user_id_str != NULL) {
/* update the databases using the user id string, the license key string and the product id for each database */
client_ipaddr = NULL;
for (i = 0; i < num_product_ids; i++) {
err = GeoIP_update_database_general(the_user_id_str, the_license_key_str, the_product_id_str[i], verbose,&client_ipaddr, &my_printf);
print_status(err, license_file);
}
} else {
/* Old format with just license key for MaxMind GeoIP Country database updates
* here for backwards compatibility */
err = GeoIP_update_database(the_license_key_str, verbose, &my_printf);
print_status(err, license_file);
}
if (the_product_id_str != NULL) {
/* free the product ids */
for (i = 0; i < num_product_ids; i++ ) {
free(the_product_id_str[i]);
}
free(the_product_id_str);
free(the_product_id_strl);
free(the_product_id_stral);
}
if ( the_reference_empty_license_key_str != the_license_key_str )
free(the_license_key_str);
if (the_user_id_str)
free(the_user_id_str);
if (client_ipaddr) {
free(client_ipaddr);
}
exit(err);
}

View File

@ -1,8 +0,0 @@
#! /bin/sh
# disable dependency trackeing for OS X with multiply arch option's
# automake -i --gnu --add-missing
aclocal \
&& automake -i --gnu --add-missing \
&& autoconf

View File

@ -1,19 +0,0 @@
# If you purchase a subscription to the GeoIP database,
# then you will obtain a license key which you can
# use to automatically obtain updates.
# for more details, please go to
# http://www.maxmind.com/app/products
# see https://www.maxmind.com/app/license_key_login to obtain License Key,
# UserId, and available ProductIds
# Enter your license key here
LicenseKey YOUR_LICENSE_KEY_HERE
# Enter your User ID here
UserId YOUR_USER_ID_HERE
# Enter the Product ID(s) of the database(s) you would like to update
# By default 106 (MaxMind GeoIP Country) is listed below
ProductIds 106

View File

@ -1,16 +0,0 @@
dist_sysconf_DATA = GeoIP.conf.default
DEFAULT_CONFIG_FILE = $(sysconfdir)/GeoIP.conf
install-exec-hook:
@if test -f "$(DESTDIR)$(DEFAULT_CONFIG_FILE)" ; then \
echo "$@ will not overwrite existing $(DESTDIR)$(DEFAULT_CONFIG_FILE)" ; \
else \
echo "$(INSTALL_DATA) GeoIP.conf.default $(DESTDIR)$(DEFAULT_CONFIG_FILE)"; \
$(INSTALL_DATA) "$(srcdir)/GeoIP.conf.default" "$(DESTDIR)$(DEFAULT_CONFIG_FILE)"; \
fi
uninstall-hook:
@if test -f "$(DESTDIR)$(DEFAULT_CONFIG_FILE)" ; then \
rm "$(DESTDIR)$(DEFAULT_CONFIG_FILE)"; \
fi

View File

@ -1,414 +0,0 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = conf
DIST_COMMON = $(dist_sysconf_DATA) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__installdirs = "$(DESTDIR)$(sysconfdir)"
DATA = $(dist_sysconf_DATA)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GEOIP_VERSION_INFO = @GEOIP_VERSION_INFO@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
dist_sysconf_DATA = GeoIP.conf.default
DEFAULT_CONFIG_FILE = $(sysconfdir)/GeoIP.conf
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu conf/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu conf/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
install-dist_sysconfDATA: $(dist_sysconf_DATA)
@$(NORMAL_INSTALL)
test -z "$(sysconfdir)" || $(MKDIR_P) "$(DESTDIR)$(sysconfdir)"
@list='$(dist_sysconf_DATA)'; test -n "$(sysconfdir)" || list=; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(sysconfdir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(sysconfdir)" || exit $$?; \
done
uninstall-dist_sysconfDATA:
@$(NORMAL_UNINSTALL)
@list='$(dist_sysconf_DATA)'; test -n "$(sysconfdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
test -n "$$files" || exit 0; \
echo " ( cd '$(DESTDIR)$(sysconfdir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(sysconfdir)" && rm -f $$files
tags: TAGS
TAGS:
ctags: CTAGS
CTAGS:
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(DATA)
installdirs:
for dir in "$(DESTDIR)$(sysconfdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am: install-dist_sysconfDATA
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) install-exec-hook
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-dist_sysconfDATA
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) uninstall-hook
.MAKE: install-am install-exec-am install-strip uninstall-am
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
distclean distclean-generic distclean-libtool distdir dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-dist_sysconfDATA \
install-dvi install-dvi-am install-exec install-exec-am \
install-exec-hook install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
uninstall-dist_sysconfDATA uninstall-hook
install-exec-hook:
@if test -f "$(DESTDIR)$(DEFAULT_CONFIG_FILE)" ; then \
echo "$@ will not overwrite existing $(DESTDIR)$(DEFAULT_CONFIG_FILE)" ; \
else \
echo "$(INSTALL_DATA) GeoIP.conf.default $(DESTDIR)$(DEFAULT_CONFIG_FILE)"; \
$(INSTALL_DATA) "$(srcdir)/GeoIP.conf.default" "$(DESTDIR)$(DEFAULT_CONFIG_FILE)"; \
fi
uninstall-hook:
@if test -f "$(DESTDIR)$(DEFAULT_CONFIG_FILE)" ; then \
rm "$(DESTDIR)$(DEFAULT_CONFIG_FILE)"; \
fi
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,50 +0,0 @@
dnl AM_CONFIG_HEADER(config.h)
AC_INIT([GeoIP], [1.4.8],[support@maxmind.com],[GeoIP])
AC_GNU_SOURCE
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([libGeoIP/GeoIP.c])
GEOIP_VERSION_INFO=`echo $VERSION | awk -F. '{ printf "%d:%d:%d", $1+$2, $3, $2 }'`
AC_SUBST(GEOIP_VERSION_INFO)
AC_PROG_CC
AC_PROG_LIBTOOL
AC_CHECK_TYPE(byte,[AC_DEFINE(HAVE_BYTE_TYPEDEF)],[])
AC_CHECK_TYPE(ushort,[AC_DEFINE(HAVE_USHORT_TYPEDEF)],[])
AC_CHECK_TYPE(ulong,[AC_DEFINE(HAVE_ULONG_TYPEDEF)],[])
AC_CHECK_TYPE(u16,[AC_DEFINE(HAVE_U16_TYPEDEF)],[])
AC_CHECK_TYPE(u32,[AC_DEFINE(HAVE_U32_TYPEDEF)],[])
AC_C_BIGENDIAN([AC_DEFINE(BIG_ENDIAN_HOST,1)],[AC_DEFINE(LITTLE_ENDIAN_HOST,1)])
AC_CHECK_HEADERS(stdint.h)
AC_CHECK_HEADERS(zlib.h, , AC_MSG_ERROR(Zlib header (zlib.h) not found. Tor requires zlib to build. You may need to install a zlib development package.))
AC_CHECK_FUNC(gettimeofday, AC_DEFINE(HAVE_GETTIMEOFDAY))
AC_CHECK_FUNC(vasprintf, AC_DEFINE(HAVE_VASPRINTF))
AC_CHECK_FUNC(vsnprintf, AC_DEFINE(HAVE_VSNPRINTF))
AC_CHECK_FUNC(vsprintf, AC_DEFINE(HAVE_VSPRINTF))
AC_CHECK_FUNC(gethostbyname, AC_DEFINE(HAVE_GETHOSTBYNAME),
AC_CHECK_LIB(nsl, gethostbyname, AC_DEFINE(HAVE_GETHOSTBYNAME)
LIBS="${LIBS} -lsocket -lnsl"))
AC_CHECK_FUNC(gethostbyname_r, [
AC_DEFINE(HAVE_GETHOSTBYNAME_R)
# We look for the one that returns `int'.
# Hopefully this check is robust enough.
AC_EGREP_HEADER(int.*gethostbyname_r, netdb.h, [
AC_DEFINE(GETHOSTBYNAME_R_RETURNS_INT)])
])
AC_OUTPUT([
Makefile
GeoIP.spec
libGeoIP/Makefile
apps/Makefile
conf/Makefile
data/Makefile
man/Makefile
test/Makefile
])

View File

@ -1,19 +0,0 @@
pkgdata_DATA =
dist_pkgdata_DATA = GeoIP.dat
DEFAULT_DB_FILE = $(pkgdatadir)/GeoIP.dat
install-data-hook:
@if test -f "$(DESTDIR)$(DEFAULT_DB_FILE)" ; then \
echo "$@ will not overwrite existing $(DESTDIR)$(DEFAULT_DB_FILE)" ; \
else \
echo "$(INSTALL_DATA) GeoIP.dat $(DESTDIR)$(DEFAULT_DB_FILE)"; \
$(INSTALL_DATA) "$(srcdir)/GeoIP.dat" "$(DESTDIR)$(DEFAULT_DB_FILE)"; \
fi
uninstall-hook:
@if test -f "$(DESTDIR)$(DEFAULT_DB_FILE)" ; then \
rm "$(DESTDIR)$(DEFAULT_DB_FILE)"; \
$(INSTALL_DATA) GeoIP.dat $(DESTDIR)$(DEFAULT_DB_FILE); \
fi

View File

@ -1,437 +0,0 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = data
DIST_COMMON = $(dist_pkgdata_DATA) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__installdirs = "$(DESTDIR)$(pkgdatadir)" "$(DESTDIR)$(pkgdatadir)"
DATA = $(dist_pkgdata_DATA) $(pkgdata_DATA)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GEOIP_VERSION_INFO = @GEOIP_VERSION_INFO@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
pkgdata_DATA =
dist_pkgdata_DATA = GeoIP.dat
DEFAULT_DB_FILE = $(pkgdatadir)/GeoIP.dat
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu data/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu data/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
install-dist_pkgdataDATA: $(dist_pkgdata_DATA)
@$(NORMAL_INSTALL)
test -z "$(pkgdatadir)" || $(MKDIR_P) "$(DESTDIR)$(pkgdatadir)"
@list='$(dist_pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgdatadir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(pkgdatadir)" || exit $$?; \
done
uninstall-dist_pkgdataDATA:
@$(NORMAL_UNINSTALL)
@list='$(dist_pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
test -n "$$files" || exit 0; \
echo " ( cd '$(DESTDIR)$(pkgdatadir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(pkgdatadir)" && rm -f $$files
install-pkgdataDATA: $(pkgdata_DATA)
@$(NORMAL_INSTALL)
test -z "$(pkgdatadir)" || $(MKDIR_P) "$(DESTDIR)$(pkgdatadir)"
@list='$(pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgdatadir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(pkgdatadir)" || exit $$?; \
done
uninstall-pkgdataDATA:
@$(NORMAL_UNINSTALL)
@list='$(pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
test -n "$$files" || exit 0; \
echo " ( cd '$(DESTDIR)$(pkgdatadir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(pkgdatadir)" && rm -f $$files
tags: TAGS
TAGS:
ctags: CTAGS
CTAGS:
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(DATA)
installdirs:
for dir in "$(DESTDIR)$(pkgdatadir)" "$(DESTDIR)$(pkgdatadir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am: install-dist_pkgdataDATA install-pkgdataDATA
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) install-data-hook
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-dist_pkgdataDATA uninstall-pkgdataDATA
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) uninstall-hook
.MAKE: install-am install-data-am install-strip uninstall-am
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
distclean distclean-generic distclean-libtool distdir dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-data-hook \
install-dist_pkgdataDATA install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
install-info install-info-am install-man install-pdf \
install-pdf-am install-pkgdataDATA install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
uninstall uninstall-am uninstall-dist_pkgdataDATA \
uninstall-hook uninstall-pkgdataDATA
install-data-hook:
@if test -f "$(DESTDIR)$(DEFAULT_DB_FILE)" ; then \
echo "$@ will not overwrite existing $(DESTDIR)$(DEFAULT_DB_FILE)" ; \
else \
echo "$(INSTALL_DATA) GeoIP.dat $(DESTDIR)$(DEFAULT_DB_FILE)"; \
$(INSTALL_DATA) "$(srcdir)/GeoIP.dat" "$(DESTDIR)$(DEFAULT_DB_FILE)"; \
fi
uninstall-hook:
@if test -f "$(DESTDIR)$(DEFAULT_DB_FILE)" ; then \
rm "$(DESTDIR)$(DEFAULT_DB_FILE)"; \
$(INSTALL_DATA) GeoIP.dat $(DESTDIR)$(DEFAULT_DB_FILE); \
fi
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -1,630 +0,0 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2009-04-28.21; # UTC
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free
# Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by `PROGRAMS ARGS'.
object Object file output by `PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputing dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
exit $?
;;
esac
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
cygpath_u="cygpath -u -f -"
if test "$depmode" = msvcmsys; then
# This is just like msvisualcpp but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u="sed s,\\\\\\\\,/,g"
depmode=msvisualcpp
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
## the command line argument order; so add the flags where they
## appear in depend2.am. Note that the slowdown incurred here
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
for arg
do
case $arg in
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
*) set fnord "$@" "$arg" ;;
esac
shift # fnord
shift # $arg
done
"$@"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say).
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
## The second -e expression handles DOS-style file names with drive letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the `deleted header file' problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
tr ' ' '
' < "$tmpdepfile" |
## Some versions of gcc put a space before the `:'. On the theory
## that the space means something, we add a space to the output as
## well.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like `#:fec' to the end of the
# dependency line.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr '
' ' ' >> "$depfile"
echo >> "$depfile"
# The second pass generates a dummy entry for each header file.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts `$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.u
tmpdepfile2=$base.u
tmpdepfile3=$dir.libs/$base.u
"$@" -Wc,-M
else
tmpdepfile1=$dir$base.u
tmpdepfile2=$dir$base.u
tmpdepfile3=$dir$base.u
"$@" -M
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
# Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
icc)
# Intel's C compiler understands `-MD -MF file'. However on
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
# ICC 7.0 will fill foo.d with something like
# foo.o: sub/foo.c
# foo.o: sub/foo.h
# which is wrong. We want:
# sub/foo.o: sub/foo.c
# sub/foo.o: sub/foo.h
# sub/foo.c:
# sub/foo.h:
# ICC 7.1 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using \ :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h',
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp2)
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
# compilers, which have integrated preprocessors. The correct option
# to use with these is +Maked; it writes dependencies to a file named
# 'foo.d', which lands next to the object file, wherever that
# happens to be.
# Much of this is similar to the tru64 case; see comments there.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir.libs/$base.d
"$@" -Wc,+Maked
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
"$@" +Maked
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
# Add `dependent.h:' lines.
sed -ne '2,${
s/^ *//
s/ \\*$//
s/$/:/
p
}' "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile" "$tmpdepfile2"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in `foo.d' instead, so we check for that too.
# Subdirectories are respected.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
# With Tru64 cc, shared objects can also be used to make a
# static library. This mechanism is used in libtool 1.4 series to
# handle both shared and static libraries in a single compilation.
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
#
# With libtool 1.5 this exception was removed, and libtool now
# generates 2 separate objects for the 2 libraries. These two
# compilations output dependencies in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
# automatically cleaned when .libs/ is deleted, while ignoring
# the former would cause a distcleancheck panic.
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
tmpdepfile2=$dir$base.o.d # libtool 1.5
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
tmpdepfile1=$dir$base.o.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
tmpdepfile4=$dir$base.d
"$@" -MD
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for `:'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
"$@" $dashmflag |
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' '
' < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no eat=no
for arg
do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
if test $eat = yes; then
eat=no
continue
fi
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-arch)
eat=yes ;;
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix=`echo "$object" | sed 's/^.*\././'`
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
sed '1,2d' "$tmpdepfile" | tr ' ' '
' | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E |
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
IFS=" "
for arg
do
case "$arg" in
-o)
shift
;;
$object)
shift
;;
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E 2>/dev/null |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
echo " " >> "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvcmsys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -1,14 +0,0 @@
# fetch version number from input file and write them to STDOUT
BEGIN {
while ((getline < ARGV[1]) > 0) {
if (match ($0, /^VERSION=/)) {
split($1, t, "=");
my_ver_str = t[2];
split(my_ver_str, v, ".");
gsub("[^0-9].*$", "", v[3]);
my_ver = v[1] "," v[2] "," v[3];
}
}
print "GEOIP_VERSION = " my_ver "";
print "GEOIP_VERSION_STR = " my_ver_str "";
}

View File

@ -1,520 +0,0 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2009-04-28.21; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
nl='
'
IFS=" "" $nl"
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit=${DOITPROG-}
if test -z "$doit"; then
doit_exec=exec
else
doit_exec=$doit
fi
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
chgrpprog=${CHGRPPROG-chgrp}
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
posix_glob='?'
initialize_posix_glob='
test "$posix_glob" != "?" || {
if (set -f) 2>/dev/null; then
posix_glob=
else
posix_glob=:
fi
}
'
posix_mkdir=
# Desired mode of installed file.
mode=0755
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
stripcmd=
src=
dst=
dir_arg=
dst_arg=
copy_on_change=false
no_target_directory=
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
--help display this help and exit.
--version display version info and exit.
-c (ignored)
-C install only if different (preserve the last data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
"
while test $# -ne 0; do
case $1 in
-c) ;;
-C) copy_on_change=true;;
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
case $mode in
*' '* | *' '* | *'
'* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
-o) chowncmd="$chownprog $2"
shift;;
-s) stripcmd=$stripprog;;
-t) dst_arg=$2
shift;;
-T) no_target_directory=true;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
shift
done
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dst_arg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dst_arg"
shift # fnord
fi
shift # arg
dst_arg=$arg
done
fi
if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call `install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
trap '(exit $?); exit' 1 2 13 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
for src
do
# Protect names starting with `-'.
case $src in
-*) src=./$src;;
esac
if test -n "$dir_arg"; then
dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dst_arg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg
# Protect names starting with `-'.
case $dst in
-*) dst=./$dst;;
esac
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dst=$dstdir/`basename "$src"`
dstdir_status=0
else
# Prefer dirname, but fall back on a substitute if dirname fails.
dstdir=`
(dirname "$dst") 2>/dev/null ||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$dst" : 'X\(//\)[^/]' \| \
X"$dst" : 'X\(//\)$' \| \
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$dst" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'
`
test -d "$dstdir"
dstdir_status=$?
fi
fi
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi
posix_mkdir=false
case $umask in
*[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
if (umask $mkdir_umask &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writeable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
ls_ld_tmpdir=`ls -ld "$tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/d" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
fi
trap '' 0;;
esac;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# The umask is ridiculous, or mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix='/';;
-*) prefix='./';;
*) prefix='';;
esac
eval "$initialize_posix_glob"
oIFS=$IFS
IFS=/
$posix_glob set -f
set fnord $dstdir
shift
$posix_glob set +f
IFS=$oIFS
prefixes=
for d
do
test -z "$d" && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
eval "$initialize_posix_glob" &&
$posix_glob set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
$posix_glob set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd -f "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
trap '' 0
fi
done
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

File diff suppressed because it is too large Load Diff

View File

@ -1,315 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
/* GeoIP.h
*
* Copyright (C) 2006 MaxMind LLC
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef GEOIP_H
#define GEOIP_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/types.h>
#if !defined(_WIN32)
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#else /* !defined(_WIN32) */
#include <winsock2.h>
#include <ws2tcpip.h>
#include <wspiapi.h>
#include <windows.h>
#define snprintf _snprintf
#define FILETIME_TO_USEC(ft) (((unsigned __int64) ft.dwHighDateTime << 32 | ft.dwLowDateTime) / 10)
#endif /* !defined(_WIN32) */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h> /* for fstat */
#include <sys/stat.h> /* for fstat */
#define SEGMENT_RECORD_LENGTH 3
#define LARGE_SEGMENT_RECORD_LENGTH 4
#define STANDARD_RECORD_LENGTH 3
#define ORG_RECORD_LENGTH 4
#define MAX_RECORD_LENGTH 4
#define NUM_DB_TYPES (33+1)
// TODO
#ifdef _WIN32
#include <io.h>
#include <stdio.h>
#define ssize_t int
static int pread(unsigned int fd, char *buf, size_t count, int offset);
#endif
/* 128 bit address in network order */
typedef struct in6_addr geoipv6_t;
#define GEOIP_CHKBIT_V6(bit,ptr) (ptr[((127UL - bit) >> 3)] & (1UL << (~(127 - bit) & 7)))
typedef struct GeoIPTag {
FILE *GeoIPDatabase;
char *file_path;
unsigned char *cache;
unsigned char *index_cache;
unsigned int *databaseSegments;
char databaseType;
time_t mtime;
int flags;
off_t size;
char record_length;
int charset; /* 0 iso-8859-1 1 utf8 */
int record_iter; /* used in GeoIP_next_record */
int netmask; /* netmask of last lookup - set using depth in _GeoIP_seek_record */
time_t last_mtime_check;
off_t dyn_seg_size; /* currently only used by the cityconfidence database */
unsigned int ext_flags; /* bit 0 teredo support enabled */
} GeoIP;
typedef enum {
GEOIP_TEREDO_BIT = 0
} GeoIPExtFlags;
typedef enum {
GEOIP_CHARSET_ISO_8859_1 = 0,
GEOIP_CHARSET_UTF8 = 1
} GeoIPCharset;
typedef struct GeoIPRegionTag {
char country_code[3];
char region[3];
} GeoIPRegion;
typedef enum {
GEOIP_STANDARD = 0,
GEOIP_MEMORY_CACHE = 1,
GEOIP_CHECK_CACHE = 2,
GEOIP_INDEX_CACHE = 4,
GEOIP_MMAP_CACHE = 8,
} GeoIPOptions;
typedef enum {
GEOIP_COUNTRY_EDITION = 1,
GEOIP_REGION_EDITION_REV0 = 7,
GEOIP_CITY_EDITION_REV0 = 6,
GEOIP_ORG_EDITION = 5,
GEOIP_ISP_EDITION = 4,
GEOIP_CITY_EDITION_REV1 = 2,
GEOIP_REGION_EDITION_REV1 = 3,
GEOIP_PROXY_EDITION = 8,
GEOIP_ASNUM_EDITION = 9,
GEOIP_NETSPEED_EDITION = 10,
GEOIP_DOMAIN_EDITION = 11,
GEOIP_COUNTRY_EDITION_V6 = 12,
GEOIP_LOCATIONA_EDITION = 13,
GEOIP_ACCURACYRADIUS_EDITION = 14,
GEOIP_CITYCONFIDENCE_EDITION = 15,
GEOIP_CITYCONFIDENCEDIST_EDITION = 16,
GEOIP_LARGE_COUNTRY_EDITION = 17,
GEOIP_LARGE_COUNTRY_EDITION_V6 = 18,
GEOIP_CITYCONFIDENCEDIST_ISP_ORG_EDITION = 19, /* unsued, but gaps are not allowed */
GEOIP_CCM_COUNTRY_EDITION =20, /* unsued, but gaps are not allowed */
GEOIP_ASNUM_EDITION_V6 = 21,
GEOIP_ISP_EDITION_V6 = 22,
GEOIP_ORG_EDITION_V6 = 23,
GEOIP_DOMAIN_EDITION_V6 = 24,
GEOIP_LOCATIONA_EDITION_V6 = 25,
GEOIP_REGISTRAR_EDITION = 26,
GEOIP_REGISTRAR_EDITION_V6 = 27,
GEOIP_USERTYPE_EDITION = 28,
GEOIP_USERTYPE_EDITION_V6 = 29,
GEOIP_CITY_EDITION_REV1_V6 = 30,
GEOIP_CITY_EDITION_REV0_V6 = 31,
GEOIP_NETSPEED_EDITION_REV1 = 32,
GEOIP_NETSPEED_EDITION_REV1_V6 = 33
} GeoIPDBTypes;
typedef enum {
GEOIP_ANON_PROXY = 1,
GEOIP_HTTP_X_FORWARDED_FOR_PROXY = 2,
GEOIP_HTTP_CLIENT_IP_PROXY = 3,
} GeoIPProxyTypes;
typedef enum {
GEOIP_UNKNOWN_SPEED = 0,
GEOIP_DIALUP_SPEED = 1,
GEOIP_CABLEDSL_SPEED = 2,
GEOIP_CORPORATE_SPEED = 3,
} GeoIPNetspeedValues;
extern char **GeoIPDBFileName;
extern const char * GeoIPDBDescription[NUM_DB_TYPES];
extern const char *GeoIPCountryDBFileName;
extern const char *GeoIPRegionDBFileName;
extern const char *GeoIPCityDBFileName;
extern const char *GeoIPOrgDBFileName;
extern const char *GeoIPISPDBFileName;
extern const char *GeoIPLocationADBFileName;
extern const char *GeoIPAccuracyRadiusFileName;
extern const char *GeoIPCityConfidenceFileName;
/* Warning: do not use those arrays as doing so may break your
* program with newer GeoIP versions */
extern const char GeoIP_country_code[254][3];
extern const char GeoIP_country_code3[254][4];
extern const char * GeoIP_country_name[254];
extern const char * GeoIP_utf8_country_name[254];
extern const char GeoIP_country_continent[254][3];
#ifdef DLL
#define GEOIP_API __declspec(dllexport)
#else
#define GEOIP_API
#endif /* DLL */
GEOIP_API void GeoIP_setup_custom_directory(char *dir);
GEOIP_API GeoIP* GeoIP_open_type (int type, int flags);
GEOIP_API GeoIP* GeoIP_new(int flags);
GEOIP_API GeoIP* GeoIP_open(const char * filename, int flags);
GEOIP_API int GeoIP_db_avail(int type);
GEOIP_API void GeoIP_delete(GeoIP* gi);
GEOIP_API const char *GeoIP_country_code_by_addr (GeoIP* gi, const char *addr);
GEOIP_API const char *GeoIP_country_code_by_name (GeoIP* gi, const char *host);
GEOIP_API const char *GeoIP_country_code3_by_addr (GeoIP* gi, const char *addr);
GEOIP_API const char *GeoIP_country_code3_by_name (GeoIP* gi, const char *host);
GEOIP_API const char *GeoIP_country_name_by_addr (GeoIP* gi, const char *addr);
GEOIP_API const char *GeoIP_country_name_by_name (GeoIP* gi, const char *host);
GEOIP_API const char *GeoIP_country_name_by_ipnum (GeoIP* gi, unsigned long ipnum);
GEOIP_API const char *GeoIP_country_code_by_ipnum (GeoIP* gi, unsigned long ipnum);
GEOIP_API const char *GeoIP_country_code3_by_ipnum (GeoIP* gi, unsigned long ipnum);
/* */
GEOIP_API const char *GeoIP_country_name_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum);
GEOIP_API const char *GeoIP_country_code_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum);
GEOIP_API const char *GeoIP_country_code3_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum);
GEOIP_API const char *GeoIP_country_code_by_addr_v6 (GeoIP* gi, const char *addr);
GEOIP_API const char *GeoIP_country_code_by_name_v6 (GeoIP* gi, const char *host);
GEOIP_API const char *GeoIP_country_code3_by_addr_v6 (GeoIP* gi, const char *addr);
GEOIP_API const char *GeoIP_country_code3_by_name_v6 (GeoIP* gi, const char *host);
GEOIP_API const char *GeoIP_country_name_by_addr_v6 (GeoIP* gi, const char *addr);
GEOIP_API const char *GeoIP_country_name_by_name_v6 (GeoIP* gi, const char *host);
/* Deprecated - for backwards compatibility only */
GEOIP_API int GeoIP_country_id_by_addr (GeoIP* gi, const char *addr);
GEOIP_API int GeoIP_country_id_by_name (GeoIP* gi, const char *host);
GEOIP_API char *GeoIP_org_by_addr (GeoIP* gi, const char *addr);
GEOIP_API char *GeoIP_org_by_name (GeoIP* gi, const char *host);
GEOIP_API char *GeoIP_org_by_ipnum (GeoIP* gi, unsigned long ipnum);
GEOIP_API char *GeoIP_org_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum);
GEOIP_API char *GeoIP_org_by_addr_v6 (GeoIP* gi, const char *addr);
GEOIP_API char *GeoIP_org_by_name_v6 (GeoIP* gi, const char *name);
/* End deprecated */
GEOIP_API int GeoIP_id_by_addr (GeoIP* gi, const char *addr);
GEOIP_API int GeoIP_id_by_name (GeoIP* gi, const char *host);
GEOIP_API int GeoIP_id_by_ipnum (GeoIP* gi, unsigned long ipnum);
GEOIP_API int GeoIP_id_by_addr_v6 (GeoIP* gi, const char *addr);
GEOIP_API int GeoIP_id_by_name_v6 (GeoIP* gi, const char *host);
GEOIP_API int GeoIP_id_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum);
GEOIP_API GeoIPRegion * GeoIP_region_by_addr (GeoIP* gi, const char *addr);
GEOIP_API GeoIPRegion * GeoIP_region_by_name (GeoIP* gi, const char *host);
GEOIP_API GeoIPRegion * GeoIP_region_by_ipnum (GeoIP *gi, unsigned long ipnum);
GEOIP_API GeoIPRegion * GeoIP_region_by_addr_v6 (GeoIP* gi, const char *addr);
GEOIP_API GeoIPRegion * GeoIP_region_by_name_v6 (GeoIP* gi, const char *host);
GEOIP_API GeoIPRegion * GeoIP_region_by_ipnum_v6 (GeoIP *gi, geoipv6_t ipnum);
/* Warning - don't call this after GeoIP_assign_region_by_inetaddr calls */
GEOIP_API void GeoIPRegion_delete (GeoIPRegion *gir);
GEOIP_API void GeoIP_assign_region_by_inetaddr(GeoIP* gi, unsigned long inetaddr, GeoIPRegion *gir);
GEOIP_API void GeoIP_assign_region_by_inetaddr_v6(GeoIP* gi, geoipv6_t inetaddr, GeoIPRegion *gir);
/* Used to query GeoIP Organization, ISP and AS Number databases */
GEOIP_API char *GeoIP_name_by_ipnum (GeoIP* gi, unsigned long ipnum);
GEOIP_API char *GeoIP_name_by_addr (GeoIP* gi, const char *addr);
GEOIP_API char *GeoIP_name_by_name (GeoIP* gi, const char *host);
GEOIP_API char *GeoIP_name_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum);
GEOIP_API char *GeoIP_name_by_addr_v6 (GeoIP* gi, const char *addr);
GEOIP_API char *GeoIP_name_by_name_v6 (GeoIP* gi, const char *name);
/** return two letter country code */
GEOIP_API const char* GeoIP_code_by_id(int id);
/** return three letter country code */
GEOIP_API const char* GeoIP_code3_by_id(int id);
/** return full name of country in utf8 or iso-8859-1 */
GEOIP_API const char* GeoIP_country_name_by_id(GeoIP* gi, int id);
/** return full name of country */
GEOIP_API const char* GeoIP_name_by_id(int id);
/** return continent of country */
GEOIP_API const char* GeoIP_continent_by_id(int id);
/** return id by country code **/
GEOIP_API int GeoIP_id_by_code(const char *country);
/** return return number of known countries */
GEOIP_API unsigned GeoIP_num_countries(void);
GEOIP_API char *GeoIP_database_info (GeoIP* gi);
GEOIP_API unsigned char GeoIP_database_edition (GeoIP* gi);
GEOIP_API int GeoIP_charset (GeoIP* gi);
GEOIP_API int GeoIP_set_charset (GeoIP* gi, int charset);
GEOIP_API int GeoIP_enable_teredo (GeoIP* gi, int true_false );
GEOIP_API int GeoIP_teredo (GeoIP* gi );
GEOIP_API int GeoIP_last_netmask (GeoIP* gi);
GEOIP_API char **GeoIP_range_by_ip (GeoIP* gi, const char *addr);
GEOIP_API void GeoIP_range_by_ip_delete(char **ptr);
/* Convert region code to region name */
GEOIP_API const char * GeoIP_region_name_by_code(const char *country_code, const char *region_code);
/* Get timezone from country and region code */
GEOIP_API const char * GeoIP_time_zone_by_country_and_region(const char *country_code, const char *region_code);
/* some v4 helper functions as of 1.4.7 exported to the public API */
GEOIP_API unsigned long GeoIP_addr_to_num(const char *addr);
GEOIP_API char * GeoIP_num_to_addr(unsigned long ipnum);
/* Internal function -- convert iso to utf8; return a malloced utf8 string. */
char * _GeoIP_iso_8859_1__utf8(const char * iso);
/* Cleans up memory used to hold file name paths. Returns 1 if successful; otherwise 0.
* */
GEOIP_API int GeoIP_cleanup(void);
/* Returns the library version in use. Helpful if your loading dynamically. */
GEOIP_API const char * GeoIP_lib_version(void);
#
#ifdef __cplusplus
}
#endif
#endif /* GEOIP_H */

View File

@ -1,393 +0,0 @@
/*
* GeoIPCity.c
*
* Copyright (C) 2006 MaxMind LLC
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation; either version 2.1 of the License, or (at your
* option) any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <GeoIP.h>
#include <GeoIP_internal.h>
#include <GeoIPCity.h>
#if !defined(_WIN32)
#include <unistd.h>
#include <netdb.h>
#include <netinet/in.h> /* For ntohl */
#else
#include <windows.h>
#include <winsock.h>
#endif
#include <sys/types.h> /* For uint32_t */
#ifdef HAVE_STDINT_H
#include <stdint.h> /* For uint32_t */
#endif
static
const int FULL_RECORD_LENGTH = 50;
static const int CITYCONFIDENCE_FIXED_RECORD = 4;
static const int CITYCONFIDENCEDIST_FIXED_RECORD = 6;
static
GeoIPRecord *
_extract_record(GeoIP * gi, unsigned int seek_record, int *next_record_ptr)
{
int record_pointer;
unsigned char *record_buf = NULL;
unsigned char *begin_record_buf = NULL;
GeoIPRecord *record;
int str_length = 0;
int j;
double latitude = 0, longitude = 0;
int metroarea_combo = 0;
int bytes_read = 0;
if (seek_record == gi->databaseSegments[0])
return NULL;
record = malloc(sizeof(GeoIPRecord));
memset(record, 0, sizeof(GeoIPRecord));
record->charset = gi->charset;
if (gi->databaseType == GEOIP_CITYCONFIDENCE_EDITION
|| gi->databaseType == GEOIP_CITYCONFIDENCEDIST_EDITION) {
int fixed_rec_size = gi->record_length +
((gi->databaseType == GEOIP_CITYCONFIDENCE_EDITION)
? CITYCONFIDENCE_FIXED_RECORD
: CITYCONFIDENCEDIST_FIXED_RECORD);
//allocate max rec size, even for CITYCONFIDENCE_FIXED_RECORD
//+4 is the max_record_length
// TODO
unsigned char tmp_fixed_record[6/*CITYCONFIDENCEDIST_FIXED_RECORD*/ + 4];
int dseg = gi->databaseSegments[0] * gi->record_length * 2 + gi->record_length;
// int aligned_dseg = dseg ;
int offset = seek_record - gi->databaseSegments[0] - 1; /* -1 b/c zero is not
* found. but the array
* start with 0 */
record_pointer = offset * fixed_rec_size + dseg + gi->dyn_seg_size;
if (gi->cache == NULL) {
/* read from disk */
bytes_read = pread(fileno(gi->GeoIPDatabase), tmp_fixed_record, fixed_rec_size, record_pointer);
if (bytes_read != fixed_rec_size)
return NULL;
record->country_conf = tmp_fixed_record[0];
record->region_conf = tmp_fixed_record[1];
record->city_conf = tmp_fixed_record[2];
record->postal_conf = tmp_fixed_record[3];
record->accuracy_radius =
gi->databaseType == GEOIP_CITYCONFIDENCEDIST_EDITION
? ((tmp_fixed_record[4] + (tmp_fixed_record[5] << 8)) & 0x3ff) : 0x3ff;
int t = fixed_rec_size - gi->record_length;
record_pointer = dseg + tmp_fixed_record[t] +
(tmp_fixed_record[t + 1] << 8) + (tmp_fixed_record[t + 2] << 16) ;
if (gi->record_length == 4)
record_pointer += (tmp_fixed_record[t + 3] << 24);
begin_record_buf = record_buf = malloc(sizeof(char) * FULL_RECORD_LENGTH);
bytes_read = pread(fileno(gi->GeoIPDatabase), record_buf, FULL_RECORD_LENGTH, record_pointer);
if (bytes_read == 0) {
/* eof or other error */
free(begin_record_buf);
free(record);
return NULL;
}
}
else {
record_buf = gi->cache + (long) record_pointer;
record->country_conf = record_buf[0];
record->region_conf = record_buf[1];
record->city_conf = record_buf[2];
record->postal_conf = record_buf[3];
record->accuracy_radius =
gi->databaseType == GEOIP_CITYCONFIDENCEDIST_EDITION
? ((record_buf[4] + (record_buf[5] << 8)) & 0x3ff) : 0x3ff;
int t = fixed_rec_size - gi->record_length;
record_pointer = dseg + record_buf[t] +
(record_buf[t + 1] << 8) + (record_buf[t + 2] << 16) ;
if (gi->record_length == 4)
record_pointer += (record_buf[t + 3] << 24);
record_buf = gi->cache + (long) record_pointer;
}
} /* other city records */
else {
record->country_conf = GEOIP_UNKNOWN_CONF;
record->region_conf = GEOIP_UNKNOWN_CONF;
record->city_conf = GEOIP_UNKNOWN_CONF;
record->postal_conf = GEOIP_UNKNOWN_CONF;
record->accuracy_radius = GEOIP_UNKNOWN_ACCURACY_RADIUS;
record_pointer = seek_record + (2 * gi->record_length - 1) * gi->databaseSegments[0];
if (gi->cache == NULL) {
begin_record_buf = record_buf = malloc(sizeof(char) * FULL_RECORD_LENGTH);
bytes_read = pread(fileno(gi->GeoIPDatabase), record_buf, FULL_RECORD_LENGTH, record_pointer);
if (bytes_read == 0) {
/* eof or other error */
free(begin_record_buf);
free(record);
return NULL;
}
}
else {
record_buf = gi->cache + (long) record_pointer;
}
}
/* get country */
record->continent_code = (char *) GeoIP_country_continent[record_buf[0]];
record->country_code = (char *) GeoIP_country_code[record_buf[0]];
record->country_code3 = (char *) GeoIP_country_code3[record_buf[0]];
record->country_name = (char *) GeoIP_country_name_by_id(gi, record_buf[0]);
record_buf++;
/* get region */
while (record_buf[str_length] != '\0')
str_length++;
if (str_length > 0) {
record->region = malloc(str_length + 1);
strncpy(record->region, (char *) record_buf, str_length + 1);
}
record_buf += str_length + 1;
str_length = 0;
/* get city */
while (record_buf[str_length] != '\0')
str_length++;
if (str_length > 0) {
if (gi->charset == GEOIP_CHARSET_UTF8) {
record->city = _GeoIP_iso_8859_1__utf8((const char *) record_buf);
}
else {
record->city = malloc(str_length + 1);
strncpy(record->city, (const char *) record_buf, str_length + 1);
}
}
record_buf += (str_length + 1);
str_length = 0;
/* get postal code */
while (record_buf[str_length] != '\0')
str_length++;
if (str_length > 0) {
record->postal_code = malloc(str_length + 1);
strncpy(record->postal_code, (char *) record_buf, str_length + 1);
}
record_buf += (str_length + 1);
/* get latitude */
for (j = 0; j < 3; ++j)
latitude += (record_buf[j] << (j * 8));
record->latitude = latitude / 10000 - 180;
record_buf += 3;
/* get longitude */
for (j = 0; j < 3; ++j)
longitude += (record_buf[j] << (j * 8));
record->longitude = longitude / 10000 - 180;
/*
* get area code and metro code for post April 2002 databases and for US
* locations
*/
if (GEOIP_CITY_EDITION_REV1 == gi->databaseType
|| GEOIP_CITYCONFIDENCE_EDITION == gi->databaseType) {
if (!strcmp(record->country_code, "US")) {
record_buf += 3;
for (j = 0; j < 3; ++j)
metroarea_combo += (record_buf[j] << (j * 8));
record->metro_code = metroarea_combo / 1000;
record->area_code = metroarea_combo % 1000;
}
}
if (gi->cache == NULL)
free(begin_record_buf);
/* Used for GeoIP_next_record */
if (next_record_ptr != NULL)
*next_record_ptr = seek_record + record_buf - begin_record_buf + 3;
return record;
}
static
GeoIPRecord *
_get_record(GeoIP * gi, unsigned long ipnum)
{
unsigned int seek_record;
if (gi->databaseType != GEOIP_CITY_EDITION_REV0
&& gi->databaseType != GEOIP_CITY_EDITION_REV1
&& gi->databaseType != GEOIP_CITYCONFIDENCE_EDITION
&& gi->databaseType != GEOIP_CITYCONFIDENCEDIST_EDITION) {
printf("Invalid database type %s, expected %s\n", GeoIPDBDescription[(int) gi->databaseType], GeoIPDBDescription[GEOIP_CITY_EDITION_REV1]);
return 0;
}
seek_record = _GeoIP_seek_record(gi, ipnum);
return _extract_record(gi, seek_record, NULL);
}
static
GeoIPRecord *
_get_record_v6(GeoIP * gi, geoipv6_t ipnum)
{
unsigned int seek_record;
if (gi->databaseType != GEOIP_CITY_EDITION_REV0_V6 &&
gi->databaseType != GEOIP_CITY_EDITION_REV1_V6) {
printf("Invalid database type %s, expected %s\n", GeoIPDBDescription[(int) gi->databaseType], GeoIPDBDescription[GEOIP_CITY_EDITION_REV1_V6]);
return 0;
}
seek_record = _GeoIP_seek_record_v6(gi, ipnum);
return _extract_record(gi, seek_record, NULL);
}
GeoIPRecord *
GeoIP_record_by_ipnum(GeoIP * gi, unsigned long ipnum)
{
return _get_record(gi, ipnum);
}
GeoIPRecord *
GeoIP_record_by_ipnum_v6(GeoIP * gi, geoipv6_t ipnum)
{
return _get_record_v6(gi, ipnum);
}
GeoIPRecord *
GeoIP_record_by_addr(GeoIP * gi, const char *addr)
{
unsigned long ipnum;
if (addr == NULL) {
return 0;
}
ipnum = GeoIP_addr_to_num(addr);
return _get_record(gi, ipnum);
}
GeoIPRecord *
GeoIP_record_by_addr_v6(GeoIP * gi, const char *addr)
{
geoipv6_t ipnum;
if (addr == NULL) {
return 0;
}
ipnum = _GeoIP_addr_to_num_v6(addr);
return _get_record_v6(gi, ipnum);
}
GeoIPRecord *
GeoIP_record_by_name(GeoIP * gi, const char *name)
{
unsigned long ipnum;
if (name == NULL) {
return 0;
}
ipnum = _GeoIP_lookupaddress(name);
return _get_record(gi, ipnum);
}
GeoIPRecord *
GeoIP_record_by_name_v6(GeoIP * gi, const char *name)
{
geoipv6_t ipnum;
if (name == NULL) {
return 0;
}
ipnum = _GeoIP_lookupaddress_v6(name);
return _get_record_v6(gi, ipnum);
}
int
GeoIP_record_id_by_addr(GeoIP * gi, const char *addr)
{
unsigned long ipnum;
if (gi->databaseType != GEOIP_CITY_EDITION_REV0 &&
gi->databaseType != GEOIP_CITY_EDITION_REV1) {
printf("Invalid database type %s, expected %s\n", GeoIPDBDescription[(int) gi->databaseType], GeoIPDBDescription[GEOIP_CITY_EDITION_REV1]);
return 0;
}
if (addr == NULL) {
return 0;
}
ipnum = GeoIP_addr_to_num(addr);
return _GeoIP_seek_record(gi, ipnum);
}
int
GeoIP_record_id_by_addr_v6(GeoIP * gi, const char *addr)
{
geoipv6_t ipnum;
if (gi->databaseType != GEOIP_CITY_EDITION_REV0_V6 &&
gi->databaseType != GEOIP_CITY_EDITION_REV1_V6) {
printf("Invalid database type %s, expected %s\n", GeoIPDBDescription[(int) gi->databaseType], GeoIPDBDescription[GEOIP_CITY_EDITION_REV1]);
return 0;
}
if (addr == NULL) {
return 0;
}
ipnum = _GeoIP_addr_to_num_v6(addr);
return _GeoIP_seek_record_v6(gi, ipnum);
}
int
GeoIP_init_record_iter(GeoIP * gi)
{
return gi->databaseSegments[0] + 1;
}
int
GeoIP_next_record(GeoIP * gi, GeoIPRecord ** gir, int *record_iter)
{
if (gi->cache != NULL) {
printf("GeoIP_next_record not supported in memory cache mode\n");
return 1;
}
*gir = _extract_record(gi, *record_iter, record_iter);
return 0;
}
void
GeoIPRecord_delete(GeoIPRecord * gir)
{
free(gir->region);
free(gir->city);
free(gir->postal_code);
free(gir);
}

View File

@ -1,78 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
/* GeoIPCity.h
*
* Copyright (C) 2006 MaxMind LLC
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef GEOIPCITY_H
#define GEOIPCITY_H
#include <GeoIP.h>
#ifdef __cplusplus
extern "C" {
#endif
#define GEOIP_UNKNOWN_CONF ( 0x7f )
#define GEOIP_UNKNOWN_ACCURACY_RADIUS ( 0x3ff )
typedef struct GeoIPRecordTag {
char *country_code;
char *country_code3;
char *country_name;
char *region;
char *city;
char *postal_code;
float latitude;
float longitude;
union {
int metro_code; /* metro_code is a alias for dma_code */
int dma_code;
};
int area_code;
int charset;
char *continent_code;
/* confidence factor for Country/Region/City/Postal */
unsigned char country_conf, region_conf, city_conf, postal_conf;
int accuracy_radius;
} GeoIPRecord;
GeoIPRecord * GeoIP_record_by_ipnum (GeoIP* gi, unsigned long ipnum);
GeoIPRecord * GeoIP_record_by_addr (GeoIP* gi, const char *addr);
GeoIPRecord * GeoIP_record_by_name (GeoIP* gi, const char *host);
GeoIPRecord * GeoIP_record_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum);
GeoIPRecord * GeoIP_record_by_addr_v6 (GeoIP* gi, const char *addr);
GeoIPRecord * GeoIP_record_by_name_v6 (GeoIP* gi, const char *host);
int GeoIP_record_id_by_addr (GeoIP* gi, const char *addr);
int GeoIP_record_id_by_addr_v6 (GeoIP* gi, const char *addr);
int GeoIP_init_record_iter (GeoIP* gi);
/* returns 0 on success, 1 on failure */
int GeoIP_next_record (GeoIP* gi, GeoIPRecord **gir, int *record_iter);
void GeoIPRecord_delete (GeoIPRecord *gir);
/* NULL on failure otherwise a malloced string in utf8 */
/* char * GeoIP_iso_8859_1__utf8(const char *); */
#ifdef __cplusplus
}
#endif
#endif /* GEOIPCITY_H */

View File

@ -1,975 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
/* GeoIPUpdate.c
*
* Copyright (C) 2006 MaxMind LLC
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "GeoIPCity.h"
#include "GeoIP.h"
#include "GeoIPUpdate.h"
#include "GeoIP_internal.h"
#include "global.h"
#include "md5.h"
#include <sys/types.h>
#if !defined(_WIN32)
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <netdb.h>
#else
#include <windows.h>
//#include <winsock.h>
#include <winsock2.h>
#endif
#include <zlib.h>
#include <time.h>
#include <stdio.h>
//#include <unistd.h>
#define BLOCK_SIZE 1024
/* Update DB Host & HTTP GET Request formats:
* ------------------------------------------
* GET must support an optional HTTP Proxy.
*/
const char *GeoIPUpdateHost = "updates.maxmind.com";
/* This is the direct, or proxy port number. */
static int GeoIPHTTPPort = 80;
/* License-only format (OLD) */
const char *GeoIPHTTPRequest = "GET %s%s/app/update?license_key=%s&md5=%s HTTP/1.0\nHost: updates.maxmind.com\n\n";
/* General DB Types formats */
const char *GeoIPHTTPRequestFilename = "GET %s%s/app/update_getfilename?product_id=%s HTTP/1.0\nHost: %s\n\n";
const char *GeoIPHTTPRequestClientIP = "GET %s%s/app/update_getipaddr HTTP/1.0\nHost: %s\n\n";
const char *GeoIPHTTPRequestMD5 = "GET %s%s/app/update_secure?db_md5=%s&challenge_md5=%s&user_id=%s&edition_id=%s HTTP/1.0\nHost: updates.maxmind.com\n\n";
/* messages */
const char *NoCurrentDB = "%s can't be opened, proceeding to download database\n";
const char *MD5Info = "MD5 Digest of installed database is %s\n";
const char *SavingGzip = "Saving gzip file to %s ... ";
const char *WritingFile = "Writing uncompressed data to %s ...";
const char * GeoIP_get_error_message(int i) {
switch (i) {
case GEOIP_NO_NEW_UPDATES:
return "no new updates";
case GEOIP_SUCCESS:
return "Success";
case GEOIP_LICENSE_KEY_INVALID_ERR:
return "License Key Invalid";
case GEOIP_DNS_ERR:
return "Unable to resolve hostname";
case GEOIP_NON_IPV4_ERR:
return "Non - IPv4 address";
case GEOIP_SOCKET_OPEN_ERR:
return "Error opening socket";
case GEOIP_CONNECTION_ERR:
return "Unable to connect";
case GEOIP_GZIP_IO_ERR:
return "Unable to write GeoIP.dat.gz file";
case GEOIP_TEST_IO_ERR:
return "Unable to write GeoIP.dat.test file";
case GEOIP_GZIP_READ_ERR:
return "Unable to read gzip data";
case GEOIP_OUT_OF_MEMORY_ERR:
return "Out of memory error";
case GEOIP_SOCKET_READ_ERR:
return "Error reading from socket, see errno";
case GEOIP_SANITY_OPEN_ERR:
return "Sanity check GeoIP_open error";
case GEOIP_SANITY_INFO_FAIL:
return "Sanity check database_info string failed";
case GEOIP_SANITY_LOOKUP_FAIL:
return "Sanity check ip address lookup failed";
case GEOIP_RENAME_ERR:
return "Rename error while installing db, check errno";
case GEOIP_USER_ID_INVALID_ERR:
return "Invalid userID";
case GEOIP_PRODUCT_ID_INVALID_ERR:
return "Invalid product ID or subscription expired";
case GEOIP_INVALID_SERVER_RESPONSE:
return "Server returned something unexpected";
default:
return "no error";
}
}
int GeoIP_fprintf(int (*f)(FILE *, char *),FILE *fp, const char *str, ...) {
va_list ap;
int rc;
char * f_str;
int silence;
if ( f == NULL )
return 0;
va_start(ap, str);
#if defined(HAVE_VASPRINTF)
silence = vasprintf(&f_str, str, ap);
#elif defined (HAVE_VSNPRINTF)
f_str = malloc(4096);
if ( f_str )
silence = vsnprintf(f_str, 4096, str, ap);
#else
f_str = malloc(4096);
if ( f_str )
silence = vsprintf(f_str, str, ap);
#endif
va_end(ap);
if ( f_str == NULL )
return -1;
rc = (*f)(fp, f_str);
free(f_str);
return(rc);
}
void GeoIP_printf(void (*f)(char *), const char *str,...) {
va_list params;
char * f_str;
int silence;
if (f == NULL)
return;
va_start(params, str);
#if defined(HAVE_VASPRINTF)
silence = vasprintf(&f_str, str, params);
#elif defined (HAVE_VSNPRINTF)
f_str = malloc(4096);
if ( f_str )
silence = vsnprintf(f_str, 4096, str, params);
#else
f_str = malloc(4096);
if ( f_str )
silence = vsprintf(f_str, str, params);
#endif
va_end(params);
if ( f_str == NULL )
return;
(*f)(f_str);
free(f_str);
}
/* Support HTTP Proxy Host
* --------------------------------------------------
* Use typical OS support for the optional HTTP Proxy.
*
* Proxy adds http://{real-hostname} to URI format strings:
* sprintf("GET %s%s/ HTTP/1.0\r\n",GeoIPProxyHTTP,GeoIPProxiedHost, ...);
*/
/* The Protocol is usually "" OR "http://" with a proxy. */
static char *GeoIPProxyHTTP = "";
/* GeoIP Hostname where proxy forwards requests. */
static char *GeoIPProxiedHost = "";
/* Read http_proxy env. variable & parse it.
* -----------------------------------------
* Allow only these formats:
* "http://server.com", "http://server.com:8080"
* OR
* "server.com", "server.com:8080"
*
* A "user:password@" part will break this.
*/
short int parse_http_proxy(char **proxy_host, int *port) {
char * http_proxy;
char * port_value;
if ((http_proxy = getenv("http_proxy"))) {
if (! strncmp("http://", http_proxy, 7)) http_proxy += 7;
*proxy_host = strdup(http_proxy);
if ( *proxy_host == NULL )
return 0; /* let the other functions deal with the memory error */
if ((port_value = strchr(*proxy_host, ':'))) {
*port_value++ = '\0';
*port = atoi(port_value);
}
else {
*port = 80;
}
return(1);
}
else {
return(0);
}
}
/* Get the GeoIP host or the current HTTP Proxy host. */
struct hostent *GeoIP_get_host_or_proxy (void) {
char * hostname = (char *) GeoIPUpdateHost;
char * proxy_host;
int proxy_port;
/* Set Proxy from OS: Unix/Linux */
if (parse_http_proxy(&proxy_host,&proxy_port)) {
hostname = proxy_host;
GeoIPProxyHTTP = "http://";
GeoIPProxiedHost = (char *) GeoIPUpdateHost;
GeoIPHTTPPort = proxy_port;
}
/* Resolve DNS host entry. */
return(gethostbyname(hostname));
}
short int GeoIP_update_database (char * license_key, int verbose, void (*f)( char * )) {
struct hostent *hostlist;
int sock;
char * buf;
struct sockaddr_in sa;
int offset = 0, err;
char * request_uri;
char * compr;
unsigned long comprLen;
FILE *comp_fh, *cur_db_fh, *gi_fh;
gzFile gz_fh;
char * file_path_gz, * file_path_test;
MD5_CONTEXT context;
unsigned char buffer[1024], digest[16];
char hex_digest[33] = "00000000000000000000000000000000\0";
unsigned int i;
GeoIP * gi;
char * db_info;
char block[BLOCK_SIZE];
int block_size = BLOCK_SIZE;
size_t len;
size_t written;
_GeoIP_setup_dbfilename();
/* get MD5 of current GeoIP database file */
if ((cur_db_fh = fopen (GeoIPDBFileName[GEOIP_COUNTRY_EDITION], "rb")) == NULL) {
GeoIP_printf(f,"%s%s", NoCurrentDB, GeoIPDBFileName[GEOIP_COUNTRY_EDITION]);
} else {
md5_init(&context);
while ((len = fread (buffer, 1, 1024, cur_db_fh)) > 0)
md5_write (&context, buffer, len);
md5_final (&context);
memcpy(digest,context.buf,16);
fclose (cur_db_fh);
for (i = 0; i < 16; i++) {
// "%02x" will write 3 chars
snprintf (&hex_digest[2*i], 3, "%02x", digest[i]);
}
GeoIP_printf(f, MD5Info, hex_digest);
}
hostlist = GeoIP_get_host_or_proxy();
if (hostlist == NULL)
return GEOIP_DNS_ERR;
if (hostlist->h_addrtype != AF_INET)
return GEOIP_NON_IPV4_ERR;
if((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
return GEOIP_SOCKET_OPEN_ERR;
}
memset(&sa, 0, sizeof(struct sockaddr_in));
sa.sin_port = htons(GeoIPHTTPPort);
memcpy(&sa.sin_addr, hostlist->h_addr_list[0], hostlist->h_length);
sa.sin_family = AF_INET;
if (verbose == 1){
GeoIP_printf(f,"Connecting to MaxMind GeoIP Update server\n");
GeoIP_printf(f, "via Host or Proxy Server: %s:%d\n", hostlist->h_name, GeoIPHTTPPort);
}
/* Download gzip file */
if (connect(sock, (struct sockaddr *)&sa, sizeof(struct sockaddr))< 0)
return GEOIP_CONNECTION_ERR;
request_uri = malloc(sizeof(char) * (strlen(license_key) + strlen(GeoIPHTTPRequest)
+ strlen(GeoIPProxyHTTP) + strlen(GeoIPProxiedHost) + 36 + 1));
if (request_uri == NULL)
return GEOIP_OUT_OF_MEMORY_ERR;
sprintf(request_uri,GeoIPHTTPRequest,GeoIPProxyHTTP,GeoIPProxiedHost,license_key, hex_digest);
send(sock, request_uri, strlen(request_uri),0);
free(request_uri);
buf = malloc(sizeof(char) * block_size + 1);
if (buf == NULL)
return GEOIP_OUT_OF_MEMORY_ERR;
if (verbose == 1)
GeoIP_printf(f,"Downloading gzipped GeoIP Database...\n");
for (;;) {
int amt;
amt = recv(sock, &buf[offset], block_size,0);
if (amt == 0) {
break;
} else if (amt == -1) {
free(buf);
return GEOIP_SOCKET_READ_ERR;
}
offset += amt;
buf = realloc(buf, offset+block_size + 1);
if (buf == NULL)
return GEOIP_OUT_OF_MEMORY_ERR;
}
buf[offset]=0;
compr = strstr(buf, "\r\n\r\n");
if ( compr == NULL ) {
free(buf);
return GEOIP_INVALID_SERVER_RESPONSE;
}
/* skip searchstr "\r\n\r\n" */
compr += 4;
comprLen = offset + buf - compr;
if (strstr(compr, "License Key Invalid") != NULL) {
if (verbose == 1)
GeoIP_printf(f,"Failed\n");
free(buf);
return GEOIP_LICENSE_KEY_INVALID_ERR;
} else if (strstr(compr, "Invalid product ID or subscription expired") != NULL){
free(buf);
return GEOIP_PRODUCT_ID_INVALID_ERR;
} else if (strstr(compr, "No new updates available") != NULL) {
free(buf);
return GEOIP_NO_NEW_UPDATES;
}
if (verbose == 1)
GeoIP_printf(f,"Done\n");
/* save gzip file */
file_path_gz = malloc(sizeof(char) * (strlen(GeoIPDBFileName[GEOIP_COUNTRY_EDITION]) + 4));
if (file_path_gz == NULL)
return GEOIP_OUT_OF_MEMORY_ERR;
strcpy(file_path_gz,GeoIPDBFileName[GEOIP_COUNTRY_EDITION]);
strcat(file_path_gz,".gz");
if (verbose == 1) {
GeoIP_printf(f, SavingGzip, file_path_gz);
}
comp_fh = fopen(file_path_gz, "wb");
if(comp_fh == NULL) {
free(file_path_gz);
free(buf);
return GEOIP_GZIP_IO_ERR;
}
written = fwrite(compr, 1, comprLen, comp_fh);
fclose(comp_fh);
free(buf);
if ( written != comprLen )
return GEOIP_GZIP_IO_ERR;
if (verbose == 1)
GeoIP_printf(f,"Done\n");
if (verbose == 1)
GeoIP_printf(f,"Uncompressing gzip file ... ");
/* uncompress gzip file */
gz_fh = gzopen(file_path_gz, "rb");
file_path_test = malloc(sizeof(char) * (strlen(GeoIPDBFileName[GEOIP_COUNTRY_EDITION]) + 6));
if (file_path_test == NULL)
return GEOIP_OUT_OF_MEMORY_ERR;
strcpy(file_path_test,GeoIPDBFileName[GEOIP_COUNTRY_EDITION]);
strcat(file_path_test,".test");
gi_fh = fopen(file_path_test, "wb");
if(gi_fh == NULL) {
free(file_path_test);
return GEOIP_TEST_IO_ERR;
}
for (;;) {
int amt;
amt = gzread(gz_fh, block, block_size);
if (amt == -1) {
free(file_path_test);
fclose(gi_fh);
gzclose(gz_fh);
return GEOIP_GZIP_READ_ERR;
}
if (amt == 0) {
break;
}
if ( fwrite(block,1,amt,gi_fh) != amt ){
free(file_path_test);
fclose(gi_fh);
gzclose(gz_fh);
return GEOIP_GZIP_READ_ERR;
}
}
gzclose(gz_fh);
unlink(file_path_gz);
free(file_path_gz);
fclose(gi_fh);
if (verbose == 1)
GeoIP_printf(f,"Done\n");
if (verbose == 1) {
GeoIP_printf(f, WritingFile, GeoIPDBFileName[GEOIP_COUNTRY_EDITION]);
}
/* sanity check */
gi = GeoIP_open(file_path_test, GEOIP_STANDARD);
if (verbose == 1)
GeoIP_printf(f,"Performing santity checks ... ");
if (gi == NULL) {
GeoIP_printf(f,"Error opening sanity check database\n");
return GEOIP_SANITY_OPEN_ERR;
}
/* this checks to make sure the files is complete, since info is at the end */
/* dependent on future databases having MaxMind in info */
if (verbose == 1)
GeoIP_printf(f,"database_info ");
db_info = GeoIP_database_info(gi);
if (db_info == NULL) {
GeoIP_delete(gi);
if (verbose == 1)
GeoIP_printf(f,"FAIL\n");
return GEOIP_SANITY_INFO_FAIL;
}
if (strstr(db_info, "MaxMind") == NULL) {
free(db_info);
GeoIP_delete(gi);
if (verbose == 1)
GeoIP_printf(f,"FAIL\n");
return GEOIP_SANITY_INFO_FAIL;
}
free(db_info);
if (verbose == 1)
GeoIP_printf(f,"PASS ");
/* this performs an IP lookup test of a US IP address */
if (verbose == 1)
GeoIP_printf(f,"lookup ");
if (strcmp(GeoIP_country_code_by_addr(gi,"24.24.24.24"), "US") != 0) {
GeoIP_delete(gi);
if (verbose == 1)
GeoIP_printf(f,"FAIL\n");
return GEOIP_SANITY_LOOKUP_FAIL;
}
GeoIP_delete(gi);
if (verbose == 1)
GeoIP_printf(f,"PASS\n");
/* install GeoIP.dat.test -> GeoIP.dat */
err = rename(file_path_test, GeoIPDBFileName[GEOIP_COUNTRY_EDITION]);
if (err != 0) {
GeoIP_printf(f,"GeoIP Install error while renaming file\n");
return GEOIP_RENAME_ERR;
}
if (verbose == 1)
GeoIP_printf(f,"Done\n");
return 0;
}
short int GeoIP_update_database_general (char * user_id,char * license_key,char *data_base_type, int verbose,char ** client_ipaddr, void (*f)( char *)) {
struct hostent *hostlist;
int sock;
char * buf;
struct sockaddr_in sa;
int offset = 0, err;
char * request_uri;
char * compr;
unsigned long comprLen;
FILE *comp_fh, *cur_db_fh, *gi_fh;
gzFile gz_fh;
char * file_path_gz, * file_path_test;
MD5_CONTEXT context;
MD5_CONTEXT context2;
unsigned char buffer[1024], digest[16] ,digest2[16];
char hex_digest[33] = "0000000000000000000000000000000\0";
char hex_digest2[33] = "0000000000000000000000000000000\0";
unsigned int i;
char *f_str;
GeoIP * gi;
char * db_info;
char *ipaddress;
char *geoipfilename;
char *tmpstr;
int dbtype;
int lookupresult = 1;
char block[BLOCK_SIZE];
int block_size = BLOCK_SIZE;
size_t len;
size_t request_uri_len;
size_t size;
hostlist = GeoIP_get_host_or_proxy();
if (hostlist == NULL)
return GEOIP_DNS_ERR;
if (hostlist->h_addrtype != AF_INET)
return GEOIP_NON_IPV4_ERR;
if((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
return GEOIP_SOCKET_OPEN_ERR;
}
memset(&sa, 0, sizeof(struct sockaddr_in));
sa.sin_port = htons(GeoIPHTTPPort);
memcpy(&sa.sin_addr, hostlist->h_addr_list[0], hostlist->h_length);
sa.sin_family = AF_INET;
if (verbose == 1) {
GeoIP_printf(f,"Connecting to MaxMind GeoIP server\n");
GeoIP_printf(f, "via Host or Proxy Server: %s:%d\n", hostlist->h_name, GeoIPHTTPPort);
}
if (connect(sock, (struct sockaddr *)&sa, sizeof(struct sockaddr))< 0)
return GEOIP_CONNECTION_ERR;
request_uri = malloc(sizeof(char) * (strlen(GeoIPHTTPRequestFilename)
+ strlen(GeoIPProxyHTTP) + strlen(GeoIPProxiedHost)
+ strlen(data_base_type) + strlen(GeoIPUpdateHost) + 1));
if (request_uri == NULL)
return GEOIP_OUT_OF_MEMORY_ERR;
/* get the file name from a web page using the product id */
sprintf(request_uri,GeoIPHTTPRequestFilename,GeoIPProxyHTTP,GeoIPProxiedHost,data_base_type,GeoIPUpdateHost);
if (verbose == 1) {
GeoIP_printf(f, "sending request %s \n",request_uri);
}
send(sock, request_uri, strlen(request_uri),0); /* send the request */
free(request_uri);
buf = malloc(sizeof(char) * (block_size+4));
if (buf == NULL)
return GEOIP_OUT_OF_MEMORY_ERR;
offset = 0;
for (;;){
int amt;
amt = recv(sock, &buf[offset], block_size,0);
if (amt == 0){
break;
} else if (amt == -1) {
free(buf);
return GEOIP_SOCKET_READ_ERR;
}
offset += amt;
buf = realloc(buf, offset + block_size + 4);
}
buf[offset] = 0;
offset = 0;
tmpstr = strstr(buf, "\r\n\r\n");
if ( tmpstr == NULL ) {
free(buf);
return GEOIP_INVALID_SERVER_RESPONSE;
}
/* skip searchstr "\r\n\r\n" */
tmpstr += 4;
if (tmpstr[0] == '.' || strchr(tmpstr, '/') != NULL || strchr(tmpstr, '\\') != NULL) {
free(buf);
return GEOIP_INVALID_SERVER_RESPONSE;
}
geoipfilename = _GeoIP_full_path_to(tmpstr);
free(buf);
/* print the database product id and the database filename */
if (verbose == 1){
GeoIP_printf(f, "database product id %s database file name %s \n",data_base_type,geoipfilename);
}
_GeoIP_setup_dbfilename();
/* get MD5 of current GeoIP database file */
if ((cur_db_fh = fopen (geoipfilename, "rb")) == NULL) {
GeoIP_printf(f, NoCurrentDB, geoipfilename);
} else {
md5_init(&context);
while ((len = fread (buffer, 1, 1024, cur_db_fh)) > 0)
md5_write (&context, buffer, len);
md5_final (&context);
memcpy(digest,context.buf,16);
fclose (cur_db_fh);
for (i = 0; i < 16; i++)
sprintf (&hex_digest[2*i], "%02x", digest[i]);
GeoIP_printf(f, MD5Info, hex_digest );
}
if (verbose == 1) {
GeoIP_printf(f,"MD5 sum of database %s is %s \n",geoipfilename,hex_digest);
}
if (client_ipaddr[0] == NULL) {
/* We haven't gotten our IP address yet, so let's request it */
if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
free(geoipfilename);
return GEOIP_SOCKET_OPEN_ERR;
}
memset(&sa, 0, sizeof(struct sockaddr_in));
sa.sin_port = htons(GeoIPHTTPPort);
memcpy(&sa.sin_addr, hostlist->h_addr_list[0], hostlist->h_length);
sa.sin_family = AF_INET;
if (verbose == 1)
GeoIP_printf(f,"Connecting to MaxMind GeoIP Update server\n");
/* Download gzip file */
if (connect(sock, (struct sockaddr *)&sa, sizeof(struct sockaddr))< 0) {
free(geoipfilename);
return GEOIP_CONNECTION_ERR;
}
request_uri = malloc(sizeof(char) * (strlen(GeoIPHTTPRequestClientIP)
+ strlen(GeoIPProxyHTTP)
+ strlen(GeoIPProxiedHost)
+ strlen(GeoIPUpdateHost) + 1 ));
if (request_uri == NULL) {
free(geoipfilename);
return GEOIP_OUT_OF_MEMORY_ERR;
}
/* get client ip address from MaxMind web page */
sprintf(request_uri,GeoIPHTTPRequestClientIP,GeoIPProxyHTTP,GeoIPProxiedHost,GeoIPUpdateHost);
send(sock, request_uri, strlen(request_uri),0); /* send the request */
if (verbose == 1) {
GeoIP_printf(f, "sending request %s", request_uri);
}
free(request_uri);
buf = malloc(sizeof(char) * (block_size+1));
if (buf == NULL) {
free(geoipfilename);
return GEOIP_OUT_OF_MEMORY_ERR;
}
offset = 0;
for (;;){
int amt;
amt = recv(sock, &buf[offset], block_size,0);
if (amt == 0) {
break;
} else if (amt == -1) {
free(buf);
return GEOIP_SOCKET_READ_ERR;
}
offset += amt;
buf = realloc(buf, offset+block_size+1);
}
buf[offset] = 0;
offset = 0;
ipaddress = strstr(buf, "\r\n\r\n") + 4; /* get the ip address */
ipaddress = malloc(strlen(strstr(buf, "\r\n\r\n") + 4)+5);
strcpy(ipaddress,strstr(buf, "\r\n\r\n") + 4);
client_ipaddr[0] = ipaddress;
if (verbose == 1) {
GeoIP_printf(f, "client ip address: %s\n",ipaddress);
}
free(buf);
close(sock);
}
ipaddress = client_ipaddr[0];
/* make a md5 sum of ip address and license_key and store it in hex_digest2 */
md5_init(&context2);
md5_write (&context2, (byte *)license_key, 12);//add license key to the md5 sum
md5_write (&context2, (byte *)ipaddress, strlen(ipaddress));//add ip address to the md5 sum
md5_final (&context2);
memcpy(digest2,context2.buf,16);
for (i = 0; i < 16; i++)
snprintf (&hex_digest2[2*i], 3, "%02x", digest2[i]);// change the digest to a hex digest
if (verbose == 1) {
GeoIP_printf(f, "md5sum of ip address and license key is %s \n",hex_digest2);
}
/* send the request using the user id,product id,
* md5 sum of the prev database and
* the md5 sum of the license_key and ip address */
if((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
return GEOIP_SOCKET_OPEN_ERR;
}
memset(&sa, 0, sizeof(struct sockaddr_in));
sa.sin_port = htons(GeoIPHTTPPort);
memcpy(&sa.sin_addr, hostlist->h_addr_list[0], hostlist->h_length);
sa.sin_family = AF_INET;
if (connect(sock, (struct sockaddr *)&sa, sizeof(struct sockaddr))< 0)
return GEOIP_CONNECTION_ERR;
request_uri_len = sizeof(char) * 2036;
request_uri = malloc(request_uri_len);
if (request_uri == NULL)
return GEOIP_OUT_OF_MEMORY_ERR;
snprintf(request_uri, request_uri_len, GeoIPHTTPRequestMD5,GeoIPProxyHTTP,GeoIPProxiedHost,hex_digest,hex_digest2,user_id,data_base_type);
send(sock, request_uri, strlen(request_uri),0);
if (verbose == 1) {
GeoIP_printf(f, "sending request %s\n",request_uri);
}
free(request_uri);
offset = 0;
buf = malloc(sizeof(char) * block_size);
if (buf == NULL)
return GEOIP_OUT_OF_MEMORY_ERR;
if (verbose == 1)
GeoIP_printf(f,"Downloading gzipped GeoIP Database...\n");
for (;;) {
int amt;
amt = recv(sock, &buf[offset], block_size,0);
if (amt == 0) {
break;
} else if (amt == -1) {
free(buf);
return GEOIP_SOCKET_READ_ERR;
}
offset += amt;
buf = realloc(buf, offset+block_size);
if (buf == NULL)
return GEOIP_OUT_OF_MEMORY_ERR;
}
compr = strstr(buf, "\r\n\r\n") + 4;
comprLen = offset + buf - compr;
if (strstr(compr, "License Key Invalid") != NULL) {
if (verbose == 1)
GeoIP_printf(f,"Failed\n");
free(buf);
return GEOIP_LICENSE_KEY_INVALID_ERR;
} else if (strstr(compr, "No new updates available") != NULL) {
free(buf);
GeoIP_printf(f, "%s is up to date, no updates required\n", geoipfilename);
return GEOIP_NO_NEW_UPDATES;
} else if (strstr(compr, "Invalid UserId") != NULL){
free(buf);
return GEOIP_USER_ID_INVALID_ERR;
} else if (strstr(compr, "Invalid product ID or subscription expired") != NULL){
free(buf);
return GEOIP_PRODUCT_ID_INVALID_ERR;
}
if (verbose == 1)
GeoIP_printf(f,"Done\n");
GeoIP_printf(f, "Updating %s\n", geoipfilename);
/* save gzip file */
file_path_gz = malloc(sizeof(char) * (strlen(geoipfilename) + 4));
if (file_path_gz == NULL)
return GEOIP_OUT_OF_MEMORY_ERR;
strcpy(file_path_gz,geoipfilename);
strcat(file_path_gz,".gz");
if (verbose == 1) {
GeoIP_printf(f, SavingGzip, file_path_gz );
}
comp_fh = fopen(file_path_gz, "wb");
if(comp_fh == NULL) {
free(file_path_gz);
free(buf);
return GEOIP_GZIP_IO_ERR;
}
size = fwrite(compr, 1, comprLen, comp_fh);
fclose(comp_fh);
free(buf);
if ( size != comprLen ) {
return GEOIP_GZIP_IO_ERR;
}
if (verbose == 1) {
GeoIP_printf(f, "download data to a gz file named %s \n",file_path_gz);
GeoIP_printf(f,"Done\n");
GeoIP_printf(f,"Uncompressing gzip file ... ");
}
file_path_test = malloc(sizeof(char) * (strlen(GeoIPDBFileName[GEOIP_COUNTRY_EDITION]) + 6));
if (file_path_test == NULL) {
free(file_path_gz);
return GEOIP_OUT_OF_MEMORY_ERR;
}
strcpy(file_path_test,GeoIPDBFileName[GEOIP_COUNTRY_EDITION]);
strcat(file_path_test,".test");
gi_fh = fopen(file_path_test, "wb");
if(gi_fh == NULL) {
free(file_path_test);
free(file_path_gz);
return GEOIP_TEST_IO_ERR;
}
/* uncompress gzip file */
offset = 0;
gz_fh = gzopen(file_path_gz, "rb");
for (;;) {
int amt;
amt = gzread(gz_fh, block, block_size);
if (amt == -1) {
free(file_path_gz);
free(file_path_test);
gzclose(gz_fh);
fclose(gi_fh);
return GEOIP_GZIP_READ_ERR;
}
if (amt == 0) {
break;
}
if ( amt != fwrite(block,1,amt,gi_fh) ){
return GEOIP_GZIP_IO_ERR;
}
}
gzclose(gz_fh);
unlink(file_path_gz);
free(file_path_gz);
fclose(gi_fh);
if (verbose == 1)
GeoIP_printf(f,"Done\n");
if (verbose == 1) {
len = strlen(WritingFile) + strlen(geoipfilename) - 1;
f_str = malloc(len);
snprintf(f_str,len,WritingFile,geoipfilename);
free(f_str);
}
/* sanity check */
gi = GeoIP_open(file_path_test, GEOIP_STANDARD);
if (verbose == 1)
GeoIP_printf(f,"Performing santity checks ... ");
if (gi == NULL) {
GeoIP_printf(f,"Error opening sanity check database\n");
return GEOIP_SANITY_OPEN_ERR;
}
/* get the database type */
dbtype = GeoIP_database_edition(gi);
if (verbose == 1) {
GeoIP_printf(f, "Database type is %d\n",dbtype);
}
/* this checks to make sure the files is complete, since info is at the end
dependent on future databases having MaxMind in info (ISP and Organization databases currently don't have info string */
if ((dbtype != GEOIP_ISP_EDITION)&&
(dbtype != GEOIP_ORG_EDITION)) {
if (verbose == 1)
GeoIP_printf(f,"database_info ");
db_info = GeoIP_database_info(gi);
if (db_info == NULL) {
GeoIP_delete(gi);
if (verbose == 1)
GeoIP_printf(f,"FAIL null\n");
return GEOIP_SANITY_INFO_FAIL;
}
if (strstr(db_info, "MaxMind") == NULL) {
free(db_info);
GeoIP_delete(gi);
if (verbose == 1)
GeoIP_printf(f,"FAIL maxmind\n");
return GEOIP_SANITY_INFO_FAIL;
}
free(db_info);
if (verbose == 1)
GeoIP_printf(f,"PASS ");
}
/* this performs an IP lookup test of a US IP address */
if (verbose == 1)
GeoIP_printf(f,"lookup ");
if (dbtype == GEOIP_NETSPEED_EDITION) {
int netspeed = GeoIP_id_by_name(gi,"24.24.24.24");
lookupresult = 0;
if (netspeed == GEOIP_CABLEDSL_SPEED){
lookupresult = 1;
}
}
if (dbtype == GEOIP_COUNTRY_EDITION) {
/* if data base type is country then call the function
* named GeoIP_country_code_by_addr */
lookupresult = 1;
if (strcmp(GeoIP_country_code_by_addr(gi,"24.24.24.24"), "US") != 0) {
lookupresult = 0;
}
if (verbose == 1) {
GeoIP_printf(f,"testing GEOIP_COUNTRY_EDITION\n");
}
}
if (dbtype == GEOIP_REGION_EDITION_REV1) {
/* if data base type is region then call the function
* named GeoIP_region_by_addr */
GeoIPRegion *r = GeoIP_region_by_addr(gi,"24.24.24.24");
lookupresult = 0;
if (r != NULL) {
lookupresult = 1;
free(r);
}
if (verbose == 1) {
GeoIP_printf(f,"testing GEOIP_REGION_EDITION\n");
}
}
if (dbtype == GEOIP_CITY_EDITION_REV1) {
/* if data base type is city then call the function
* named GeoIP_record_by_addr */
GeoIPRecord *r = GeoIP_record_by_addr(gi,"24.24.24.24");
lookupresult = 0;
if (r != NULL) {
lookupresult = 1;
free(r);
}
if (verbose == 1) {
GeoIP_printf(f,"testing GEOIP_CITY_EDITION\n");
}
}
if ((dbtype == GEOIP_ISP_EDITION)||
(dbtype == GEOIP_ORG_EDITION)) {
/* if data base type is isp or org then call the function
* named GeoIP_org_by_addr */
GeoIPRecord *r = (GeoIPRecord*)GeoIP_org_by_addr(gi,"24.24.24.24");
lookupresult = 0;
if (r != NULL) {
lookupresult = 1;
free(r);
}
if (verbose == 1) {
if (dbtype == GEOIP_ISP_EDITION) {
GeoIP_printf(f,"testing GEOIP_ISP_EDITION\n");
}
if (dbtype == GEOIP_ORG_EDITION) {
GeoIP_printf(f,"testing GEOIP_ORG_EDITION\n");
}
}
}
if (lookupresult == 0) {
GeoIP_delete(gi);
if (verbose == 1)
GeoIP_printf(f,"FAIL\n");
return GEOIP_SANITY_LOOKUP_FAIL;
}
GeoIP_delete(gi);
if (verbose == 1)
GeoIP_printf(f,"PASS\n");
/* install GeoIP.dat.test -> GeoIP.dat */
err = rename(file_path_test, geoipfilename);
if (err != 0) {
GeoIP_printf(f,"GeoIP Install error while renaming file\n");
return GEOIP_RENAME_ERR;
}
if (verbose == 1)
GeoIP_printf(f,"Done\n");
free(geoipfilename);
return 0;
}

View File

@ -1,69 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
/* GeoIP.h
*
* Copyright (C) 2006 MaxMind LLC
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef GEOIPUPDATE_H
#define GEOIPUPDATE_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdarg.h>
#include <stdio.h>
typedef enum {
GEOIP_NO_NEW_UPDATES = 1, /* Database up-to-date, no action taken */
GEOIP_SUCCESS = 0, /* Success */
GEOIP_LICENSE_KEY_INVALID_ERR = -1, /* License Key Invalid */
GEOIP_DNS_ERR = -11, /* Unable to resolve hostname */
GEOIP_NON_IPV4_ERR = -12, /* Non - IPv4 address */
GEOIP_SOCKET_OPEN_ERR = -13, /* Error opening socket */
GEOIP_CONNECTION_ERR = -14, /* Unable to connect */
GEOIP_GZIP_IO_ERR = -15, /* Unable to write GeoIP.dat.gz file */
GEOIP_TEST_IO_ERR = -16, /* Unable to write GeoIP.dat.test file */
GEOIP_GZIP_READ_ERR = -17, /* Unable to read gzip data */
GEOIP_OUT_OF_MEMORY_ERR = -18, /* Out of memory error */
GEOIP_SOCKET_READ_ERR = -19, /* Error reading from socket, see errno */
GEOIP_SANITY_OPEN_ERR = -20, /* Sanity check GeoIP_open error */
GEOIP_SANITY_INFO_FAIL = -21, /* Sanity check database_info string failed */
GEOIP_SANITY_LOOKUP_FAIL = -22, /* Sanity check ip address lookup failed */
GEOIP_RENAME_ERR = -23, /* Rename error while installing db, check errno */
GEOIP_USER_ID_INVALID_ERR = -24, /* Invalid userID */
GEOIP_PRODUCT_ID_INVALID_ERR = -25, /* Invalid product ID or subscription expired */
GEOIP_INVALID_SERVER_RESPONSE = -26 /* Server returned invalid response */
} GeoIPUpdateCode;
const char * GeoIP_get_error_message(int i);
/* Original Update Function, just for MaxMind GeoIP Country database */
short int GeoIP_update_database (char * license_key, int verbose, void (*f)( char *));
/* More generalized update function that works more databases */
short int GeoIP_update_database_general (char * user_id, char * license_key,char * data_base_type, int verbose,char ** client_ipaddr, void (*f)( char *));
/* experimental export */
int GeoIP_fprintf(int (*f)(FILE *, char *),FILE *fp, const char *fmt, ...);
void GeoIP_printf(void (*f)(char *), const char *fmt, ...);
#ifdef __cplusplus
}
#endif
#endif /* GEOIPUPDATE_H */

View File

@ -1,18 +0,0 @@
#ifndef GEOIP_INTERNAL_H
#define GEOIP_INTERNAL_H
#include "GeoIP.h"
GEOIP_API unsigned int _GeoIP_seek_record (GeoIP *gi, unsigned long ipnum);
GEOIP_API unsigned int _GeoIP_seek_record_v6 (GeoIP *gi, geoipv6_t ipnum);
GEOIP_API geoipv6_t _GeoIP_addr_to_num_v6 (const char *addr);
GEOIP_API unsigned long _GeoIP_lookupaddress (const char *host);
GEOIP_API geoipv6_t _GeoIP_lookupaddress_v6 (const char *host);
GEOIP_API int __GEOIP_V6_IS_NULL(geoipv6_t v6);
GEOIP_API void _GeoIP_setup_dbfilename();
GEOIP_API char *_GeoIP_full_path_to(const char *file_name);
#endif

View File

@ -1,27 +0,0 @@
lib_LTLIBRARIES = libGeoIP.la libGeoIPUpdate.la
EXTRA_DIST = Makefile.vc md5.h global.h types.h GeoIP_internal.h
AM_CPPFLAGS = -DGEOIPDATADIR=\"$(pkgdatadir)\" -Wall
libGeoIP_la_SOURCES = GeoIP.c GeoIPCity.c regionName.c timeZone.c
include_HEADERS = GeoIP.h GeoIPCity.h GeoIPUpdate.h
libGeoIPUpdate_la_SOURCES = GeoIPUpdate.c md5.c
libGeoIP_la_LDFLAGS = -version-info @GEOIP_VERSION_INFO@
libGeoIPUpdate_la_LIBADD = -lz libGeoIP.la
GeoIP.lo GeoIP.o: GeoIP.c GeoIP.h
GeoIPCity.lo GeoIPCity.o: GeoIPCity.c GeoIP.h
GeoIPUpdate.lo GeoIPUpdate.o: GeoIPUpdate.c GeoIPCity.h GeoIP.h
regionName.lo regionName.o: regionName.c
md5.lo md5.o: md5.c
timeZone.lo timeZone.o: timeZone.c

View File

@ -1,567 +0,0 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = libGeoIP
DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"
LTLIBRARIES = $(lib_LTLIBRARIES)
libGeoIP_la_LIBADD =
am_libGeoIP_la_OBJECTS = GeoIP.lo GeoIPCity.lo regionName.lo \
timeZone.lo
libGeoIP_la_OBJECTS = $(am_libGeoIP_la_OBJECTS)
libGeoIP_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(libGeoIP_la_LDFLAGS) $(LDFLAGS) -o $@
libGeoIPUpdate_la_DEPENDENCIES = libGeoIP.la
am_libGeoIPUpdate_la_OBJECTS = GeoIPUpdate.lo md5.lo
libGeoIPUpdate_la_OBJECTS = $(am_libGeoIPUpdate_la_OBJECTS)
DEFAULT_INCLUDES = -I.@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
SOURCES = $(libGeoIP_la_SOURCES) $(libGeoIPUpdate_la_SOURCES)
DIST_SOURCES = $(libGeoIP_la_SOURCES) $(libGeoIPUpdate_la_SOURCES)
HEADERS = $(include_HEADERS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GEOIP_VERSION_INFO = @GEOIP_VERSION_INFO@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
lib_LTLIBRARIES = libGeoIP.la libGeoIPUpdate.la
EXTRA_DIST = Makefile.vc md5.h global.h types.h GeoIP_internal.h
AM_CPPFLAGS = -DGEOIPDATADIR=\"$(pkgdatadir)\" -Wall
libGeoIP_la_SOURCES = GeoIP.c GeoIPCity.c regionName.c timeZone.c
include_HEADERS = GeoIP.h GeoIPCity.h GeoIPUpdate.h
libGeoIPUpdate_la_SOURCES = GeoIPUpdate.c md5.c
libGeoIP_la_LDFLAGS = -version-info @GEOIP_VERSION_INFO@
libGeoIPUpdate_la_LIBADD = -lz libGeoIP.la
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libGeoIP/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu libGeoIP/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
list2=; for p in $$list; do \
if test -f $$p; then \
list2="$$list2 $$p"; \
else :; fi; \
done; \
test -z "$$list2" || { \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
}
uninstall-libLTLIBRARIES:
@$(NORMAL_UNINSTALL)
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
for p in $$list; do \
$(am__strip_dir) \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
done
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libGeoIP.la: $(libGeoIP_la_OBJECTS) $(libGeoIP_la_DEPENDENCIES)
$(libGeoIP_la_LINK) -rpath $(libdir) $(libGeoIP_la_OBJECTS) $(libGeoIP_la_LIBADD) $(LIBS)
libGeoIPUpdate.la: $(libGeoIPUpdate_la_OBJECTS) $(libGeoIPUpdate_la_DEPENDENCIES)
$(LINK) -rpath $(libdir) $(libGeoIPUpdate_la_OBJECTS) $(libGeoIPUpdate_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GeoIP.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GeoIPCity.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GeoIPUpdate.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/md5.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regionName.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timeZone.Plo@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
install-includeHEADERS: $(include_HEADERS)
@$(NORMAL_INSTALL)
test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \
$(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \
done
uninstall-includeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
test -n "$$files" || exit 0; \
echo " ( cd '$(DESTDIR)$(includedir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(includedir)" && rm -f $$files
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am: install-includeHEADERS
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am: install-libLTLIBRARIES
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libLTLIBRARIES clean-libtool ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-includeHEADERS install-info \
install-info-am install-libLTLIBRARIES install-man install-pdf \
install-pdf-am install-ps install-ps-am install-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-includeHEADERS \
uninstall-libLTLIBRARIES
GeoIP.lo GeoIP.o: GeoIP.c GeoIP.h
GeoIPCity.lo GeoIPCity.o: GeoIPCity.c GeoIP.h
GeoIPUpdate.lo GeoIPUpdate.o: GeoIPUpdate.c GeoIPCity.h GeoIP.h
regionName.lo regionName.o: regionName.c
md5.lo md5.o: md5.c
timeZone.lo timeZone.o: timeZone.c
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -1,34 +0,0 @@
#NMAKE makefile for Windows developers.
#Produces a static library (GeoIP.lib).
COMPILER=cl
CFLAGS=-DWIN32 -MD -nologo
GEOIPINC = -I..\libGeoIP
CC1 = $(COMPILER) $(CFLAGS) $(GEOIPINC) -DGEOIPDATADIR=\"$(GEOIPDATADIR)\"
OBJS=GeoIP.obj GeoIPCity.obj regionName.obj md5.obj timeZone.obj
EXTRA_LIBS= advapi32.lib wsock32.lib
AR=lib
GeoIP.lib: GeoIP.obj GeoIPCity.obj regionName.obj md5.obj timeZone.obj
$(AR) -nologo $(OBJS) $(EXTRA_LIBS) /OUT:GeoIP.lib
GeoIP.obj: GeoIP.c
$(CC1) -c GeoIP.c $(GEOIPINC)
GeoIPCity.obj: GeoIPCity.c
$(CC1) -c GeoIPCity.c $(GEOIPINC)
regionName.obj: regionName.c
$(CC1) -c regionName.c $(GEOIPINC)
md5.obj: md5.c
$(CC1) -c md5.c $(GEOIPINC)
timeZone.obj: timeZone.c
$(CC1) -c timeZone.c $(GEOIPINC)

View File

@ -1,32 +0,0 @@
/* GLOBAL.H - RSAREF types and constants
*/
/* PROTOTYPES should be set to one if and only if the compiler supports
function argument prototyping.
The following makes PROTOTYPES default to 0 if it has not already
been defined with C compiler flags.
*/
#ifndef PROTOTYPES
#define PROTOTYPES 0
#endif
/* POINTER defines a generic pointer type */
typedef unsigned char *POINTER;
/* UINT2 defines a two byte word */
typedef unsigned short int UINT2;
/* UINT4 defines a four byte word */
typedef unsigned long int UINT4;
/* PROTO_LIST is defined depending on how PROTOTYPES is defined above.
If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it
returns an empty list.
*/
#if PROTOTYPES
#define PROTO_LIST(list) list
#else
#define PROTO_LIST(list) ()
#endif

View File

@ -1,326 +0,0 @@
/* md5.c - MD5 Message-Digest Algorithm
* Copyright (C) 1995, 1996, 1998, 1999,
* 2000, 2001 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* According to the definition of MD5 in RFC 1321 from April 1992.
* NOTE: This is *not* the same file as the one from glibc.
*/
/* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. */
/* Heavily modified for GnuPG by <wk@gnupg.org> */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "types.h"
#ifdef WORDS_BIGENDIAN
#define BIG_ENDIAN_HOST
#endif
//#define DIM(v) (sizeof(v)/sizeof((v)[0]))
#define wipememory2(_ptr,_set,_len) do { volatile char *_vptr=(volatile char *)(_ptr); size_t _vlen=(_len); while(_vlen) { *_vptr=(_set); _vptr++; _vlen--; } } while(0)
#define wipememory(_ptr,_len) wipememory2(_ptr,0,_len)
#define rol(x,n) ( ((x) << (n)) | ((x) >> (32-(n))) )
typedef struct {
u32 A,B,C,D; /* chaining variables */
u32 nblocks;
byte buf[64];
int count;
} MD5_CONTEXT;
void
md5_init( MD5_CONTEXT *ctx )
{
ctx->A = 0x67452301;
ctx->B = 0xefcdab89;
ctx->C = 0x98badcfe;
ctx->D = 0x10325476;
ctx->nblocks = 0;
ctx->count = 0;
}
/* These are the four functions used in the four steps of the MD5 algorithm
and defined in the RFC 1321. The first function is a little bit optimized
(as found in Colin Plumbs public domain implementation). */
/* #define FF(b, c, d) ((b & c) | (~b & d)) */
#define FF(b, c, d) (d ^ (b & (c ^ d)))
#define FG(b, c, d) FF (d, b, c)
#define FH(b, c, d) (b ^ c ^ d)
#define FI(b, c, d) (c ^ (b | ~d))
static void
burn_stack (int bytes)
{
char buf[128];
wipememory(buf,sizeof buf);
bytes -= sizeof buf;
if (bytes > 0)
burn_stack (bytes);
}
/****************
* transform n*64 bytes
*/
static void
/*transform( MD5_CONTEXT *ctx, const void *buffer, size_t len )*/
transform( MD5_CONTEXT *ctx, byte *data )
{
u32 correct_words[16];
u32 A = ctx->A;
u32 B = ctx->B;
u32 C = ctx->C;
u32 D = ctx->D;
u32 *cwp = correct_words;
#ifdef BIG_ENDIAN_HOST
{ int i;
byte *p2, *p1;
for(i=0, p1=data, p2=(byte*)correct_words; i < 16; i++, p2 += 4 ) {
p2[3] = *p1++;
p2[2] = *p1++;
p2[1] = *p1++;
p2[0] = *p1++;
}
}
#else
memcpy( correct_words, data, 64 );
#endif
#define OP(a, b, c, d, s, T) \
do \
{ \
a += FF (b, c, d) + (*cwp++) + T; \
a = rol(a, s); \
a += b; \
} \
while (0)
/* Before we start, one word about the strange constants.
They are defined in RFC 1321 as
T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64
*/
/* Round 1. */
OP (A, B, C, D, 7, 0xd76aa478);
OP (D, A, B, C, 12, 0xe8c7b756);
OP (C, D, A, B, 17, 0x242070db);
OP (B, C, D, A, 22, 0xc1bdceee);
OP (A, B, C, D, 7, 0xf57c0faf);
OP (D, A, B, C, 12, 0x4787c62a);
OP (C, D, A, B, 17, 0xa8304613);
OP (B, C, D, A, 22, 0xfd469501);
OP (A, B, C, D, 7, 0x698098d8);
OP (D, A, B, C, 12, 0x8b44f7af);
OP (C, D, A, B, 17, 0xffff5bb1);
OP (B, C, D, A, 22, 0x895cd7be);
OP (A, B, C, D, 7, 0x6b901122);
OP (D, A, B, C, 12, 0xfd987193);
OP (C, D, A, B, 17, 0xa679438e);
OP (B, C, D, A, 22, 0x49b40821);
#undef OP
#define OP(f, a, b, c, d, k, s, T) \
do \
{ \
a += f (b, c, d) + correct_words[k] + T; \
a = rol(a, s); \
a += b; \
} \
while (0)
/* Round 2. */
OP (FG, A, B, C, D, 1, 5, 0xf61e2562);
OP (FG, D, A, B, C, 6, 9, 0xc040b340);
OP (FG, C, D, A, B, 11, 14, 0x265e5a51);
OP (FG, B, C, D, A, 0, 20, 0xe9b6c7aa);
OP (FG, A, B, C, D, 5, 5, 0xd62f105d);
OP (FG, D, A, B, C, 10, 9, 0x02441453);
OP (FG, C, D, A, B, 15, 14, 0xd8a1e681);
OP (FG, B, C, D, A, 4, 20, 0xe7d3fbc8);
OP (FG, A, B, C, D, 9, 5, 0x21e1cde6);
OP (FG, D, A, B, C, 14, 9, 0xc33707d6);
OP (FG, C, D, A, B, 3, 14, 0xf4d50d87);
OP (FG, B, C, D, A, 8, 20, 0x455a14ed);
OP (FG, A, B, C, D, 13, 5, 0xa9e3e905);
OP (FG, D, A, B, C, 2, 9, 0xfcefa3f8);
OP (FG, C, D, A, B, 7, 14, 0x676f02d9);
OP (FG, B, C, D, A, 12, 20, 0x8d2a4c8a);
/* Round 3. */
OP (FH, A, B, C, D, 5, 4, 0xfffa3942);
OP (FH, D, A, B, C, 8, 11, 0x8771f681);
OP (FH, C, D, A, B, 11, 16, 0x6d9d6122);
OP (FH, B, C, D, A, 14, 23, 0xfde5380c);
OP (FH, A, B, C, D, 1, 4, 0xa4beea44);
OP (FH, D, A, B, C, 4, 11, 0x4bdecfa9);
OP (FH, C, D, A, B, 7, 16, 0xf6bb4b60);
OP (FH, B, C, D, A, 10, 23, 0xbebfbc70);
OP (FH, A, B, C, D, 13, 4, 0x289b7ec6);
OP (FH, D, A, B, C, 0, 11, 0xeaa127fa);
OP (FH, C, D, A, B, 3, 16, 0xd4ef3085);
OP (FH, B, C, D, A, 6, 23, 0x04881d05);
OP (FH, A, B, C, D, 9, 4, 0xd9d4d039);
OP (FH, D, A, B, C, 12, 11, 0xe6db99e5);
OP (FH, C, D, A, B, 15, 16, 0x1fa27cf8);
OP (FH, B, C, D, A, 2, 23, 0xc4ac5665);
/* Round 4. */
OP (FI, A, B, C, D, 0, 6, 0xf4292244);
OP (FI, D, A, B, C, 7, 10, 0x432aff97);
OP (FI, C, D, A, B, 14, 15, 0xab9423a7);
OP (FI, B, C, D, A, 5, 21, 0xfc93a039);
OP (FI, A, B, C, D, 12, 6, 0x655b59c3);
OP (FI, D, A, B, C, 3, 10, 0x8f0ccc92);
OP (FI, C, D, A, B, 10, 15, 0xffeff47d);
OP (FI, B, C, D, A, 1, 21, 0x85845dd1);
OP (FI, A, B, C, D, 8, 6, 0x6fa87e4f);
OP (FI, D, A, B, C, 15, 10, 0xfe2ce6e0);
OP (FI, C, D, A, B, 6, 15, 0xa3014314);
OP (FI, B, C, D, A, 13, 21, 0x4e0811a1);
OP (FI, A, B, C, D, 4, 6, 0xf7537e82);
OP (FI, D, A, B, C, 11, 10, 0xbd3af235);
OP (FI, C, D, A, B, 2, 15, 0x2ad7d2bb);
OP (FI, B, C, D, A, 9, 21, 0xeb86d391);
/* Put checksum in context given as argument. */
ctx->A += A;
ctx->B += B;
ctx->C += C;
ctx->D += D;
}
/* The routine updates the message-digest context to
* account for the presence of each of the characters inBuf[0..inLen-1]
* in the message whose digest is being computed.
*/
void
md5_write( MD5_CONTEXT *hd, byte *inbuf, size_t inlen)
{
if( hd->count == 64 ) { /* flush the buffer */
transform( hd, hd->buf );
burn_stack (80+6*sizeof(void*));
hd->count = 0;
hd->nblocks++;
}
if( !inbuf )
return;
if( hd->count ) {
for( ; inlen && hd->count < 64; inlen-- )
hd->buf[hd->count++] = *inbuf++;
md5_write( hd, NULL, 0 );
if( !inlen )
return;
}
while( inlen >= 64 ) {
transform( hd, inbuf );
hd->count = 0;
hd->nblocks++;
inlen -= 64;
inbuf += 64;
}
burn_stack (80+6*sizeof(void*));
for( ; inlen && hd->count < 64; inlen-- )
hd->buf[hd->count++] = *inbuf++;
}
/* The routine final terminates the message-digest computation and
* ends with the desired message digest in mdContext->digest[0...15].
* The handle is prepared for a new MD5 cycle.
* Returns 16 bytes representing the digest.
*/
void
md5_final( MD5_CONTEXT *hd )
{
u32 t, msb, lsb;
byte *p;
md5_write(hd, NULL, 0); /* flush */;
t = hd->nblocks;
/* multiply by 64 to make a byte count */
lsb = t << 6;
msb = t >> 26;
/* add the count */
t = lsb;
if( (lsb += hd->count) < t )
msb++;
/* multiply by 8 to make a bit count */
t = lsb;
lsb <<= 3;
msb <<= 3;
msb |= t >> 29;
if( hd->count < 56 ) { /* enough room */
hd->buf[hd->count++] = 0x80; /* pad */
while( hd->count < 56 )
hd->buf[hd->count++] = 0; /* pad */
}
else { /* need one extra block */
hd->buf[hd->count++] = 0x80; /* pad character */
while( hd->count < 64 )
hd->buf[hd->count++] = 0;
md5_write(hd, NULL, 0); /* flush */;
memset(hd->buf, 0, 56 ); /* fill next block with zeroes */
}
/* append the 64 bit count */
hd->buf[56] = lsb ;
hd->buf[57] = lsb >> 8;
hd->buf[58] = lsb >> 16;
hd->buf[59] = lsb >> 24;
hd->buf[60] = msb ;
hd->buf[61] = msb >> 8;
hd->buf[62] = msb >> 16;
hd->buf[63] = msb >> 24;
transform( hd, hd->buf );
burn_stack (80+6*sizeof(void*));
p = hd->buf;
#ifdef BIG_ENDIAN_HOST
#define X(a) do { *p++ = hd-> a ; *p++ = hd-> a >> 8; \
*p++ = hd-> a >> 16; *p++ = hd-> a >> 24; } while(0)
#else /* little endian */
#define X(a) do { *(u32*)p = hd-> a ; p += 4; } while(0)
#endif
X(A);
X(B);
X(C);
X(D);
#undef X
}
static byte *
md5_read( MD5_CONTEXT *hd )
{
return hd->buf;
}

View File

@ -1,40 +0,0 @@
/* MD5.H - header file for MD5C.C
*/
/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
rights reserved.
License to copy and use this software is granted provided that it
is identified as the "RSA Data Security, Inc. MD5 Message-Digest
Algorithm" in all material mentioning or referencing this software
or this function.
License is also granted to make and use derivative works provided
that such works are identified as "derived from the RSA Data
Security, Inc. MD5 Message-Digest Algorithm" in all material
mentioning or referencing the derived work.
RSA Data Security, Inc. makes no representations concerning either
the merchantability of this software or the suitability of this
software for any particular purpose. It is provided "as is"
without express or implied warranty of any kind.
These notices must be retained in any copies of any part of this
documentation and/or software.
*/
/* MD5 context. */
#include "types.h"
typedef struct {
u32 A,B,C,D; /* chaining variables */
u32 nblocks;
byte buf[64];
int count;
} MD5_CONTEXT;
void md5_init( MD5_CONTEXT *ctx );
void md5_write( MD5_CONTEXT *hd, byte *inbuf, size_t inlen);
void md5_final( MD5_CONTEXT *hd );

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,140 +0,0 @@
/* types.h - some common typedefs
* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
*
* This file is part of GNUPG.
*
* GNUPG is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* GNUPG is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifndef G10_TYPES_H
#define G10_TYPES_H
#ifdef HAVE_INTTYPES_H
/* For uint64_t */
#include <inttypes.h>
#endif
/* The AC_CHECK_SIZEOF() in configure fails for some machines.
* we provide some fallback values here */
#if !SIZEOF_UNSIGNED_SHORT
#undef SIZEOF_UNSIGNED_SHORT
#define SIZEOF_UNSIGNED_SHORT 2
#endif
#if !SIZEOF_UNSIGNED_INT
#undef SIZEOF_UNSIGNED_INT
#define SIZEOF_UNSIGNED_INT 4
#endif
#if !SIZEOF_UNSIGNED_LONG
#undef SIZEOF_UNSIGNED_LONG
#define SIZEOF_UNSIGNED_LONG 4
#endif
#include <sys/types.h>
#ifndef HAVE_BYTE_TYPEDEF
#undef byte /* maybe there is a macro with this name */
#ifndef __riscos__
typedef unsigned char byte;
#else
/* Norcroft treats char = unsigned char as legal assignment
but char* = unsigned char* as illegal assignment
and the same applies to the signed variants as well */
typedef char byte;
#endif
#define HAVE_BYTE_TYPEDEF
#endif
#ifndef HAVE_USHORT_TYPEDEF
#undef ushort /* maybe there is a macro with this name */
typedef unsigned short ushort;
#define HAVE_USHORT_TYPEDEF
#endif
#ifndef HAVE_ULONG_TYPEDEF
#undef ulong /* maybe there is a macro with this name */
typedef unsigned long ulong;
#define HAVE_ULONG_TYPEDEF
#endif
#ifndef HAVE_U16_TYPEDEF
#undef u16 /* maybe there is a macro with this name */
#if SIZEOF_UNSIGNED_INT == 2
typedef unsigned int u16;
#elif SIZEOF_UNSIGNED_SHORT == 2
typedef unsigned short u16;
#else
#error no typedef for u16
#endif
#define HAVE_U16_TYPEDEF
#endif
#ifndef HAVE_U32_TYPEDEF
#undef u32 /* maybe there is a macro with this name */
#if SIZEOF_UNSIGNED_INT == 4
typedef unsigned int u32;
#elif SIZEOF_UNSIGNED_LONG == 4
typedef unsigned long u32;
#else
#error no typedef for u32
#endif
#define HAVE_U32_TYPEDEF
#endif
/****************
* Warning: Some systems segfault when this u64 typedef and
* the dummy code in cipher/md.c is not available. Examples are
* Solaris and IRIX.
*/
#ifndef HAVE_U64_TYPEDEF
#undef u64 /* maybe there is a macro with this name */
#if SIZEOF_UINT64_T == 8
typedef uint64_t u64;
#define U64_C(c) (UINT64_C(c))
#define HAVE_U64_TYPEDEF
#elif SIZEOF_UNSIGNED_INT == 8
typedef unsigned int u64;
#define U64_C(c) (c ## U)
#define HAVE_U64_TYPEDEF
#elif SIZEOF_UNSIGNED_LONG == 8
typedef unsigned long u64;
#define U64_C(c) (c ## UL)
#define HAVE_U64_TYPEDEF
#elif SIZEOF_UNSIGNED_LONG_LONG == 8
typedef unsigned long long u64;
#define U64_C(c) (c ## ULL)
#define HAVE_U64_TYPEDEF
#endif
#endif
typedef union {
int a;
short b;
char c[1];
long d;
#ifdef HAVE_U64_TYPEDEF
u64 e;
#endif
float f;
double g;
} PROPERLY_ALIGNED_TYPE;
typedef struct string_list {
struct string_list *next;
unsigned int flags;
char d[1];
} *STRLIST;
#endif /*G10_TYPES_H*/

File diff suppressed because it is too large Load Diff

View File

@ -1,29 +0,0 @@
man_MANS = geoipupdate.1 geoiplookup6.1 geoiplookup.1
EXTRA_DIST = geoiplookup6.1.in geoiplookup.1.in geoipupdate.1.in
edit = sed \
-e 's|DATADIR|$(pkgdatadir)|g' \
-e 's|CONF_DIR|$(sysconfdir)|g'
geoipupdate.1 geoiplookup.1 geoiplookup6.1: Makefile
rm -f $@ $@.tmp
$(edit) '$(srcdir)/$@.in' >$@.tmp
mv $@.tmp $@
geoipupdate.1: geoipupdate.1.in
geoiplookup.1: geoiplookup.1.in
geoiplookup6.1: geoiplookup6.1.in
CLEANFILES = geoiplookup6.1 geoipupdate.1 geoiplookup.1
UPDATE_MAN = $(mandir)/man1/geoipupdate.1
LOOKUP_MAN = $(mandir)/man1/geoiplookup.1
LOOKUP6_MAN = $(mandir)/man1/geoiplookup6.1
install-data-hook:
cat geoipupdate.1 | sed s,DATADIR,$(pkgdatadir), | sed s,CONF_DIR,$(sysconfdir), > $(DESTDIR)$(UPDATE_MAN)
cat geoiplookup.1 | sed s,DATADIR,$(pkgdatadir), > $(DESTDIR)$(LOOKUP_MAN)
cat geoiplookup6.1 | sed s,DATADIR,$(pkgdatadir), > $(DESTDIR)$(LOOKUP6_MAN)

View File

@ -1,455 +0,0 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = man
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
man1dir = $(mandir)/man1
am__installdirs = "$(DESTDIR)$(man1dir)"
NROFF = nroff
MANS = $(man_MANS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GEOIP_VERSION_INFO = @GEOIP_VERSION_INFO@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
man_MANS = geoipupdate.1 geoiplookup6.1 geoiplookup.1
EXTRA_DIST = geoiplookup6.1.in geoiplookup.1.in geoipupdate.1.in
edit = sed \
-e 's|DATADIR|$(pkgdatadir)|g' \
-e 's|CONF_DIR|$(sysconfdir)|g'
CLEANFILES = geoiplookup6.1 geoipupdate.1 geoiplookup.1
UPDATE_MAN = $(mandir)/man1/geoipupdate.1
LOOKUP_MAN = $(mandir)/man1/geoiplookup.1
LOOKUP6_MAN = $(mandir)/man1/geoiplookup6.1
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu man/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu man/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
install-man1: $(man_MANS)
@$(NORMAL_INSTALL)
test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)"
@list=''; test -n "$(man1dir)" || exit 0; \
{ for i in $$list; do echo "$$i"; done; \
l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
sed -n '/\.1[a-z]*$$/p'; \
} | while read p; do \
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; echo "$$p"; \
done | \
sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
sed 'N;N;s,\n, ,g' | { \
list=; while read file base inst; do \
if test "$$base" = "$$inst"; then list="$$list $$file"; else \
echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
$(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \
fi; \
done; \
for i in $$list; do echo "$$i"; done | $(am__base_list) | \
while read files; do \
test -z "$$files" || { \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \
done; }
uninstall-man1:
@$(NORMAL_UNINSTALL)
@list=''; test -n "$(man1dir)" || exit 0; \
files=`{ for i in $$list; do echo "$$i"; done; \
l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
sed -n '/\.1[a-z]*$$/p'; \
} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
test -z "$$files" || { \
echo " ( cd '$(DESTDIR)$(man1dir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(man1dir)" && rm -f $$files; }
tags: TAGS
TAGS:
ctags: CTAGS
CTAGS:
distdir: $(DISTFILES)
@list='$(MANS)'; if test -n "$$list"; then \
list=`for p in $$list; do \
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \
if test -n "$$list" && \
grep 'ab help2man is required to generate this page' $$list >/dev/null; then \
echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \
grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \
echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \
echo " typically \`make maintainer-clean' will remove them" >&2; \
exit 1; \
else :; fi; \
else :; fi
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(MANS)
installdirs:
for dir in "$(DESTDIR)$(man1dir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am: install-man
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) install-data-hook
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man: install-man1
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-man
uninstall-man: uninstall-man1
.MAKE: install-am install-data-am install-strip
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
distclean distclean-generic distclean-libtool distdir dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-data-hook install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-man1 install-pdf install-pdf-am install-ps \
install-ps-am install-strip installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
ps ps-am uninstall uninstall-am uninstall-man uninstall-man1
geoipupdate.1 geoiplookup.1 geoiplookup6.1: Makefile
rm -f $@ $@.tmp
$(edit) '$(srcdir)/$@.in' >$@.tmp
mv $@.tmp $@
geoipupdate.1: geoipupdate.1.in
geoiplookup.1: geoiplookup.1.in
geoiplookup6.1: geoiplookup6.1.in
install-data-hook:
cat geoipupdate.1 | sed s,DATADIR,$(pkgdatadir), | sed s,CONF_DIR,$(sysconfdir), > $(DESTDIR)$(UPDATE_MAN)
cat geoiplookup.1 | sed s,DATADIR,$(pkgdatadir), > $(DESTDIR)$(LOOKUP_MAN)
cat geoiplookup6.1 | sed s,DATADIR,$(pkgdatadir), > $(DESTDIR)$(LOOKUP6_MAN)
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -1,37 +0,0 @@
.TH GEOIPLOOKUP 1 "2 Jan 2007"
.UC 4
.SH NAME
geoiplookup \- look up country using IP Address or hostname
.SH SYNOPSIS
geoiplookup [\-d directory] [\-f filename] [\-v] <ipaddress|hostname>
.SH DESCRIPTION
geoiplookup uses the GeoIP library and database to find the Country
that an IP address or hostname originates from.
.PP
For example
.PP
.I geoiplookup 80.60.233.195
.PP
will find the Country that 80.60.233.195 originates from, in the following format:
.PP
.I NL, Netherlands
.PP
.SH OPTIONS
.IP "\-f"
Specify a custom path to a single GeoIP datafile.
.IP "\-d"
Specify a custom directory containing GeoIP datafile(s). By default geoiplookup looks in DATADIR
.IP "\-v"
Lists the date and build number for the GeoIP datafile(s).
.SH AUTHOR
Written by T.J. Mather
.SH "REPORTING BUGS"
Report bugs to <support@maxmind.com>
.SH COPYRIGHT
Copyright © 2006 MaxMind LLC
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE.
.SH "SEE ALSO"
geoipupdate(1), nslookup(1).

View File

@ -1,42 +0,0 @@
.TH GEOIPLOOKUP6 1 "28 Oct 2008"
.UC 4
.SH NAME
geouplookup6 \- look up country using IP Address or hostname
.SH SYNOPSIS
geouplookup6 [\-d directory] [\-f filename] [\-v] <ipaddress|hostname>
.SH DESCRIPTION
geouplookup6 uses the GeoIP library and database to find the Country
that an IP address or hostname originates from. You must install a database suitable for geoiplookup6. IE: GeoIPv6.dat
.PP
For example:
.PP
.I geouplookup6 2001:4860:0:1001::68
.PP
.I geoiplookup6 ipv6.google.com
.PP
will find the Country that 2001:4860:0:1001::68 originates from, in the following format:
.PP
.I US, United States
.PP
.PP Please notice, that names must resolve to a ipv6 address. For example
.PP geoiplookup6 www.maxmind.com does not work, since there is no ipv6
.PP DNS entry
.SH OPTIONS
.IP "\-f"
Specify a custom path to a single GeoIP datafile.
.IP "\-d"
Specify a custom directory containing GeoIP datafile(s). By default geouplookup6 looks in DATADIR
.IP "\-v"
Lists the date and build number for the GeoIP datafile(s).
.SH AUTHOR
Written by T.J. Mather
.SH "REPORTING BUGS"
Report bugs to <support@maxmind.com>
.SH COPYRIGHT
Copyright © 2008 MaxMind LLC
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE.
.SH "SEE ALSO"
geoipupdate(1), nslookup(1).

View File

@ -1,68 +0,0 @@
.TH GEOIPUPDATE 1 "5 Oct 2010"
.UC 4
.SH NAME
geoipupdate \- a program for updating the MaxMind GeoIP databases
.SH SYNOPSIS
geoipupdate [\-v] [\-f licensefile]
.SH DESCRIPTION
geoipupdate automatically updates the GeoIP database for GeoIP
subscribers. It connects to the MaxMind GeoIP Update server
and checks for an updated database. If it finds an updated
database, then it downloads it, uncompresses it, and installs it.
If you are running a firewall, it requires that the DNS and
HTTP (80) ports be open.
.PP
For example
.PP
.I geoipupdate \-v
.PP
Performs the update in verbose mode.
.PP
.SH OPTIONS
.IP "\-v"
Verbose mode, prints out the steps that geoipupdate takes.
.IP "\-d"
Specify a custom directory target to install the GeoIP datafile(s). By default geoipupdate installs to DATADIR
.IP "\-f"
Specifies the configuration file that contains the license key.
Defaults to CONF_DIR/GeoIP.conf
.SH USAGE
Typically you'll want to write a weekly crontab that will run geoipupdate.
Below is a sample crontab that runs geoipupdate on each Wednesday at noon:
.PP
.RS
# top of crontab
.PP
MAILTO=your@email.com
.PP
0 12 * * 3 BIN_DIR/geoipupdate
.PP
# end of crontab
.RE
To use with a proxy server, set the http_proxy environment variable.
E.g.
.RS
export http_proxy="http://proxy-hostname:port"
.RE
.SH RETURN CODES
geoipupdate returns 0 on success, 1 on error.
.SH FILES
.PP
.I CONF_DIR/GeoIP.conf
.PP
Configuration file for GeoIP, should contain license key.
.SH AUTHOR
Written by T.J. Mather
.SH "REPORTING BUGS"
Report bugs to <support@maxmind.com>
.SH COPYRIGHT
Copyright © 2011 MaxMind LLC
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE.
.SH "SEE ALSO"
Visit <http://www.maxmind.com/app/products> to
sign up for a GeoIP subscription.
.PP
geoiplookup(1), crontab(5)

View File

@ -1,376 +0,0 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
scriptversion=2009-04-28.21; # UTC
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
# 2008, 2009 Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
fi
run=:
sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
# In the cases where this matters, `missing' is being run in the
# srcdir already.
if test -f configure.ac; then
configure_ac=configure.ac
else
configure_ac=configure.in
fi
msg="missing on your system"
case $1 in
--run)
# Try to run requested program, and just exit if it succeeds.
run=
shift
"$@" && exit 0
# Exit code 63 means version mismatch. This often happens
# when the user try to use an ancient version of a tool on
# a file that requires a minimum version. In this case we
# we should proceed has if the program had been absent, or
# if --run hadn't been passed.
if test $? = 63; then
run=:
msg="probably too old"
fi
;;
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
error status if there is no known handling for PROGRAM.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
--run try to run the given command, and emulate it if it fails
Supported PROGRAM values:
aclocal touch file \`aclocal.m4'
autoconf touch file \`configure'
autoheader touch file \`config.h.in'
autom4te touch the output file, or create a stub one
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
help2man touch the output file
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
tar try tar, gnutar, gtar, then tar without non-portable flags
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
\`g' are ignored when checking the name.
Send bug reports to <bug-automake@gnu.org>."
exit $?
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing $scriptversion (GNU Automake)"
exit $?
;;
-*)
echo 1>&2 "$0: Unknown \`$1' option"
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
;;
esac
# normalize program name to check for.
program=`echo "$1" | sed '
s/^gnu-//; t
s/^gnu//; t
s/^g//; t'`
# Now exit if we have it, but it failed. Also exit now if we
# don't have it and --version was passed (most likely to detect
# the program). This is about non-GNU programs, so use $1 not
# $program.
case $1 in
lex*|yacc*)
# Not GNU programs, they don't have --version.
;;
tar*)
if test -n "$run"; then
echo 1>&2 "ERROR: \`tar' requires --run"
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
exit 1
fi
;;
*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
# Could not run --version or --help. This is probably someone
# running `$TOOL --version' or `$TOOL --help' to check whether
# $TOOL exists and not knowing $TOOL uses missing.
exit 1
fi
;;
esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
case $program in
aclocal*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site."
touch aclocal.m4
;;
autoconf*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`${configure_ac}'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site."
touch configure
;;
autoheader*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acconfig.h' or \`${configure_ac}'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site."
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
case $f in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
esac
done
touch $touch_files
;;
automake*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site."
find . -type f -name Makefile.am -print |
sed 's/\.am$/.in/' |
while read f; do touch "$f"; done
;;
autom4te*)
echo 1>&2 "\
WARNING: \`$1' is needed, but is $msg.
You might have modified some files without having the
proper tools for further handling them.
You can get \`$1' as part of \`Autoconf' from any GNU
archive site."
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo "#! /bin/sh"
echo "# Created by GNU Automake missing as a replacement of"
echo "# $ $@"
echo "exit 0"
chmod +x $file
exit 1
fi
;;
bison*|yacc*)
echo 1>&2 "\
WARNING: \`$1' $msg. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
if test $# -ne 1; then
eval LASTARG="\${$#}"
case $LASTARG in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
if test ! -f y.tab.h; then
echo >y.tab.h
fi
if test ! -f y.tab.c; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
lex*|flex*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
if test $# -ne 1; then
eval LASTARG="\${$#}"
case $LASTARG in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
if test ! -f lex.yy.c; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
help2man*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a dependency of a manual page. You may need the
\`Help2man' package in order for those modifications to take
effect. You can get \`Help2man' from any GNU archive site."
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo ".ab help2man is required to generate this page"
exit $?
fi
;;
makeinfo*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy \`make' (AIX,
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
# The file to touch is that specified with -o ...
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -z "$file"; then
# ... or it is the one specified with @setfilename ...
infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
file=`sed -n '
/^@setfilename/{
s/.* \([^ ]*\) *$/\1/
p
q
}' $infile`
# ... or it is derived from the source name (dir/f.texi becomes f.info)
test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
fi
# If the file does not exist, the user really needs makeinfo;
# let's fail without touching anything.
test -f $file || exit 1
touch $file
;;
tar*)
shift
# We have already tried tar in the generic part.
# Look for gnutar/gtar before invocation to avoid ugly error
# messages.
if (gnutar --version > /dev/null 2>&1); then
gnutar "$@" && exit 0
fi
if (gtar --version > /dev/null 2>&1); then
gtar "$@" && exit 0
fi
firstarg="$1"
if shift; then
case $firstarg in
*o*)
firstarg=`echo "$firstarg" | sed s/o//`
tar "$firstarg" "$@" && exit 0
;;
esac
case $firstarg in
*h*)
firstarg=`echo "$firstarg" | sed s/h//`
tar "$firstarg" "$@" && exit 0
;;
esac
fi
echo 1>&2 "\
WARNING: I can't seem to be able to run \`tar' with the given arguments.
You may want to install GNU tar or Free paxutils, or check the
command line arguments."
exit 1
;;
*)
echo 1>&2 "\
WARNING: \`$1' is needed, and is $msg.
You might have modified some files without having the
proper tools for further handling them. Check the \`README' file,
it often tells you about the needed prerequisites for installing
this package. You may also peek at any GNU archive site, in case
some other package would contain this missing \`$1' program."
exit 1
;;
esac
exit 0
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

View File

@ -1,37 +0,0 @@
INCLUDES = \
-I$(top_srcdir)/libGeoIP \
-Wall
check_PROGRAMS = test-geoip
noinst_PROGRAMS = benchmark test-geoip-region test-geoip-city test-geoip-org test-geoip-asnum test-geoip-isp test-geoip-netspeed
EXTRA_PROGRAMS = benchmark \
test-geoip-region \
test-geoip-city \
test-geoip-org \
test-geoip-asnum \
test-geoip-isp \
test-geoip-netspeed
LDADD = $(top_builddir)/libGeoIP/libGeoIP.la
AM_CPPFLAGS = -DSRCDIR=\"$(top_srcdir)\"
test_geoip_SOURCES = test-geoip.c
test_geoip_region_SOURCES = test-geoip-region.c
test_geoip_org_SOURCES = test-geoip-org.c
test_geoip_isp_SOURCES = test-geoip-isp.c
test_geoip_asnum_SOURCES = test-geoip-asnum.c
test_geoip_netspeed_SOURCES = test-geoip-netspeed.c
test_geoip_city_SOURCES = test-geoip-city.c
benchmark_SOURCES = benchmark.c
EXTRA_DIST = Makefile.vc city_test.txt country_test.txt country_test2.txt country_test_name.txt region_test.txt
TESTS = test-geoip

View File

@ -1,657 +0,0 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
check_PROGRAMS = test-geoip$(EXEEXT)
noinst_PROGRAMS = benchmark$(EXEEXT) test-geoip-region$(EXEEXT) \
test-geoip-city$(EXEEXT) test-geoip-org$(EXEEXT) \
test-geoip-asnum$(EXEEXT) test-geoip-isp$(EXEEXT) \
test-geoip-netspeed$(EXEEXT)
EXTRA_PROGRAMS = benchmark$(EXEEXT) test-geoip-region$(EXEEXT) \
test-geoip-city$(EXEEXT) test-geoip-org$(EXEEXT) \
test-geoip-asnum$(EXEEXT) test-geoip-isp$(EXEEXT) \
test-geoip-netspeed$(EXEEXT)
TESTS = test-geoip$(EXEEXT)
subdir = test
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
PROGRAMS = $(noinst_PROGRAMS)
am_benchmark_OBJECTS = benchmark.$(OBJEXT)
benchmark_OBJECTS = $(am_benchmark_OBJECTS)
benchmark_LDADD = $(LDADD)
benchmark_DEPENDENCIES = $(top_builddir)/libGeoIP/libGeoIP.la
am_test_geoip_OBJECTS = test-geoip.$(OBJEXT)
test_geoip_OBJECTS = $(am_test_geoip_OBJECTS)
test_geoip_LDADD = $(LDADD)
test_geoip_DEPENDENCIES = $(top_builddir)/libGeoIP/libGeoIP.la
am_test_geoip_asnum_OBJECTS = test-geoip-asnum.$(OBJEXT)
test_geoip_asnum_OBJECTS = $(am_test_geoip_asnum_OBJECTS)
test_geoip_asnum_LDADD = $(LDADD)
test_geoip_asnum_DEPENDENCIES = $(top_builddir)/libGeoIP/libGeoIP.la
am_test_geoip_city_OBJECTS = test-geoip-city.$(OBJEXT)
test_geoip_city_OBJECTS = $(am_test_geoip_city_OBJECTS)
test_geoip_city_LDADD = $(LDADD)
test_geoip_city_DEPENDENCIES = $(top_builddir)/libGeoIP/libGeoIP.la
am_test_geoip_isp_OBJECTS = test-geoip-isp.$(OBJEXT)
test_geoip_isp_OBJECTS = $(am_test_geoip_isp_OBJECTS)
test_geoip_isp_LDADD = $(LDADD)
test_geoip_isp_DEPENDENCIES = $(top_builddir)/libGeoIP/libGeoIP.la
am_test_geoip_netspeed_OBJECTS = test-geoip-netspeed.$(OBJEXT)
test_geoip_netspeed_OBJECTS = $(am_test_geoip_netspeed_OBJECTS)
test_geoip_netspeed_LDADD = $(LDADD)
test_geoip_netspeed_DEPENDENCIES = \
$(top_builddir)/libGeoIP/libGeoIP.la
am_test_geoip_org_OBJECTS = test-geoip-org.$(OBJEXT)
test_geoip_org_OBJECTS = $(am_test_geoip_org_OBJECTS)
test_geoip_org_LDADD = $(LDADD)
test_geoip_org_DEPENDENCIES = $(top_builddir)/libGeoIP/libGeoIP.la
am_test_geoip_region_OBJECTS = test-geoip-region.$(OBJEXT)
test_geoip_region_OBJECTS = $(am_test_geoip_region_OBJECTS)
test_geoip_region_LDADD = $(LDADD)
test_geoip_region_DEPENDENCIES = $(top_builddir)/libGeoIP/libGeoIP.la
DEFAULT_INCLUDES = -I.@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
SOURCES = $(benchmark_SOURCES) $(test_geoip_SOURCES) \
$(test_geoip_asnum_SOURCES) $(test_geoip_city_SOURCES) \
$(test_geoip_isp_SOURCES) $(test_geoip_netspeed_SOURCES) \
$(test_geoip_org_SOURCES) $(test_geoip_region_SOURCES)
DIST_SOURCES = $(benchmark_SOURCES) $(test_geoip_SOURCES) \
$(test_geoip_asnum_SOURCES) $(test_geoip_city_SOURCES) \
$(test_geoip_isp_SOURCES) $(test_geoip_netspeed_SOURCES) \
$(test_geoip_org_SOURCES) $(test_geoip_region_SOURCES)
ETAGS = etags
CTAGS = ctags
am__tty_colors = \
red=; grn=; lgn=; blu=; std=
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GEOIP_VERSION_INFO = @GEOIP_VERSION_INFO@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
INCLUDES = \
-I$(top_srcdir)/libGeoIP \
-Wall
LDADD = $(top_builddir)/libGeoIP/libGeoIP.la
AM_CPPFLAGS = -DSRCDIR=\"$(top_srcdir)\"
test_geoip_SOURCES = test-geoip.c
test_geoip_region_SOURCES = test-geoip-region.c
test_geoip_org_SOURCES = test-geoip-org.c
test_geoip_isp_SOURCES = test-geoip-isp.c
test_geoip_asnum_SOURCES = test-geoip-asnum.c
test_geoip_netspeed_SOURCES = test-geoip-netspeed.c
test_geoip_city_SOURCES = test-geoip-city.c
benchmark_SOURCES = benchmark.c
EXTRA_DIST = Makefile.vc city_test.txt country_test.txt country_test2.txt country_test_name.txt region_test.txt
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu test/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu test/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
clean-checkPROGRAMS:
@list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
echo " rm -f" $$list; \
rm -f $$list || exit $$?; \
test -n "$(EXEEXT)" || exit 0; \
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
clean-noinstPROGRAMS:
@list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
echo " rm -f" $$list; \
rm -f $$list || exit $$?; \
test -n "$(EXEEXT)" || exit 0; \
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
benchmark$(EXEEXT): $(benchmark_OBJECTS) $(benchmark_DEPENDENCIES)
@rm -f benchmark$(EXEEXT)
$(LINK) $(benchmark_OBJECTS) $(benchmark_LDADD) $(LIBS)
test-geoip$(EXEEXT): $(test_geoip_OBJECTS) $(test_geoip_DEPENDENCIES)
@rm -f test-geoip$(EXEEXT)
$(LINK) $(test_geoip_OBJECTS) $(test_geoip_LDADD) $(LIBS)
test-geoip-asnum$(EXEEXT): $(test_geoip_asnum_OBJECTS) $(test_geoip_asnum_DEPENDENCIES)
@rm -f test-geoip-asnum$(EXEEXT)
$(LINK) $(test_geoip_asnum_OBJECTS) $(test_geoip_asnum_LDADD) $(LIBS)
test-geoip-city$(EXEEXT): $(test_geoip_city_OBJECTS) $(test_geoip_city_DEPENDENCIES)
@rm -f test-geoip-city$(EXEEXT)
$(LINK) $(test_geoip_city_OBJECTS) $(test_geoip_city_LDADD) $(LIBS)
test-geoip-isp$(EXEEXT): $(test_geoip_isp_OBJECTS) $(test_geoip_isp_DEPENDENCIES)
@rm -f test-geoip-isp$(EXEEXT)
$(LINK) $(test_geoip_isp_OBJECTS) $(test_geoip_isp_LDADD) $(LIBS)
test-geoip-netspeed$(EXEEXT): $(test_geoip_netspeed_OBJECTS) $(test_geoip_netspeed_DEPENDENCIES)
@rm -f test-geoip-netspeed$(EXEEXT)
$(LINK) $(test_geoip_netspeed_OBJECTS) $(test_geoip_netspeed_LDADD) $(LIBS)
test-geoip-org$(EXEEXT): $(test_geoip_org_OBJECTS) $(test_geoip_org_DEPENDENCIES)
@rm -f test-geoip-org$(EXEEXT)
$(LINK) $(test_geoip_org_OBJECTS) $(test_geoip_org_LDADD) $(LIBS)
test-geoip-region$(EXEEXT): $(test_geoip_region_OBJECTS) $(test_geoip_region_DEPENDENCIES)
@rm -f test-geoip-region$(EXEEXT)
$(LINK) $(test_geoip_region_OBJECTS) $(test_geoip_region_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/benchmark.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-geoip-asnum.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-geoip-city.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-geoip-isp.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-geoip-netspeed.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-geoip-org.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-geoip-region.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-geoip.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
check-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; skip=0; \
srcdir=$(srcdir); export srcdir; \
list=' $(TESTS) '; \
$(am__tty_colors); \
if test -n "$$list"; then \
for tst in $$list; do \
if test -f ./$$tst; then dir=./; \
elif test -f $$tst; then dir=; \
else dir="$(srcdir)/"; fi; \
if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
*[\ \ ]$$tst[\ \ ]*) \
xpass=`expr $$xpass + 1`; \
failed=`expr $$failed + 1`; \
col=$$red; res=XPASS; \
;; \
*) \
col=$$grn; res=PASS; \
;; \
esac; \
elif test $$? -ne 77; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
*[\ \ ]$$tst[\ \ ]*) \
xfail=`expr $$xfail + 1`; \
col=$$lgn; res=XFAIL; \
;; \
*) \
failed=`expr $$failed + 1`; \
col=$$red; res=FAIL; \
;; \
esac; \
else \
skip=`expr $$skip + 1`; \
col=$$blu; res=SKIP; \
fi; \
echo "$${col}$$res$${std}: $$tst"; \
done; \
if test "$$all" -eq 1; then \
tests="test"; \
All=""; \
else \
tests="tests"; \
All="All "; \
fi; \
if test "$$failed" -eq 0; then \
if test "$$xfail" -eq 0; then \
banner="$$All$$all $$tests passed"; \
else \
if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
fi; \
else \
if test "$$xpass" -eq 0; then \
banner="$$failed of $$all $$tests failed"; \
else \
if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \
fi; \
fi; \
dashes="$$banner"; \
skipped=""; \
if test "$$skip" -ne 0; then \
if test "$$skip" -eq 1; then \
skipped="($$skip test was not run)"; \
else \
skipped="($$skip tests were not run)"; \
fi; \
test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
dashes="$$skipped"; \
fi; \
report=""; \
if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
report="Please report to $(PACKAGE_BUGREPORT)"; \
test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
dashes="$$report"; \
fi; \
dashes=`echo "$$dashes" | sed s/./=/g`; \
if test "$$failed" -eq 0; then \
echo "$$grn$$dashes"; \
else \
echo "$$red$$dashes"; \
fi; \
echo "$$banner"; \
test -z "$$skipped" || echo "$$skipped"; \
test -z "$$report" || echo "$$report"; \
echo "$$dashes$$std"; \
test "$$failed" -eq 0; \
else :; fi
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
check: check-am
all-am: Makefile $(PROGRAMS)
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
clean-noinstPROGRAMS mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am:
.MAKE: check-am install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
clean-checkPROGRAMS clean-generic clean-libtool \
clean-noinstPROGRAMS ctags distclean distclean-compile \
distclean-generic distclean-libtool distclean-tags distdir dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
install-info install-info-am install-man install-pdf \
install-pdf-am install-ps install-ps-am install-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -1,29 +0,0 @@
#NMAKE makefile for Windows developers.
#Produces a static library (GeoIP.lib).
COMPILER=cl
LINK = link -nologo
CFLAGS=-DWIN32 -MD -nologo
GEOIPINC = -I..\libGeoIP
CC1 = $(COMPILER) $(CFLAGS) $(GEOIPINC)
GEOIPLIB = ..\libGeoIP\GeoIP.lib
EXTRA_LIBS= advapi32.lib wsock32.lib
AR=lib
TEST: benchmark.exe test-geoip.exe
benchmark.exe: benchmark.c
$(CC1) -c benchmark.c
$(LINK) benchmark.obj $(GEOIPLIB)
test-geoip.exe: test-geoip.c
$(CC1) -c test-geoip.c
$(LINK) test-geoip.obj $(GEOIPLIB)

View File

@ -1,135 +0,0 @@
#include <stdio.h>
#include <GeoIP.h>
#include <GeoIPCity.h>
#if !defined(_WIN32)
#include <sys/time.h>
#endif /* !defined(_WIN32) */
char *ipstring[4] = {"24.24.24.24","80.24.24.80",
"200.24.24.40","68.24.24.46"};
int numipstrings = 4;
#if !defined(_WIN32)
struct timeval timer_t1;
struct timeval timer_t2;
#else /* !defined(_WIN32) */
FILETIME timer_t1; /* 100 ns */
FILETIME timer_t2;
#endif /* !defined(_WIN32) */
#if !defined(_WIN32)
void timerstart() {
gettimeofday(&timer_t1,NULL);
}
double timerstop() {
int a1 = 0;
int a2 = 0;
double r = 0;
gettimeofday(&timer_t2,NULL);
a1 = timer_t2.tv_sec - timer_t1.tv_sec;
a2 = timer_t2.tv_usec - timer_t1.tv_usec;
if (a1 < 0) {
a1 = a1 - 1;
a2 = a2 + 1000000;
}
r = (((double) a1) + (((double) a2) / 1000000));
return r;
}
#else /* !defined(_WIN32) */
void timerstart() {
GetSystemTimeAsFileTime(&timer_t1);
}
double timerstop() {
__int64 delta; /* VC6 can't convert an unsigned int64 to to double */
GetSystemTimeAsFileTime(&timer_t2);
delta = FILETIME_TO_USEC(timer_t2) - FILETIME_TO_USEC(timer_t2);
return delta;
}
#endif /* !defined(_WIN32) */
void testgeoipcountry(int flags,const char *msg,int numlookups) {
const char *str = NULL;
double t = 0;
int i4 = 0;
int i2 = 0;
GeoIP *i = NULL;
i = GeoIP_open("/usr/local/share/GeoIP/GeoIP.dat",flags);
if (i == NULL) {
printf("error: GeoIP.dat does not exist\n");
return;
}
timerstart();
for (i2 = 0;i2 < numlookups;i2++) {
str = GeoIP_country_name_by_addr(i,ipstring[i4]);
i4 = (i4 + 1) % numipstrings;
}
t = timerstop();
printf("%s\n", msg);
printf("%d lookups made in %f seconds \n",numlookups,t);
GeoIP_delete(i);
}
void testgeoipregion(int flags,const char *msg,int numlookups) {
GeoIP *i = NULL;
GeoIPRegion *i3 = NULL;
int i4 = 0;
int i2 = 0;
double t = 0;
i = GeoIP_open("/usr/local/share/GeoIP/GeoIPRegion.dat",flags);
if (i == NULL) {
printf("error: GeoIPRegion.dat does not exist\n");
return;
}
timerstart();
for (i2 = 0;i2 < numlookups;i2++) {
i3 = GeoIP_region_by_addr(i,ipstring[i4]);
GeoIPRegion_delete(i3);
i4 = (i4 + 1) % numipstrings;
}
t = timerstop();
printf("%s\n", msg);
printf("%d lookups made in %f seconds \n",numlookups,t);
GeoIP_delete(i);
}
void testgeoipcity(int flags,const char *msg,int numlookups) {
GeoIP *i = NULL;
GeoIPRecord * i3 = NULL;
int i4 = 0;
int i2 = 0;
double t = 0;
i = GeoIP_open("/usr/local/share/GeoIP/GeoIPCity.dat",flags);
if (i == NULL) {
printf("error: GeoLiteCity.dat does not exist\n");
return;
}
timerstart();
for (i2 = 0;i2 < numlookups;i2++) {
i3 = GeoIP_record_by_addr(i,ipstring[i4]);
GeoIPRecord_delete(i3);
i4 = (i4 + 1) % numipstrings;
}
t = timerstop();
printf("%s\n", msg);
printf("%d lookups made in %f seconds \n",numlookups,t);
GeoIP_delete(i);
}
int main(){
int time = 300*numipstrings;
testgeoipcountry(0,"GeoIP Country",100*time);
testgeoipcountry(GEOIP_CHECK_CACHE,"GeoIP Country with GEOIP_CHECK_CACHE",100*time);
testgeoipcountry(GEOIP_MEMORY_CACHE,"GeoIP Country with GEOIP_MEMORY_CACHE",1000*time);
testgeoipcountry(GEOIP_MEMORY_CACHE | GEOIP_CHECK_CACHE,"GeoIP Country with GEOIP_MEMORY_CACHE and GEOIP_CHECK_CACHE",1000*time);
testgeoipregion(0,"GeoIP Region",100*time);
testgeoipregion(GEOIP_CHECK_CACHE,"GeoIP Region with GEOIP_CHECK_CACHE",100*time);
testgeoipregion(GEOIP_MEMORY_CACHE,"GeoIP Region with GEOIP_MEMORY_CACHE",1000*time);
testgeoipregion(GEOIP_MEMORY_CACHE | GEOIP_CHECK_CACHE,"GeoIP Region with GEOIP_MEMORY_CACHE and GEOIP_CHECK_CACHE",1000*time);
testgeoipcity(0,"GeoIP City",50*time);
testgeoipcity(GEOIP_INDEX_CACHE,"GeoIP City with GEOIP_INDEX_CACHE",200*time);
testgeoipcity(GEOIP_INDEX_CACHE | GEOIP_CHECK_CACHE,"GeoIP City with GEOIP_INDEX_CACHE and GEOIP_CHECK_CACHE",200*time);
testgeoipcity(GEOIP_MEMORY_CACHE,"GeoIP City with GEOIP_MEMORY_CACHE",500*time);
return 0;
}

View File

@ -1,2 +0,0 @@
24.24.24.24 # Should return Ithaca, NY, US
80.24.24.24 # Should return Madrid, 29, ES

View File

@ -1,69 +0,0 @@
216.236.135.152 US USA
192.106.51.100 IT ITA
147.251.48.1 CZ CZE
203.174.65.12 JP JPN
212.208.74.140 FR FRA
200.219.192.106 BR BRA
134.102.101.18 DE DEU
193.75.148.28 BE BEL
194.244.83.2 IT ITA
203.15.106.23 AU AUS
196.31.1.1 ZA ZAF
151.28.39.114 IT ITA
151.38.70.94 IT ITA
193.56.4.124 FR FRA
195.142.146.198 TR TUR
211.232.0.0 KR KOR
211.240.0.0 KR KOR
193.194.4.0 MA MAR
139.20.112.104 DE DEU
139.20.112.3 DE DEU
145.236.125.211 HU HUN
149.225.169.61 DE DEU
151.17.191.46 IT ITA
151.24.176.194 IT ITA
151.25.8.136 IT ITA
151.26.146.192 IT ITA
151.26.153.66 IT ITA
151.26.167.71 IT ITA
151.26.35.204 IT ITA
151.26.64.157 IT ITA
151.27.138.182 IT ITA
151.28.39.114 IT ITA
151.29.150.217 IT ITA
151.29.237.39 IT ITA
151.29.73.189 IT ITA
151.30.134.242 IT ITA
151.30.135.85 IT ITA
151.30.168.224 IT ITA
151.35.80.202 IT ITA
151.35.80.240 IT ITA
151.36.191.229 IT ITA
151.38.70.94 IT ITA
151.38.92.126 IT ITA
151.42.100.132 IT ITA
151.42.169.71 IT ITA
193.56.4.124 FR FRA
195.142.146.198 TR TUR
195.142.49.205 TR TUR
202.247.74.18 JP JPN
202.247.74.71 JP JPN
202.247.74.81 JP JPN
202.247.74.88 JP JPN
203.242.239.188 KR KOR
203.174.65.12 JP JPN
212.208.74.140 FR FRA
200.219.192.106 BR BRA
202.53.254.193 ID IDN
12.168.0.0 US USA
12.169.0.0 US USA
12.200.0.0 US USA
203.121.0.8 MY MYS
203.20.231.1 AU AUS
203.87.98.29 AU AUS
203.181.121.150 JP JPN
202.166.127.246 SG SGP
62.188.202.242 GB GBR
12.12.197.23 US USA
12.12.199.3 US USA
12.12.200.79 US USA

View File

@ -1,29 +0,0 @@
212.118.5.94 JO
64.170.57.29 US
202.7.216.215 AU
212.33.164.149 SA
68.96.110.210 US
213.166.131.168 SA
64.158.191.179 US
24.247.251.23 US
203.199.228.66 IN
195.14.141.225 CY
200.52.94.98 MX
203.197.187.193 IN
203.128.9.170 PK
144.106.240.140 US
195.248.180.102 UA
213.1.0.118 GB
64.255.148.52 US
12.78.124.119 US
212.68.224.183 BE
62.148.73.85 PL
203.146.135.180 TH
209.204.179.145 US
64.123.0.164 US
202.56.198.16 IN
61.0.94.172 IN
62.42.171.190 ES
192.117.245.177 IL
213.123.75.243 GB
80.56.171.62 NL

View File

@ -1 +0,0 @@
yahoo.com US

View File

@ -1,24 +0,0 @@
216.236.135.152 US USA
24.24.24.24 US USA
147.251.48.1 CZ CZE
203.174.65.12 JP JPN
212.208.74.140 FR FRA
200.219.192.106 BR BRA
134.102.101.18 DE DEU
193.75.148.28 BE BEL
194.244.83.2 IT ITA
203.15.106.23 AU AUS
196.31.1.1 ZA ZAF
151.28.39.114 IT ITA
151.38.70.94 IT ITA
193.56.4.124 FR FRA
195.142.146.198 TR TUR
211.232.0.0 KR KOR
211.240.0.0 KR KOR
193.194.4.0 MA MAR
139.20.112.104 DE DEU
139.20.112.3 DE DEU
145.236.125.211 HU HUN
yahoo.com US USA
amazon.com US USA
www.uspto.gov US USA

View File

@ -1,63 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
/* test-geoip-asnum.c
*
* Copyright (C) 2006 MaxMind LLC
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "GeoIP.h"
static const char * _mk_NA( const char * p ){
return p ? p : "N/A";
}
int main (int argc, char* argv[]) {
FILE *f;
GeoIP * gi;
char * org;
int generate = 0;
char host[50];
if (argc == 2)
if (!strcmp(argv[1],"gen"))
generate = 1;
gi = GeoIP_open("../data/GeoIPASNum.dat", GEOIP_STANDARD);
if (gi == NULL) {
fprintf(stderr, "Error opening database\n");
exit(1);
}
f = fopen("asnum_test.txt","r");
if (f == NULL) {
fprintf(stderr, "Error opening asnum_test.txt\n");
exit(1);
}
while (fscanf(f, "%s", host) != EOF) {
org = GeoIP_org_by_name (gi, (const char *)host);
if (org != NULL) {
printf("%s\t%s\n", host, _mk_NA(org));
}
}
GeoIP_delete(gi);
return 0;
}

View File

@ -1,83 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
/* test-geoip-city.c
*
* Copyright (C) 2006 MaxMind LLC
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "GeoIP.h"
#include "GeoIPCity.h"
static const char * _mk_NA( const char * p ){
return p ? p : "N/A";
}
int
main(int argc, char *argv[])
{
FILE *f;
GeoIP *gi;
GeoIPRecord *gir;
int generate = 0;
char host[50];
const char *time_zone = NULL;
char **ret;
if (argc == 2)
if (!strcmp(argv[1], "gen"))
generate = 1;
gi = GeoIP_open("../data/GeoIPCity.dat", GEOIP_INDEX_CACHE);
if (gi == NULL) {
fprintf(stderr, "Error opening database\n");
exit(1);
}
f = fopen("city_test.txt", "r");
if (f == NULL) {
fprintf(stderr, "Error opening city_test.txt\n");
exit(1);
}
while (fscanf(f, "%s", host) != EOF) {
gir = GeoIP_record_by_name(gi, (const char *) host);
if (gir != NULL) {
ret = GeoIP_range_by_ip(gi, (const char *) host);
time_zone = GeoIP_time_zone_by_country_and_region(gir->country_code, gir->region);
printf("%s\t%s\t%s\t%s\t%s\t%s\t%f\t%f\t%d\t%d\t%s\t%s\t%s\n", host,
_mk_NA(gir->country_code),
_mk_NA(gir->region),
_mk_NA(GeoIP_region_name_by_code(gir->country_code, gir->region)),
_mk_NA(gir->city),
_mk_NA(gir->postal_code),
gir->latitude,
gir->longitude,
gir->metro_code,
gir->area_code,
_mk_NA(time_zone),
ret[0],
ret[1]);
GeoIP_range_by_ip_delete(ret);
GeoIPRecord_delete(gir);
}
}
GeoIP_delete(gi);
return 0;
}

View File

@ -1,65 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
/* test-geoip-isp.c
*
* Copyright (C) 2006 MaxMind LLC
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "GeoIP.h"
static const char * _mk_NA( const char * p ){
return p ? p : "N/A";
}
int main (int argc, char* argv[]) {
FILE *f;
GeoIP * gi;
char * org;
int generate = 0;
char host[50];
if (argc == 2)
if (!strcmp(argv[1],"gen"))
generate = 1;
gi = GeoIP_open("../data/GeoIPISP.dat", GEOIP_STANDARD);
if (gi == NULL) {
fprintf(stderr, "Error opening database\n");
exit(1);
}
f = fopen("isp_test.txt","r");
if (f == NULL) {
fprintf(stderr, "Error opening isp_test.txt\n");
exit(1);
}
while (fscanf(f, "%s", host) != EOF) {
org = GeoIP_org_by_name (gi, (const char *)host);
if (org != NULL) {
printf("%s\t%s\n", host, _mk_NA(org));
free(org);
}
}
fclose(f);
GeoIP_delete(gi);
return 0;
}

View File

@ -1,59 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
/* test-geoip-netspeed.c
*
* Copyright (C) 2006 MaxMind LLC
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "GeoIP.h"
int main (int argc, char* argv[]) {
FILE *f;
GeoIP * gi;
int netspeed;
char host[50];
gi = GeoIP_open("../data/GeoIPNetSpeed.dat", GEOIP_STANDARD);
if (gi == NULL) {
fprintf(stderr, "Error opening database\n");
exit(1);
}
f = fopen("netspeed_test.txt","r");
if (f == NULL) {
fprintf(stderr, "Error opening netspeed_test.txt\n");
exit(1);
}
while (fscanf(f, "%s", host) != EOF) {
netspeed = GeoIP_id_by_name (gi, (const char *)host);
if (netspeed == GEOIP_UNKNOWN_SPEED) {
printf("%s\tUnknown\n", host);
} else if (netspeed == GEOIP_DIALUP_SPEED) {
printf("%s\tDialup\n", host);
} else if (netspeed == GEOIP_CABLEDSL_SPEED) {
printf("%s\tCable/DSL\n", host);
} else if (netspeed == GEOIP_CORPORATE_SPEED) {
printf("%s\tCorporate\n", host);
}
}
fclose(f);
GeoIP_delete(gi);
return 0;
}

View File

@ -1,71 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
/* test-geoip-org.c
*
* Copyright (C) 2006 MaxMind LLC
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "GeoIP.h"
static const char * _mk_NA( const char * p ){
return p ? p : "N/A";
}
int
main(int argc, char *argv[])
{
FILE *f;
GeoIP *gi;
char *org;
int generate = 0;
char host[50];
char **ret;
if (argc == 2)
if (!strcmp(argv[1], "gen"))
generate = 1;
gi = GeoIP_open("../data/GeoIPOrg.dat", GEOIP_INDEX_CACHE);
if (gi == NULL) {
fprintf(stderr, "Error opening database\n");
exit(1);
}
f = fopen("org_test.txt", "r");
if (f == NULL) {
fprintf(stderr, "Error opening org_test.txt\n");
exit(1);
}
printf("IP\torganization\tnetmask\tbeginIp\tendIp\n");
while (fscanf(f, "%s", host) != EOF) {
org = GeoIP_name_by_name(gi, (const char *) host);
if (org != NULL) {
ret = GeoIP_range_by_ip(gi, (const char *) host);
printf("%s\t%s\t%d\t%s\t%s\n", host, _mk_NA(org), GeoIP_last_netmask(gi), ret[0], ret[1]);
GeoIP_range_by_ip_delete(ret);
free(org);
}
}
fclose(f);
GeoIP_delete(gi);
return 0;
}

View File

@ -1,114 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
/* test-geoip-region.c
*
* Copyright (C) 2006 MaxMind LLC
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <GeoIP.h>
#include <sys/types.h> /* For uint32_t */
#ifdef HAVE_STDINT_H
#include <stdint.h> /* For uint32_t */
#endif
#if !defined(_WIN32)
#include <netdb.h> /* For gethostbyname */
#include <netinet/in.h> /* For ntohl */
#else
#include <windows.h>
#include <winsock.h>
#endif
#include <assert.h>
unsigned long inetaddr(const char * name)
{
struct hostent * host;
struct in_addr inaddr;
host = gethostbyname(name); assert(host);
inaddr.s_addr = *((uint32_t*)host->h_addr_list[0]);
return inaddr.s_addr;
}
static const char * _mk_NA ( const char * p ){
return p ? p : "N/A";
}
int main () {
GeoIP * gi;
GeoIPRegion * gir, giRegion;
FILE *f;
char ipAddress[30];
char expectedCountry[3];
char expectedCountry3[4];
const char * time_zone;
gi = GeoIP_open("../data/GeoIPRegion.dat", GEOIP_MEMORY_CACHE);
if (gi == NULL) {
fprintf(stderr, "Error opening database\n");
exit(1);
}
f = fopen("region_test.txt","r");
if (f == NULL) {
fprintf(stderr, "Error opening region_test.txt\n");
exit(1);
}
gir = GeoIP_region_by_addr (gi, "10.0.0.0");
if (gir != NULL) {
printf("lookup of private IP address: country = %s, region = %s\n", gir->country_code, gir->region);
}
while (fscanf(f, "%s%s%s", ipAddress, expectedCountry, expectedCountry3 ) != EOF) {
printf("ip = %s\n",ipAddress);
gir = GeoIP_region_by_name (gi, ipAddress);
time_zone = GeoIP_time_zone_by_country_and_region(gir->country_code, gir->region);
if (gir != NULL) {
printf("%s, %s, %s, %s\n",
gir->country_code,
(!gir->region[0]) ? "N/A" : gir->region,
_mk_NA(GeoIP_region_name_by_code(gir->country_code, gir->region)),
_mk_NA(time_zone));
} else {
printf("NULL!\n");
}
GeoIP_assign_region_by_inetaddr (gi, inetaddr(ipAddress), &giRegion);
if (gir != NULL) {
assert(giRegion.country_code[0]);
assert(!strcmp(gir->country_code, giRegion.country_code));
if ( gir->region[0] ) {
assert(giRegion.region[0]);
assert(!strcmp(gir->region, giRegion.region));
} else {
assert(!giRegion.region[0]);
}
} else {
assert(!giRegion.country_code[0]);
}
if ( gir != NULL ) {
GeoIPRegion_delete(gir);
}
}
GeoIP_delete(gi);
return 0;
}

View File

@ -1,113 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
/* test-geoip.c
*
* Copyright (C) 2006 MaxMind LLC
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <GeoIP.h>
int main () {
FILE *f;
char ipAddress[30];
char expectedCountry[3];
char expectedCountry3[4];
const char * returnedCountry;
GeoIP * gi;
int failed = 0;
int test_num = 1;
int i;
for (i = 0; i < 2; ++i) {
if (0 == i) {
/* Read from filesystem, check for updated file */
gi = GeoIP_open(SRCDIR"/data/GeoIP.dat", GEOIP_STANDARD | GEOIP_CHECK_CACHE);
} else {
/* Read from memory, faster but takes up more memory */
gi = GeoIP_open(SRCDIR"/data/GeoIP.dat", GEOIP_MEMORY_CACHE);
}
if (gi == NULL) {
fprintf(stderr, "Error opening database\n");
exit(1);
}
/* make sure GeoIP deals with invalid query gracefully */
returnedCountry = GeoIP_country_code_by_addr(gi,NULL);
if (returnedCountry != NULL) {
fprintf(stderr,"Invalid Query test failed, got non NULL, expected NULL\n");
failed = 1;
}
returnedCountry = GeoIP_country_code_by_name(gi,NULL);
if (returnedCountry != NULL) {
fprintf(stderr,"Invalid Query test failed, got non NULL, expected NULL\n");
failed = 1;
}
f = fopen(SRCDIR"/test/country_test.txt","r");
while (fscanf(f, "%s%s%s", ipAddress, expectedCountry, expectedCountry3) != EOF) {
returnedCountry = GeoIP_country_code_by_addr(gi,ipAddress);
if (returnedCountry == NULL || strcmp(returnedCountry, expectedCountry) != 0) {
fprintf(stderr,"Test addr %d for %s failed, got %s, expected %s\n",test_num,ipAddress,returnedCountry,expectedCountry);
failed = 1;
}
returnedCountry = GeoIP_country_code_by_name(gi,ipAddress);
if (returnedCountry == NULL || strcmp(returnedCountry, expectedCountry) != 0) {
fprintf(stderr,"Test name %d for %s failed, got %s, expected %s\n",test_num,ipAddress,returnedCountry,expectedCountry);
failed = 1;
}
returnedCountry = GeoIP_country_code3_by_addr(gi,ipAddress);
if (returnedCountry == NULL || strcmp(returnedCountry, expectedCountry3) != 0) {
fprintf(stderr,"Test addr %d for %s failed, got %s, expected %s\n",test_num,ipAddress,returnedCountry,expectedCountry);
failed = 1;
}
returnedCountry = GeoIP_country_code3_by_name(gi,ipAddress);
if (returnedCountry == NULL || strcmp(returnedCountry, expectedCountry3) != 0) {
fprintf(stderr,"Test name %d for %s failed, got %s, expected %s\n",test_num,ipAddress,returnedCountry,expectedCountry);
failed = 1;
}
test_num++;
}
fclose(f);
f = fopen(SRCDIR"/test/country_test2.txt","r");
while (fscanf(f, "%s%s", ipAddress, expectedCountry ) != EOF) {
returnedCountry = GeoIP_country_code_by_addr(gi,ipAddress);
if (returnedCountry == NULL || strcmp(returnedCountry, expectedCountry) != 0) {
fprintf(stderr,"Test addr %d %s failed, got %s, expected %s\n",test_num,ipAddress,returnedCountry,expectedCountry);
failed = 1;
}
test_num++;
}
fclose(f);
f = fopen(SRCDIR"/test/country_test_name.txt","r");
while (fscanf(f, "%s%s", ipAddress, expectedCountry) != EOF) {
returnedCountry = GeoIP_country_code_by_name(gi,ipAddress);
if (returnedCountry == NULL || strcmp(returnedCountry, expectedCountry) != 0) {
fprintf(stderr,"Test addr %d %s failed, got %s, expected %s\n",test_num,ipAddress,returnedCountry,expectedCountry);
failed = 1;
}
test_num++;
}
fclose(f);
GeoIP_delete(gi);
}
return failed;
}

View File

@ -1,827 +0,0 @@
#include "ID3miniParsers.h"
#include "stl/stringUtils.h"
#include <locale>
using namespace ID3V2;
using namespace uniString;
using namespace std;
static const __uint8 E_LATIN1(0);
static const __uint8 E_UTF16(1); // with COM
static const __uint8 E_UTF16BE(2); // big endian no BOM
static const __uint8 E_UTF8(3); // utf8
void ID3V2::base64encode(const char *in,size_t siz,string &out) throw()
{
char alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
int shift = 0;
int accum = 0;
while (siz)
{
accum <<= 8;
shift += 8;
accum |= *in++;
siz--;
while ( shift >= 6 )
{
shift -= 6;
out.push_back(alphabet[(accum >> shift) & 0x3F]);
}
}
if (shift == 4)
{
out.push_back(alphabet[(accum & 0xF)<<2]);
out.push_back('=');
}
else if (shift == 2)
{
out.push_back(alphabet[(accum & 0x3)<<4]);
out.push_back('=');
out.push_back('=');
}
}
// way cool function. Given a hunk of data from an ID3V2 entry, break it into a collection
// of unicode strings based on a format string (sort of like sprintf for ID3V2 data)
vector<utf8> ID3V2::extractor(const vector<__uint8> &data,const char *format) throw(exception)
{
vector<utf8> result;
__uint8 encoding = E_LATIN1;
int bytesRemaining = (int)data.size();
vector<__uint8>::size_type offset = 0;
const char *f = format;
while((*f) && (bytesRemaining > 0))
{
switch(*f)
{
case ' ': break; // do nothing, just move to next
case 'e': // encoding
encoding = data[offset++];
--bytesRemaining;
break;
case 'c': // single digit code
{
__uint8 code = data[offset++];
--bytesRemaining;
result.push_back(stringUtil::tos((int)code));
}
break;
case 'y': // dynamic counter
{
__uint64 counter = 0;
while(bytesRemaining > 0)
{
counter = counter << 8;
counter += data[offset];
++offset;
--bytesRemaining;
}
result.push_back(stringUtil::tos(counter));
}
break;
case 'u': // non-encoding string
{
size_t slen = uniString::strlen(&(data[offset]),bytesRemaining);
utf32 u32;
u32.assignFromLatinExtended(&(data[offset]),slen);
offset += (slen+1);
bytesRemaining -= (slen+1);
result.push_back(u32.toUtf8());
}
break;
case 's': // encoding string
{
if (encoding == E_LATIN1)
{
size_t slen = uniString::strlen(&(data[offset]),bytesRemaining);
utf32 u32;
u32.assignFromLatinExtended(&(data[offset]),slen);
offset += (slen+1);
bytesRemaining -= (slen+1);
result.push_back(u32.toUtf8());
}
else if (encoding == E_UTF16)
{
const utf16::value_type *v16 = reinterpret_cast<const utf16::value_type*>(&(data[offset]));
size_t slen = uniString::strlen(v16,bytesRemaining / 2);
utf32 u32(v16,slen);
offset += ((slen * 2) + 2);
bytesRemaining -= ((slen * 2) + 2);
result.push_back(u32.toUtf8());
}
else if (encoding == E_UTF16BE)
{
const utf16::value_type *v16 = reinterpret_cast<const utf16::value_type*>(&(data[offset]));
size_t slen = uniString::strlen(v16,bytesRemaining / 2);
utf32 u32(v16,slen,false); // assume big endian
offset += ((slen * 2) + 2);
bytesRemaining -= ((slen * 2) + 2);
result.push_back(u32.toUtf8());
}
else if (encoding == E_UTF8)
{
size_t slen = uniString::strlen(&(data[offset]),bytesRemaining);
utf32 u32(&(data[offset]),slen);
offset += (slen+1);
bytesRemaining -= (slen+1);
result.push_back(u32.toUtf8());
}
else throw runtime_error("unknown encoding " + stringUtil::tos((int)encoding));
}
break;
case 'b': // binary data
{
string b64;
base64encode((const char *)&(data[offset]),bytesRemaining,b64);
result.push_back(b64);
offset += bytesRemaining;
bytesRemaining = 0;
}
break;
case 'l': // three char language code
{
if (bytesRemaining < 3) throw runtime_error("not enough data");
utf8 l;
bool bad =
(data[offset] < '0' || data[offset] > 'z' ||
data[offset+1] < '0' || data[offset+1] > 'z' ||
data[offset+2] < '0' || data[offset+2] > 'z');
l.push_back(data[offset++]); l.push_back(data[offset++]); l.push_back(data[offset++]);
bytesRemaining -= 3;
if (bad)
result.push_back(utf8());
else
result.push_back(l);
}
break;
case '+':
while(f > format && ((*f) == '+' || (*f) == ' ')) --f;
--f;
break;
}
++f;
}
while((!result.empty()) && (result.back().empty())) result.pop_back();
return result;
}
static const utf8 LT("<");
static const utf8 GT(">");
static const utf8 LTSLASH("</");
static const utf8 EMPTYSTRING;
static const utf8::value_type LPAREN('(');
static const utf8::value_type RPAREN(')');
// genres can be a list of codes and subgenres of high complexity. Parse it all out
// (see ID3V2 specification for genre tag)
//
// some examples
// (21)
// (42) Eurodisco
// (16) (18) Trance
void ID3V2::fromStringList(const vector<utf8> &slist,genreList_t &gl) throw(runtime_error)
{
gl.clear();
static const int state_Initial = 0;
static const int state_LeadingParen = 1;
static const int state_Code = 2;
static const int state_Subgenre = 3;
int state = state_Initial;
genreEntry e;
for(vector<utf8>::const_iterator li = slist.begin(); li != slist.end(); ++li)
{
for(utf8::const_iterator i = (*li).begin(); i != (*li).end(); ++i)
{
switch(state)
{
case state_Initial:
e.m_genreCode = EMPTYSTRING;
e.m_refinement = EMPTYSTRING;
if (stringUtil::safe_is_space(*i)) {}
else if ((*i) == LPAREN)
{
state = state_LeadingParen;
}
else
{
state = state_Subgenre;
e.m_refinement += (*i);
}
break;
case state_LeadingParen:
if ((*i) == LPAREN)
{
state = state_Subgenre;
e.m_refinement += (*i);
}
else if ((*i) == RPAREN)
{
if (!e.m_genreCode.empty() || !e.m_refinement.empty())
gl.push_back(e);
e.m_genreCode = EMPTYSTRING;
e.m_refinement = EMPTYSTRING;
state = state_Initial;
}
else
{
if (!e.m_genreCode.empty() || !e.m_refinement.empty())
gl.push_back(e);
e.m_genreCode = EMPTYSTRING;
e.m_refinement = EMPTYSTRING;
e.m_genreCode += (*i);
state = state_Code;
}
break;
case state_Code:
if ((*i) == RPAREN)
{
state = state_Subgenre;
}
else
{
e.m_genreCode += *i;
}
break;
case state_Subgenre:
if ((*i) == LPAREN)
{
state = state_LeadingParen;
}
else
{
e.m_refinement += (*i);
}
break;
default:
throw logic_error(string(__FUNCTION__) + " internal error. Bad state");
break;
}
}
switch(state)
{
case state_Initial:
break;
case state_LeadingParen:
throw runtime_error(string(__FUNCTION__) + " badly formed TCON data " + (*li).hideAsString());
break;
case state_Code:
throw runtime_error(string(__FUNCTION__) + " badly formed TCON data " + (*li).hideAsString());
break;
case state_Subgenre:
if (!e.m_genreCode.empty() || !e.m_refinement.empty())
gl.push_back(e);
break;
default:
throw logic_error(string(__FUNCTION__) + " internal error. Bad state");
break;
} // character iteration
} // end string list iteration
}
uniString::utf8 ID3V2::toXML(const utf8 &tag,const genreList_t &l) throw()
{
utf8 result;
utf8 endTag = utf8("</") + tag + utf8(">");
for(genreList_t::const_iterator i = l.begin(); i != l.end(); ++i)
{
result += LT + tag;
if (!(*i).m_genreCode.empty())
result += utf8(" v1=\"") + (*i).m_genreCode.escapeXML() + utf8("\"");
result += GT + (*i).m_refinement.escapeXML() + endTag;
}
return result;
}
uniString::utf8 ID3V2::toString(const genreList_t &l) throw()
{
for(genreList_t::const_iterator i = l.begin(); i != l.end(); ++i)
{
if (!(*i).m_genreCode.empty()) return (*i).m_genreCode;
}
return uniString::utf8();
}
////////////////////////////////////////////////////////////////////////////////////////////////////////
void ID3V2::fromStringList(const vector<uniString::utf8> &s,stringList_t &l) throw()
{
//l = stringUtil::tokenizer(s,(utf8::value_type)'/');
l = s;
}
uniString::utf8 ID3V2::toXML(const uniString::utf8 &tag,const stringList_t &l) throw()
{
utf8 result;
utf8 startTag = LT + tag + GT;
utf8 endTag = LTSLASH + tag + GT;
for(stringList_t::const_iterator i = l.begin(); i != l.end(); ++i)
{
result += startTag + (*i).escapeXML() + endTag;
}
return result;
}
uniString::utf8 ID3V2::toString(const stringList_t &l) throw()
{
return (l.empty() ? uniString::utf8() : l.front());
}
/////////////////////////////////////////////////////////////////////////////////////////////////
void ID3V2::fromStringList(const std::vector<uniString::utf8> &s,comment_t &c) throw()
{
if (s.size() >= 3)
{
c.m_languageCode = s[0];
c.m_id = s[1];
c.m_comment = s[2];
}
}
uniString::utf8 ID3V2::toXML(const uniString::utf8 &tag,const comment_t &c) throw()
{
utf8 result;
result += LT + tag;
if (!c.m_languageCode.empty())
result += utf8(" language=\"") + c.m_languageCode.escapeXML() + utf8("\"");
if (!c.m_id.empty())
result += utf8(" id=\"") + c.m_id.escapeXML() + utf8("\"");
result += GT + c.m_comment.escapeXML() + LTSLASH + tag + GT;
return result;
}
uniString::utf8 ID3V2::toString(const comment_t &c) throw()
{
return c.m_comment;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////
void ID3V2::fromStringList(const std::vector<uniString::utf8> &s,userUrl_t &c) throw()
{
if (!s.empty())
c.m_id = s[0];
if (s.size() > 1)
c.m_url = s[1];
}
uniString::utf8 ID3V2::toXML(const uniString::utf8 &tag,const userUrl_t &c) throw()
{
if (c.m_id.empty() && c.m_url.empty()) return utf8();
utf8 result = LT + tag;
if (!c.m_id.empty())
result += utf8(" id=\"") + c.m_id.escapeXML() + utf8("\"");
result += GT + c.m_url.escapeXML() + LTSLASH + tag + GT;
return result;
}
uniString::utf8 ID3V2::toString(const userUrl_t &c) throw()
{ return c.m_url; }
/////////////////////////////////////////////////////////////////////////////////////////////////////
void ID3V2::fromStringList(const std::vector<uniString::utf8> &s,userText_t &t) throw()
{
if (!s.empty())
t.m_id = s[0];
if (s.size() > 1)
t.m_text = s[1];
}
uniString::utf8 ID3V2::toXML(const uniString::utf8 &tag,const userText_t &t) throw()
{
if (t.m_id.empty() && t.m_text.empty()) return utf8();
utf8 result = LT + tag;
if (!t.m_id.empty())
result += utf8(" id=\"") + t.m_id.escapeXML() + utf8("\"");
result += GT + t.m_text.escapeXML() + LTSLASH + tag + GT;
return result;
}
uniString::utf8 ID3V2::toString(const userText_t &t) throw()
{ return t.m_text; }
/////////////////////////////////////////////////////////////////////////////////////////////
void ID3V2::fromStringList(const std::vector<uniString::utf8> &s,popularimeter_t &p) throw()
{
vector<utf8>::size_type siz = s.size();
if (siz > 0)
p.m_email = s[0];
if (siz > 1)
p.m_rating = s[1];
if (siz > 2)
p.m_counter = s[2];
}
uniString::utf8 ID3V2::toXML(const uniString::utf8 &tag,const popularimeter_t &p) throw()
{
if (p.m_counter.empty() && p.m_email.empty() && p.m_rating.empty()) return utf8();
utf8 result = LT + tag + GT;
result += LT + utf8("email") + GT;
result += p.m_email.escapeXML();
result += LTSLASH + utf8("email") + GT;
result += LT + utf8("rating") + GT;
result += p.m_rating.escapeXML();
result += LTSLASH + utf8("rating") + GT;
result += LT + utf8("counter") + GT;
result += p.m_counter.escapeXML();
result += LTSLASH + utf8("counter") + GT;
result += LTSLASH + tag + GT;
return result;
}
uniString::utf8 ID3V2::toString(const popularimeter_t &p) throw()
{ return p.m_rating; }
/////////////////////////////////////////////////////////////////////////////////////////////////
void ID3V2::fromStringList(const std::vector<uniString::utf8> &s,unsyncLyrics_t &c) throw()
{
if (s.size() >= 3)
{
c.m_languageCode = s[0];
c.m_id = s[1];
c.m_lyrics = s[2];
}
}
uniString::utf8 ID3V2::toXML(const uniString::utf8 &tag,const unsyncLyrics_t &c) throw()
{
if (c.m_lyrics.empty()) return utf8();
utf8 result;
result += LT + tag;
if (!c.m_languageCode.empty())
result += utf8(" language=\"") + c.m_languageCode.escapeXML() + utf8("\"");
if (!c.m_id.empty())
result += utf8(" id=\"") + c.m_id.escapeXML() + utf8("\"");
result += GT + c.m_lyrics.escapeXML() + LTSLASH + tag + GT;
return result;
}
uniString::utf8 ID3V2::toString(const unsyncLyrics_t &c) throw()
{
return c.m_lyrics;
}
/////////////////////////////////////////////////////////////////////////////////////////
void ID3V2::fromStringList(const std::vector<uniString::utf8> &s,picture_t &p) throw()
{
vector<uniString::utf8>::size_type siz = s.size();
if (siz > 0) p.m_mimeType = s[0];
if (siz > 1) p.m_pictureType = s[1];
if (siz > 2) p.m_id = s[2];
if (siz > 3) p.m_pictureData = s[3];
}
uniString::utf8 ID3V2::toXML(const uniString::utf8 &tag,const picture_t &p) throw()
{
utf8 result;
result += LT + tag;
if (!p.m_mimeType.empty())
result += utf8(" mime=\"") + p.m_mimeType.escapeXML() + utf8("\"");
if (!p.m_id.empty())
result += utf8(" id=\"") + p.m_id.escapeXML() + utf8("\"");
if (!p.m_pictureType.empty())
result += utf8(" type=\"") + p.m_pictureType.escapeXML() + utf8("\"");
result += GT + p.m_pictureData.escapeXML() + LTSLASH + tag + GT;
return result;
}
uniString::utf8 ID3V2::toString(const picture_t &p) throw()
{
return p.m_pictureData;
}
////////////////////////////////////////////////////////////////////////////////////
void ID3V2::fromStringList(const std::vector<uniString::utf8> &s,mcdi_t &m) throw()
{
if (!s.empty()) m.m_cdTOC = s[0];
}
uniString::utf8 ID3V2::toXML(const uniString::utf8 &tag,const mcdi_t &m) throw()
{
utf8 result;
result += LT + tag;
result += GT + m.m_cdTOC.escapeXML() + LTSLASH + tag + GT;
return result;
}
uniString::utf8 ID3V2::toString(const mcdi_t &m) throw()
{ return m.m_cdTOC; }
////////////////////////////////////////////////////////////////////////////////////
void ID3V2::fromStringList(const std::vector<uniString::utf8> &s,ufid_t &u) throw()
{
vector<utf8>::size_type siz = s.size();
if (siz > 0) u.m_id = s[0];
if (siz > 1) u.m_data = s[1];
}
uniString::utf8 ID3V2::toXML(const uniString::utf8 &tag,const ufid_t &u) throw()
{
utf8 result;
result += LT + tag;
if (!u.m_id.empty())
result += utf8(" id=\"") + u.m_id.escapeXML() + utf8("\"");
result += GT + u.m_data.escapeXML() + LTSLASH + tag + GT;
return result;
}
uniString::utf8 ID3V2::toString(const ufid_t &u) throw()
{ return u.m_data; }
////////////////////////////////////////////////////////////////////////////////////
void ID3V2::fromStringList(const std::vector<uniString::utf8> &s,part_t &p) throw()
{
if (!s.empty())
{
vector<utf8> l = stringUtil::tokenizer(s[0],(utf8::value_type)'/');
if (!l.empty()) p.m_part = l[0];
if (l.size() > 1) p.m_total = l[1];
}
}
uniString::utf8 ID3V2::toXML(const uniString::utf8 &tag,const part_t &p) throw()
{
utf8 result;
result += LT + tag;
if (!p.m_total.empty())
result += utf8(" total=\"") + p.m_total.escapeXML() + utf8("\"");
result += GT + p.m_part.escapeXML() + LTSLASH + tag + GT;
return result;
}
uniString::utf8 ID3V2::toString(const part_t &p) throw()
{ return p.m_part; }
////////////////////////////////////////////////////////////////////////////////////
void ID3V2::fromStringList(const std::vector<uniString::utf8> &s,geob_t &g) throw()
{
vector<utf8>::size_type siz = s.size();
if (siz > 0) g.m_mimeType = s[0];
if (siz > 1) g.m_filename = s[1];
if (siz > 2) g.m_id = s[2];
if (siz > 3) g.m_data = s[3];
}
uniString::utf8 ID3V2::toXML(const uniString::utf8 &tag,const geob_t &g) throw()
{
utf8 result;
result += LT + tag;
if (!g.m_mimeType.empty())
result += utf8(" mime=\"") + g.m_mimeType.escapeXML() + utf8("\"");
if (!g.m_id.empty())
result += utf8(" id=\"") + g.m_id.escapeXML() + utf8("\"");
if (!g.m_filename.empty())
result += utf8(" filename=\"") + g.m_filename.escapeXML() + utf8("\"");
result += GT + g.m_data.escapeXML() + LTSLASH + tag + GT;
return result;
}
uniString::utf8 ID3V2::toString(const geob_t &g) throw()
{ return g.m_data; }
////////////////////////////////////////////////////////////////////////////////////
void ID3V2::fromStringList(const std::vector<uniString::utf8> &s,priv_t &p) throw()
{
vector<utf8>::size_type siz = s.size();
if (siz > 0) p.m_id = s[0];
if (siz > 1) p.m_data = s[1];
}
uniString::utf8 ID3V2::toXML(const uniString::utf8 &tag,const priv_t &p) throw()
{
utf8 result;
result += LT + tag;
if (!p.m_id.empty())
result += utf8(" id=\"") + p.m_id.escapeXML() + utf8("\"");
result += GT + p.m_data.escapeXML() + LTSLASH + tag + GT;
return result;
}
uniString::utf8 ID3V2::toString(const priv_t &p) throw()
{ return p.m_data; }
////////////////////////////////////////////////////////////////////////////////////
void ID3V2::fromStringList(const std::vector<uniString::utf8> &s,timestamp_t &t) throw(runtime_error)
{
if (s.empty()) return;
static const int state_year = 0;
static const int state_month = 1;
static const int state_day = 2;
static const int state_hour = 3;
static const int state_minute = 4;
static const int state_second = 5;
int state = state_year;
utf8 value;
for(utf8::const_iterator i = s[0].begin(); i != s[0].end(); ++i)
{
switch(state)
{
case state_year:
if (uniString::is_a_number(*i))
{
value += *i;
if (value.size() > 4) throw runtime_error("Year has too many digits");
}
else if ((*i) == '-')
{
if (value.size() != 4) throw runtime_error("Year has the wrong digit count");
t.m_year = value;
value.clear();
state = state_month;
}
else throw runtime_error("Unexpected character while processing year");
break;
case state_month:
if (uniString::is_a_number(*i))
{
value += *i;
if (value.size() > 2) throw runtime_error("Month has too many digits");
}
else if ((*i) == '-')
{
if (value.empty()) throw runtime_error("No digits for month");
t.m_month = value;
value.clear();
state = state_day;
}
else throw runtime_error("Unexpected character while processing month");
break;
case state_day:
if (uniString::is_a_number(*i))
{
value += *i;
if (value.size() > 2) throw runtime_error("Day has too many digits");
}
else if ((*i) == 'T')
{
if (value.empty()) throw runtime_error("No digits for day");
t.m_day = value;
value.clear();
state = state_hour;
}
else throw runtime_error("Unexpected character while processing day");
break;
case state_hour:
if (uniString::is_a_number(*i))
{
value += *i;
if (value.size() > 2) throw runtime_error("Hour has too many digits");
}
else if ((*i) == ':')
{
if (value.empty()) throw runtime_error("No digits for hour");
t.m_hour = value;
value.clear();
state = state_minute;
}
else throw runtime_error("Unexpected character while processing hour");
break;
case state_minute:
if (uniString::is_a_number(*i))
{
value += *i;
if (value.size() > 2) throw runtime_error("Minute has too many digits");
}
else if ((*i) == ':')
{
if (value.empty()) throw runtime_error("No digits for minute");
t.m_minute = value;
value.clear();
state = state_second;
}
else throw runtime_error("Unexpected character while processing minute");
break;
case state_second:
if (uniString::is_a_number(*i))
{
value += *i;
if (value.size() > 2) throw runtime_error("Second has too many digits");
}
else throw runtime_error("Unexpected character while processing second");
break;
default:
throw runtime_error(string(__FUNCTION__) + " internal error. Unknown state");
break;
}
}
if (!value.empty())
{
switch(state)
{
case state_year:
if (value.size() != 4) throw runtime_error("Wrong digit count for year");
t.m_year = value;
break;
case state_month:
if (value.size() > 2) throw runtime_error("Month has too many digits");
t.m_month = value;
break;
case state_day:
if (value.size() > 2) throw runtime_error("Day has too many digits");
t.m_day = value;
break;
case state_hour:
if (value.size() > 2) throw runtime_error("Hour has too many digits");
t.m_hour = value;
break;
case state_minute:
if (value.size() > 2) throw runtime_error("Minute has too many digits");
t.m_minute = value;
break;
case state_second:
if (value.size() > 2) throw runtime_error("Second has too many digits");
t.m_second = value;
break;
default:
throw runtime_error(string(__FUNCTION__) + " internal error. Unknown state");
break;
}
}
}
uniString::utf8 ID3V2::toXML(const uniString::utf8 &tag,const timestamp_t &t) throw()
{
utf8 result;
if (t.m_year.empty()) return result;
result += LT + tag + GT;
if (!t.m_year.empty()) result += LT + utf8("year") + GT + t.m_year.escapeXML() + LTSLASH + utf8("year") + GT;
if (!t.m_month.empty()) result += LT + utf8("month") + GT + t.m_month.escapeXML() + LTSLASH + utf8("month") + GT;
if (!t.m_day.empty()) result += LT + utf8("day") + GT + t.m_day.escapeXML() + LTSLASH + utf8("day") + GT;
if (!t.m_hour.empty()) result += LT + utf8("hour") + GT + t.m_hour.escapeXML() + LTSLASH + utf8("hour") + GT;
if (!t.m_minute.empty()) result += LT + utf8("minute") + GT + t.m_minute.escapeXML() + LTSLASH + utf8("minute") + GT;
if (!t.m_second.empty()) result += LT + utf8("second") + GT + t.m_second.escapeXML() + LTSLASH + utf8("second") + GT;
result += LTSLASH + tag + GT;
return result;
}
uniString::utf8 ID3V2::toString(const timestamp_t &t) throw()
{
utf8 result;
if (t.m_year.empty()) return result;
result += t.m_year;
if (t.m_month.empty()) return result;
result += utf8("-") + t.m_month;
if (t.m_day.empty()) return result;
result += utf8("-") + t.m_day;
if (t.m_hour.empty()) return result;
result += utf8("T") + t.m_hour;
if (t.m_minute.empty()) return result;
result += utf8(":") + t.m_minute;
if (t.m_second.empty()) return result;
result += utf8(":") + t.m_second;
return result;
}

View File

@ -1,184 +0,0 @@
#ifndef ID3miniParsers_H_
#define ID3miniParsers_H_
#include "unicode/uniString.h"
#include <vector>
#include <stdexcept>
// parsers for complex ID3V2 fields (like genre)
namespace ID3V2
{
void base64encode(const char *in,size_t siz,std::string &out) throw();
////////////////////
/* Extracts strings based on a coded formatter
e - single byte encoding. Will be used for all subsequence encoding based strings
u - non-encoded latin-1 string
s - encoded string
b - binary coded data to end of block
l - three char language code
c - single byte code
y - dynamic counter (value in popularimeter)
modifiers:
+ - repeats to end of block
*/
std::vector<uniString::utf8> extractor(const std::vector<__uint8> &data,const char *format) throw(std::exception);
//////////////////////
//// structs for various tag types
struct genreEntry
{
uniString::utf8 m_genreCode;
uniString::utf8 m_refinement;
};
struct comment_t
{
uniString::utf8 m_languageCode;
uniString::utf8 m_id;
uniString::utf8 m_comment;
};
struct userUrl_t
{
uniString::utf8 m_id;
uniString::utf8 m_url;
};
struct userText_t
{
uniString::utf8 m_id;
uniString::utf8 m_text;
};
struct popularimeter_t
{
uniString::utf8 m_email;
uniString::utf8 m_rating;
uniString::utf8 m_counter;
};
struct unsyncLyrics_t
{
uniString::utf8 m_languageCode;
uniString::utf8 m_id;
uniString::utf8 m_lyrics;
};
struct picture_t
{
uniString::utf8 m_mimeType;
uniString::utf8 m_pictureType;
uniString::utf8 m_id;
uniString::utf8 m_pictureData;
};
struct mcdi_t // CD TOC
{
uniString::utf8 m_cdTOC;
};
struct ufid_t // universal file id
{
uniString::utf8 m_id;
uniString::utf8 m_data;
};
struct part_t // TRCK or TPOS (ie 3/7)
{
uniString::utf8 m_part;
uniString::utf8 m_total;
};
struct geob_t // general encapsulated object
{
uniString::utf8 m_mimeType;
uniString::utf8 m_filename;
uniString::utf8 m_id;
uniString::utf8 m_data;
};
struct priv_t // private frame
{
uniString::utf8 m_id;
uniString::utf8 m_data;
};
struct timestamp_t
{
uniString::utf8 m_year;
uniString::utf8 m_month;
uniString::utf8 m_day;
uniString::utf8 m_hour;
uniString::utf8 m_minute;
uniString::utf8 m_second;
};
typedef std::vector<ID3V2::genreEntry> genreList_t;
typedef std::vector<uniString::utf8> stringList_t;
typedef uniString::utf8 string_t;
// parser and extractor overloads for the various data types
/////
void fromStringList(const std::vector<uniString::utf8> &s,genreList_t &l) throw(std::runtime_error);
uniString::utf8 toXML(const uniString::utf8 &tag,const genreList_t &l) throw();
uniString::utf8 toString(const genreList_t &l) throw();
void fromStringList(const std::vector<uniString::utf8> &s,stringList_t &l) throw();
uniString::utf8 toXML(const uniString::utf8 &tag,const stringList_t &l) throw();
uniString::utf8 toString(const stringList_t &l) throw();
void fromStringList(const std::vector<uniString::utf8> &s,comment_t &c) throw();
uniString::utf8 toXML(const uniString::utf8 &tag,const comment_t &c) throw();
uniString::utf8 toString(const comment_t &c) throw();
void fromStringList(const std::vector<uniString::utf8> &s,userUrl_t &c) throw();
uniString::utf8 toXML(const uniString::utf8 &tag,const userUrl_t &c) throw();
uniString::utf8 toString(const userUrl_t &c) throw();
void fromStringList(const std::vector<uniString::utf8> &s,userText_t &t) throw();
uniString::utf8 toXML(const uniString::utf8 &tag,const userText_t &t) throw();
uniString::utf8 toString(const userText_t &t) throw();
void fromStringList(const std::vector<uniString::utf8> &s,popularimeter_t &p) throw();
uniString::utf8 toXML(const uniString::utf8 &tag,const popularimeter_t &p) throw();
uniString::utf8 toString(const popularimeter_t &p) throw();
void fromStringList(const std::vector<uniString::utf8> &s,unsyncLyrics_t &c) throw();
uniString::utf8 toXML(const uniString::utf8 &tag,const unsyncLyrics_t &c) throw();
uniString::utf8 toString(const unsyncLyrics_t &c) throw();
void fromStringList(const std::vector<uniString::utf8> &s,picture_t &c) throw();
uniString::utf8 toXML(const uniString::utf8 &tag,const picture_t &c) throw();
uniString::utf8 toString(const picture_t &c) throw();
void fromStringList(const std::vector<uniString::utf8> &s,mcdi_t &m) throw();
uniString::utf8 toXML(const uniString::utf8 &tag,const mcdi_t &m) throw();
uniString::utf8 toString(const mcdi_t &m) throw();
void fromStringList(const std::vector<uniString::utf8> &s,ufid_t &u) throw();
uniString::utf8 toXML(const uniString::utf8 &tag,const ufid_t &u) throw();
uniString::utf8 toString(const ufid_t &u) throw();
void fromStringList(const std::vector<uniString::utf8> &s,part_t &u) throw();
uniString::utf8 toXML(const uniString::utf8 &tag,const part_t &u) throw();
uniString::utf8 toString(const part_t &u) throw();
void fromStringList(const std::vector<uniString::utf8> &s,geob_t &g) throw();
uniString::utf8 toXML(const uniString::utf8 &tag,const geob_t &g) throw();
uniString::utf8 toString(const geob_t &g) throw();
void fromStringList(const std::vector<uniString::utf8> &s,priv_t &p) throw();
uniString::utf8 toXML(const uniString::utf8 &tag,const priv_t &p) throw();
uniString::utf8 toString(const priv_t &p) throw();
void fromStringList(const std::vector<uniString::utf8> &s,timestamp_t &t) throw(std::runtime_error);
uniString::utf8 toXML(const uniString::utf8 &tag,const timestamp_t &t) throw();
uniString::utf8 toString(const timestamp_t &t) throw();
}
#endif

View File

@ -1,216 +0,0 @@
#include "MP3Header.h"
#include "global.h"
#include "nmrCommon/stl/stringUtils.h"
#include "nmrCommon/services/stdServiceImpl.h"
#include "nmrCommon/unicode/uniString.h"
const __uint32 make28BitValue(const __uint8 buf[4])
{
return ((((__uint32)buf[0]) << 21) |
(((__uint32)buf[1]) << 14) |
(((__uint32)buf[2]) << 7) |
(((__uint32)buf[3])));
}
// Bitrates - use [version][layer][bitrate]
const __uint16 mpeg_bitrates[4][4][16] = {
{ // Version 2.5
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Reserved
{ 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0 }, // Layer 3
{ 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0 }, // Layer 2
{ 0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256, 0 } // Layer 1
},
{ // Reserved
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Invalid
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Invalid
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Invalid
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } // Invalid
},
{ // Version 2
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Reserved
{ 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0 }, // Layer 3
{ 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0 }, // Layer 2
{ 0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256, 0 } // Layer 1
},
{ // Version 1
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Reserved
{ 0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 0 }, // Layer 3
{ 0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 0 }, // Layer 2
{ 0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 0 }, // Layer 1
}
};
// Sample rates - use [version][srate]
const __uint16 mpeg_srates[4][4] = {
{ 11025, 12000, 8000, 0 }, // MPEG 2.5
{ 0, 0, 0, 0 }, // Reserved
{ 22050, 24000, 16000, 0 }, // MPEG 2
{ 44100, 48000, 32000, 0 } // MPEG 1
};
// Samples per frame - use [version][layer]
const __uint16 mpeg_frame_samples[4][4] = {
// Rsvd 3 2 1 < Layer v Version
{ 0, 576, 1152, 384 }, // 2.5
{ 0, 0, 0, 0 }, // Reserved
{ 0, 576, 1152, 384 }, // 2
{ 0, 1152, 1152, 384 } // 1
};
// Slot size (MPEG unit of measurement) - use [layer]
const __uint8 mpeg_slot_size[4] = { 0, 1, 1, 4 }; // Rsvd, 3, 2, 1
const char *MP3_FrameInfo::getLayerName() const
{
switch (m_layer)
{
case 1: return "3";
case 2: return "2";
case 3: return "1";
}
return "unknown layer";
}
const char *MP3_FrameInfo::getVersionName() const
{
switch (m_version)
{
case 0: return "v2.5";
case 2: return "v2";
case 3: return "v1";
}
return "unknown version";
}
int getMP3FrameSize (MP3_FrameInfo &info, const unsigned char *hdr, unsigned int len)
{
if (len < 4)
return 0;
int samples = mpeg_frame_samples[info.m_version][info.m_layer];
if (samples == 0)
return -1;
int bitrate = mpeg_bitrates [info.m_version] [info.m_layer] [((hdr[2] & 0xf0) >> 4)];
if (bitrate == 0)
return -1;
info.m_bitrate = bitrate;
info.m_samples = samples;
return (int)(((float)(samples / 8.0) * (float)bitrate * 1000) /
(float)info.m_samplerate) + (((hdr[2] & 0x02) >> 1) ? mpeg_slot_size[info.m_layer] : 0);
}
const int getMP3FrameInfo(const char *hdr, unsigned int *samplerate, int *bitrate, bool *mono)
{
// Quick validity check
if ( ( ((unsigned char)hdr[0] & 0xFF) != 0xFF)
|| ( ((unsigned char)hdr[1] & 0xE0) != 0xE0) // 3 sync bits
|| ( ((unsigned char)hdr[1] & 0x18) == 0x08) // Version rsvd
|| ( ((unsigned char)hdr[1] & 0x06) == 0x00) // Layer rsvd
|| ( ((unsigned char)hdr[2] & 0xF0) == 0xF0) // Bitrate rsvd
) return 0;
// Data to be extracted from the header
__uint8 ver = (hdr[1] & 0x18) >> 3; // Version index
__uint8 lyr = (hdr[1] & 0x06) >> 1; // Layer index
//__uint8 pad = (hdr[2] & 0x02) >> 1; // Padding? 0/1
//__uint8 brx = (hdr[2] & 0xf0) >> 4; // Bitrate index
__uint8 srx = (hdr[2] & 0x0c) >> 2; // SampRate index
if (mono)
{
*mono = (((hdr[3] >> 6) & 3) == 0x3); // Channel mode
}
// Lookup real values of these fields
*samplerate = mpeg_srates[ver][srx];
*bitrate = mpeg_bitrates[ver][lyr][((hdr[2] & 0xf0) >> 4)];
//__uint16 samples = mpeg_frame_samples[ver][lyr];
//__uint8 slot_size = mpeg_slot_size[lyr];
// Frame sizes are truncated integers
return (__uint16)(((float)(mpeg_frame_samples[ver][lyr] / 8.0) *
(float)*bitrate * 1000) / (float)mpeg_srates[ver][srx]) +
(((hdr[2] & 0x02) >> 1) ? mpeg_slot_size[lyr] : 0);
}
const int getMP3FrameInfo (const unsigned char *hdr, unsigned int len, MP3_FrameInfo &info)
{
// Quick validity check
if ( len < 4
|| ( ((unsigned char)hdr[0] & 0xFF) != 0xFF)
|| ( ((unsigned char)hdr[1] & 0xE0) != 0xE0) // 3 sync bits
|| ( ((unsigned char)hdr[1] & 0x18) == 0x08) // Version rsvd
|| ( ((unsigned char)hdr[1] & 0x06) == 0x00) // Layer rsvd
|| ( ((unsigned char)hdr[2] & 0xF0) == 0xF0) // Bitrate rsvd
) return -1;
// Data to be extracted from the header
__uint8 ver = (hdr[1] & 0x18) >> 3; // Version index
__uint8 lyr = (hdr[1] & 0x06) >> 1; // Layer index
__uint8 srx = (hdr[2] & 0x0c) >> 2; // SampRate index
do
{
// Lookup real values of these fields
unsigned int samplerate = mpeg_srates [ver][srx];
if (samplerate == 0)
break;
int bitrate = mpeg_bitrates [ver][lyr][((hdr[2] & 0xf0) >> 4)];
if (bitrate == 0)
break;
info.m_bitrate = bitrate;
// the following are not supposed to change
info.m_samplerate = samplerate;
info.m_mono = (((hdr[3] >> 6) & 3) == 0x3); // Channel mode
info.m_layer = lyr; // Layer index
info.m_version = ver;
if (info.m_pattern == 0)
info.m_pattern = (unsigned long)(hdr[0]<<24 | (hdr[1]<<16) | (hdr[2]<<8) | hdr[0]) & info.m_mask;
// DLOG (uniString::utf8("MPEG ") + info.getVersionName() + " layer " + info.getLayerName() + (info.m_mono ? " mono (" : " stereo (") + stringUtil::tos(bitrate) + "k)");
return getMP3FrameSize (info, hdr, 4);
} while (0);
return -1;
}
int MP3_FrameInfo::verifyFrame (const unsigned char *buf, unsigned int len)
{
if (len > 4)
{
unsigned long v = (unsigned long)(buf[0])<<24 | (buf[1]<<16) | (buf[2]<<8) | buf[0];
if ((v & m_mask) == m_pattern)
{
#if 0
if (len > 40)
{
unsigned char str[6] = "LAME";
int i;
for (i=0; i < 5 && buf[36+i] == str[i]; i++)
;
if (str[i] == '\0') DLOG ("LAME header found");
}
#endif
return getMP3FrameSize (*this, buf, len);
}
// DLOG ("MPG: mask is " + stringUtil::tos(v&m_mask) + ", patt " + stringUtil::tos(m_pattern));
return -1;
}
return 0;
}
MP3_FrameInfo::MP3_FrameInfo (unsigned long value) : parserInfo (0xFFFE0000, value)
{
m_description = "MPEG ";
}
MP3_FrameInfo::MP3_FrameInfo(const unsigned char *p, unsigned int len) : parserInfo()
{
m_mask = 0xFFFE0000;
m_description = "MPEG ";
getMP3FrameInfo (p, len, *this);
}

View File

@ -1,34 +0,0 @@
#pragma once
#ifndef _MP3_HEADER_H
#define _MP3_HEADER_H
#include "nmrCommon/intTypes.h"
#include <stddef.h>
#include "global.h"
#include "uvox2Common.h"
struct MP3_FrameInfo : public parserInfo
{
bool m_mono;
int m_layer;
int m_samples;
int verifyFrame (const unsigned char *buf, unsigned int len);
MP3_FrameInfo (unsigned long value = 0);
MP3_FrameInfo (const unsigned char *p, unsigned int len);
const char *getLayerName() const;
const char *getVersionName() const;
int getUvoxType() { return MP3_DATA; }
};
const __uint32 make28BitValue(const __uint8 buf[4]);
const int getMP3FrameInfo(const char *hdr, unsigned int *samplerate, int *bitrate, bool *mono = 0);
const int getMP3FrameInfo (const unsigned char *hdr, unsigned int len, MP3_FrameInfo &info);
int getMP3FrameSize (MP3_FrameInfo &info, const unsigned char *hdr, unsigned int len);
#endif

View File

@ -1,303 +0,0 @@
#ifdef _WIN32
#include <winsock2.h>
#else
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#endif
#include <algorithm>
#include <stdio.h>
#include "adminList.h"
#include "global.h"
#include "stl/stringUtils.h"
#include "macros.h"
#include "webNet/socketOps.h"
#include "file/fileUtils.h"
#include "services/stdServiceImpl.h"
#include <assert.h>
using namespace std;
using namespace uniString;
using namespace stringUtil;
#define LOGNAME "[ADMINCGI] "
#ifdef _WIN32
typedef unsigned long in_addr_t;
#endif
adminList g_adminList;
class adminList::impl
{
private:
struct adminEntry: public admin_t
{
in_addr_t m_ip; // ip as binary type. Old style, but that's how the old sc_serv did it and we'll
// continue to do it that way until we're ready to break the old software
bool validIP() throw()
{
return ((m_ip != INADDR_NONE) && (m_ip != 0));
}
static in_addr_t stringToIP(const utf8 &sIP, utf8 &hostIP)
{
// default is to assume a raw IP address in the list
in_addr_t ip = inet_addr((const char *)sIP.c_str());
if (ip == INADDR_NONE)
{
// though if that fails then attempt to
// get an IP address from a hostname...
string sHost;
try
{
sHost = socketOps::hostNameToAddress(sIP.hideAsString());
}
catch(...)
{
}
if (!sHost.empty())
{
ip = inet_addr((const char *)sHost.c_str());
if (ip != INADDR_NONE)
{
hostIP = sHost;
}
}
}
return ip;
}
explicit adminEntry(const utf8 &numericIP) throw() : admin_t(numericIP), m_ip(stringToIP(numericIP, m_hostIP)) {}
adminEntry() throw() : m_ip(0) {}
};
AOL_namespace::mutex m_lock;
list<adminEntry> m_list;
public:
bool load(const uniFile::filenameType &fn) throw(exception)
{
if (fn.empty())
{
throwEx<tagged_error>(LOGNAME "No admin access file");
}
else if (gOptions.microServerDebug())
{
DLOG(LOGNAME "Attempting to read admin access file: " + fileUtil::getFullFilePath(fn));
}
stackLock sml(m_lock);
FILE *f = uniFile::fopen(fn,"rb");
if (!f) return false;
bool updating = (!m_list.empty());
m_list.clear();
try
{
int l = 0;
int count = 0;
while (true)
{
char buffer[4096] = {0};
if (!fgets(buffer, sizeof(buffer), f)) break; // get a line
++l; // increment line counter
utf8 s;
// skip utf-8 BOM
if ((strlen(buffer) > 2) &&
(((unsigned char*)buffer)[0] == 0xef) &&
(((unsigned char*)buffer)[1] == 0xbb) &&
(((unsigned char*)buffer)[2] == 0xbf))
{
s = &(buffer[3]);
}
else
{
s = buffer;
}
adminEntry e(stripWhitespace(s));
if (!e.validIP())
{
WLOG(LOGNAME "Line " + tos(l) + " of admin access list has been ignored (bad IP)");
}
else
{
if (this->find(e.m_numericIP,false) < 1)
{
m_list.push_back(e);
++count;
}
}
}
if (!updating)
{
if (count > 0)
{
ILOG(LOGNAME "Enabled " + tos(count) + " IP" +
(count != 1 ? "'s" : "") + " from admin access file");
}
else if (gOptions.microServerDebug())
{
DLOG(LOGNAME "No IPs read from admin access file");
}
}
else
{
ILOG(LOGNAME "Reloaded " + tos(count) + " IP" +
(count != 1 ? "'s" : "") + " from admin access file");
}
}
catch(...)
{
if (f) ::fclose(f);
throw;
}
if (f) ::fclose(f);
return true;
}
bool add(const utf8 &ipAddr, const bool soft) throw(exception)
{
// skip loopback addresses as we treat them specially anyway
if ((ipAddr.find(utf8("127.")) == utf8::npos))
{
adminEntry e(ipAddr);
if (!e.validIP())
{
if (!soft)
{
throwEx<runtime_error>(LOGNAME "Invalid IP specified - `" + ipAddr + "'");
}
else
{
return false;
}
}
stackLock sml(m_lock);
m_list.push_back(e);
return true;
}
return false;
}
// true if removed
bool remove(const utf8 &ipAddr, const bool allStream, const bool fallback = false, const bool use_lock = true)
{
if (use_lock)
{
stackLock sml(m_lock);
}
for ( list<adminEntry>::iterator i = m_list.begin(); i != m_list.end(); ++i )
{
if ( ( allStream || ( ( !allStream && ( ( *i ).m_numericIP == ipAddr ) ) || ( ( *i ).m_hostIP == ipAddr ) ) ) )
{
m_list.erase( i );
return true;
}
}
// attempt to see if we've got a hostname which has not been detected from the loading mapping
if (!fallback)
{
string sHost;
try
{
sHost = socketOps::hostNameToAddress(ipAddr.hideAsString());
}
catch(...)
{
}
if (!sHost.empty())
{
return remove(sHost, allStream, true, false);
}
}
return false;
}
// 1 if found, 0 if not, -1 if empty (assume allowed)
int find(const utf8 &ipAddr, const bool use_lock=true) throw()
{
if (use_lock)
{
stackLock sml(m_lock);
}
if (!m_list.empty())
{
for (list<adminEntry>::const_iterator i = m_list.begin(); i != m_list.end(); ++i)
{
if ((ipAddr == (*i).m_numericIP) || (ipAddr == (*i).m_hostIP))
{
return 1;
}
}
return 0;
}
return -1;
}
};
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
adminList::adminList():m_impl(0)
{
m_impl = new adminList::impl;
}
adminList::~adminList() throw()
{
forget(m_impl);
}
bool adminList::load(const uniFile::filenameType &fn) throw()
{
assert(m_impl);
bool result(false);
try
{
result = m_impl->load(fn);
}
catch(const exception &ex)
{
ELOG(ex.what());
}
return result;
}
// throws if parameters are invalid
bool adminList::add(const utf8 &ipAddr, const bool soft) throw(exception)
{
assert(m_impl);
return m_impl->add(ipAddr, soft);
}
// true if removed
bool adminList::remove(const utf8 &ipAddr, const bool allStream) throw()
{
assert(m_impl);
return m_impl->remove(ipAddr, allStream);
}
// 1 if found, 0 if not, -1 if empty (assume allowed)
int adminList::find(const utf8 &ipAddr) throw()
{
assert(m_impl);
return m_impl->find(ipAddr);
}

View File

@ -1,41 +0,0 @@
#pragma once
#ifndef adminList_H_
#define adminList_H_
#include "unicode/uniFile.h"
// class that manages lists of reserved IPs
// these are remote addresses that must always be allowed in no matter what.
class adminList
{
private:
class impl;
impl *m_impl;
public:
struct admin_t
{
uniString::utf8 m_numericIP;
uniString::utf8 m_hostIP; // used to hold the converted IP from a hostname
explicit admin_t(const uniString::utf8 &numericIP) throw() : m_numericIP(numericIP) {}
admin_t() throw() {}
};
// throws if parameters are invalid
bool add(const uniString::utf8 &ipAddr, const bool soft) throw(std::exception);
// true if removed
bool remove(const uniString::utf8 &ipAddr, const bool allStream) throw();
// 1 if found, 0 if not, -1 if empty (assume allowed)
int find(const uniString::utf8 &ipAddr) throw();
bool load(const uniFile::filenameType &fn) throw();
adminList();
~adminList() throw();
};
extern adminList g_adminList;
#endif

View File

@ -1,294 +0,0 @@
#include <algorithm>
#include <stdio.h>
#include "agentList.h"
#include "global.h"
#include "stl/stringUtils.h"
#include "file/fileUtils.h"
#include "services/stdServiceImpl.h"
#include "macros.h"
#include <assert.h>
using namespace std;
using namespace uniString;
using namespace stringUtil;
#define LOGNAME "[AGENT] "
agentList g_agentList;
class agentList::impl
{
private:
struct agentEntrySave
{
FILE *f;
size_t stream_ID;
};
struct agentEntry: public agent_t
{
void save(agentEntrySave entrySave) throw(exception)
{
if(m_stream_ID == entrySave.stream_ID)
{
utf8 s(m_agent + eol());
if (fwrite(s.c_str(),1,s.size(),entrySave.f) != s.size())
{
throwEx<tagged_error>(LOGNAME "I/O error writing " + (!entrySave.stream_ID ? "global" : "sid=" + tos(entrySave.stream_ID)) + " agent file");
}
}
}
agentEntry(const utf8 &agent, const size_t stream_ID) throw() : agent_t(agent, stream_ID) {}
agentEntry() throw() {}
};
AOL_namespace::mutex m_lock;
list<agentEntry> m_list;
public:
bool load(const uniFile::filenameType &fn, size_t stream_ID) throw(exception)
{
if (fn.empty())
{
throwEx<tagged_error>(LOGNAME "No " + (!stream_ID ? "global" : "sid=" + tos(stream_ID)) + " agent file");
}
else if (gOptions.microServerDebug())
{
DLOG(LOGNAME "Attempting to read agent file: " + fileUtil::getFullFilePath(fn));
}
stackLock sml(m_lock);
FILE *f = uniFile::fopen(fn,"rb");
if (!f) return false;
bool updating = (!m_list.empty());
m_list.clear();
try
{
int l = 0;
int count = 0;
while (true)
{
char buffer[4096] = {0};
if (!fgets(buffer, sizeof(buffer), f)) break; // get a line
++l; // increment line counter
utf8 s;
// skip utf-8 BOM
if ((strlen(buffer) > 2) &&
(((unsigned char*)buffer)[0] == 0xef) &&
(((unsigned char*)buffer)[1] == 0xbb) &&
(((unsigned char*)buffer)[2] == 0xbf))
s = &(buffer[3]);
else
s = buffer;
if (stripWhitespace(s).empty())
{
WLOG(LOGNAME "Line " + tos(l) + " of " + (!stream_ID ? "global" : "sid=" + tos(stream_ID)) + " user agent list has been ignored");
}
else
{
agentEntry e(stripWhitespace(s),stream_ID);
if(this->find(e.m_agent,e.m_stream_ID,false) == false)
{
m_list.push_back(e);
++count;
}
}
}
if (!updating)
{
ILOG(LOGNAME "Loaded " + tos(count) + " blocked user agents" + (count != 1 ? "'s" : "") + " from " + (!stream_ID ? "global" : "sid=" + tos(stream_ID)) + " agent file");
}
else
{
ILOG(LOGNAME "Reloaded " + tos(count) + " blocked user agents" + (count != 1 ? "'s" : "") + " from " + (!stream_ID ? "global" : "sid=" + tos(stream_ID)) + " agent file");
}
}
catch(...)
{
if (f) ::fclose(f);
throw;
}
if (f) ::fclose(f);
return true;
}
void save(const uniFile::filenameType &fn,size_t stream_ID) throw(exception)
{
stackLock sml(m_lock);
FILE *f = uniFile::fopen(fn,"wb");
if (!f)
{
throwEx<tagged_error>(LOGNAME "Could not open " + (!stream_ID ? "global" : "sid=" + tos(stream_ID)) +
" agent file `" + fn + "' for writing (" + errMessage().hideAsString() + ")");
}
try
{
agentEntrySave entrySave;
entrySave.f = f;
entrySave.stream_ID = stream_ID;
for_each(m_list.begin(),m_list.end(),bind2nd(mem_fun_ref(&agentEntry::save),entrySave));
}
catch(...)
{
if (f) ::fclose(f);
throw;
}
if (f) ::fclose(f);
if(!uniFile::fileSize(fn))
{
uniFile::unlink(fn);
}
}
bool add(const utf8 &agent, const size_t stream_ID, const bool soft) throw(exception)
{
if (agent.empty())
{
if (!soft) throwEx<runtime_error>(LOGNAME "Empty User Agent specified");
else return false;
}
agentEntry e(agent,stream_ID);
stackLock sml(m_lock);
m_list.push_back(e);
return true;
}
// true if removed
bool remove(const utf8 &agent, const size_t stream_ID, const bool allStream) throw()
{
stackLock sml(m_lock);
for (list<agentEntry>::iterator i = m_list.begin(); i != m_list.end(); ++i)
{
if (allStream || (((!allStream && ((*i).m_agent == agent))) && ((*i).m_stream_ID == stream_ID)))
{
m_list.erase(i);
return true;
}
}
return false;
}
// true if found
bool find(const utf8 &agent, size_t stream_ID, bool use_lock = true) throw()
{
if(use_lock)
{
stackLock sml(m_lock);
}
if(!m_list.empty())
{
for (list<agentEntry>::const_iterator i = m_list.begin(); i != m_list.end(); ++i)
{
if (((*i).m_stream_ID == stream_ID) && (agent == (*i).m_agent))
{
return true;
}
}
}
return false;
}
void get(std::vector<agentList::agent_t> &rl, size_t stream_ID) throw()
{
stackLock sml(m_lock);
for (list<agentEntry>::const_iterator i = m_list.begin(); i != m_list.end(); ++i)
{
if ((*i).m_stream_ID == stream_ID)
{
rl.push_back(*i);
}
}
}
};
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
agentList::agentList():m_impl(0)
{
m_impl = new agentList::impl;
}
agentList::~agentList() throw()
{
forget(m_impl);
}
bool agentList::load(const uniFile::filenameType &fn,size_t stream_ID) throw()
{
assert(m_impl);
bool result(false);
try
{
result = m_impl->load(fn,stream_ID);
}
catch(const exception &ex)
{
ELOG(ex.what());
}
return result;
}
bool agentList::save(const uniFile::filenameType &fn,size_t stream_ID) throw()
{
assert(m_impl);
bool result(false);
try
{
m_impl->save(fn,stream_ID);
result = true;
}
catch(const exception &ex)
{
ELOG(ex.what());
}
return result;
}
// throws if parameters are invalid
bool agentList::add(const utf8 &agent, const size_t stream_ID, bool soft) throw(exception)
{
assert(m_impl);
return m_impl->add(agent,stream_ID,soft);
}
// true if removed
bool agentList::remove(const utf8 &agent, const size_t stream_ID, bool allStream) throw()
{
assert(m_impl);
return m_impl->remove(agent,stream_ID,allStream);
}
// true if found
bool agentList::find(const utf8 &agent, const size_t stream_ID) throw()
{
assert(m_impl);
return m_impl->find(agent, stream_ID);
}
void agentList::get(vector<agentList::agent_t> &bl,size_t stream_ID) throw()
{
assert(m_impl);
m_impl->get(bl,stream_ID);
}

View File

@ -1,44 +0,0 @@
#pragma once
#ifndef agentList_H_
#define agentList_H_
#include "unicode/uniFile.h"
// class that manages lists of blocked user agents
class agentList
{
private:
class impl;
impl *m_impl;
public:
struct agent_t
{
uniString::utf8 m_agent; // used to hold the user agent to not allow
size_t m_stream_ID; // used to differentiate
agent_t(const uniString::utf8 &agent, const size_t stream_ID) throw() : m_agent(agent), m_stream_ID(stream_ID) {}
agent_t() throw() : m_stream_ID(0) {}
};
// throws if parameters are invalid
bool add(const uniString::utf8 &agent, const size_t stream_ID, const bool soft) throw(std::exception);
// true if removed
bool remove(const uniString::utf8 &agent, const size_t stream_ID, const bool allStream) throw();
// true if found
bool find(const uniString::utf8 &agent, const size_t stream_ID) throw();
bool load(const uniFile::filenameType &fn, const size_t stream_ID) throw();
bool save(const uniFile::filenameType &fn, const size_t stream_ID) throw();
agentList();
~agentList() throw();
// for web administration reference
void get(std::vector<agent_t> &rl, const size_t stream_ID) throw();
};
extern agentList g_agentList;
#endif

View File

@ -1,759 +0,0 @@
#if 0
#include "amf.h"
#include "global.h"
#define DEBUG_LOG(x) { if (gOptions.RTMPClientDebug()) DLOG((x)); }
#ifndef _WIN32
#include <arpa/inet.h>
#endif
using namespace std;
using namespace stringUtil;
using namespace uniString;
#ifdef _WIN32
// Windows is little endian only
#define __LITTLE_ENDIAN 1234
#define __BIG_ENDIAN 4321
#define __BYTE_ORDER __LITTLE_ENDIAN
#define __FLOAT_WORD_ORDER __BYTE_ORDER
typedef unsigned char uint8_t;
#else /* !_WIN32 */
#include <sys/param.h>
#if defined(BYTE_ORDER) && !defined(__BYTE_ORDER)
#define __BYTE_ORDER BYTE_ORDER
#endif
#if defined(BIG_ENDIAN) && !defined(__BIG_ENDIAN)
#define __BIG_ENDIAN BIG_ENDIAN
#endif
#if defined(LITTLE_ENDIAN) && !defined(__LITTLE_ENDIAN)
#define __LITTLE_ENDIAN LITTLE_ENDIAN
#endif
#endif /* !_WIN32 */
// define default endianness
#ifndef __LITTLE_ENDIAN
#define __LITTLE_ENDIAN 1234
#endif
#ifndef __BIG_ENDIAN
#define __BIG_ENDIAN 4321
#endif
#ifndef __BYTE_ORDER
#warning "Byte order not defined on your system, assuming little endian!"
#define __BYTE_ORDER __LITTLE_ENDIAN
#endif
// ok, we assume to have the same float word order and byte order if float word order is not defined
#ifndef __FLOAT_WORD_ORDER
//#warning "Float word order not defined, assuming the same as byte order!"
#define __FLOAT_WORD_ORDER __BYTE_ORDER
#endif
#if !defined(__BYTE_ORDER) || !defined(__FLOAT_WORD_ORDER)
#error "Undefined byte or float word order!"
#endif
#if __FLOAT_WORD_ORDER != __BIG_ENDIAN && __FLOAT_WORD_ORDER != __LITTLE_ENDIAN
#error "Unknown/unsupported float word order!"
#endif
#if __BYTE_ORDER != __BIG_ENDIAN && __BYTE_ORDER != __LITTLE_ENDIAN
#error "Unknown/unsupported byte order!"
#endif
static double
AMF0_DecodeNumber(const char *data)
{
double dVal;
#if __FLOAT_WORD_ORDER == __BYTE_ORDER
#if __BYTE_ORDER == __BIG_ENDIAN
memcpy(&dVal, data, 8);
#elif __BYTE_ORDER == __LITTLE_ENDIAN
unsigned char *ci, *co;
ci = (unsigned char *)data;
co = (unsigned char *)&dVal;
co[0] = ci[7];
co[1] = ci[6];
co[2] = ci[5];
co[3] = ci[4];
co[4] = ci[3];
co[5] = ci[2];
co[6] = ci[1];
co[7] = ci[0];
#endif
#else
#if __BYTE_ORDER == __LITTLE_ENDIAN // __FLOAT_WORD_ORER == __BIG_ENDIAN
unsigned char *ci, *co;
ci = (unsigned char *)data;
co = (unsigned char *)&dVal;
co[0] = ci[3];
co[1] = ci[2];
co[2] = ci[1];
co[3] = ci[0];
co[4] = ci[7];
co[5] = ci[6];
co[6] = ci[5];
co[7] = ci[4];
#else // __BYTE_ORDER == __BIG_ENDIAN && __FLOAT_WORD_ORER == __LITTLE_ENDIAN
unsigned char *ci, *co;
ci = (unsigned char *)data;
co = (unsigned char *)&dVal;
co[0] = ci[4];
co[1] = ci[5];
co[2] = ci[6];
co[3] = ci[7];
co[4] = ci[0];
co[5] = ci[1];
co[6] = ci[2];
co[7] = ci[3];
#endif
#endif
return dVal;
}
char *
AMF0_EncodeNumber(char *output, char *outend, double dVal)
{
if (output+8 > outend)
return NULL;
// *output++ = AMF_NUMBER; // type: Number
#if __FLOAT_WORD_ORDER == __BYTE_ORDER
#if __BYTE_ORDER == __BIG_ENDIAN
memcpy(output, &dVal, 8);
#elif __BYTE_ORDER == __LITTLE_ENDIAN
{
unsigned char *ci, *co;
ci = (unsigned char *)&dVal;
co = (unsigned char *)output;
co[0] = ci[7];
co[1] = ci[6];
co[2] = ci[5];
co[3] = ci[4];
co[4] = ci[3];
co[5] = ci[2];
co[6] = ci[1];
co[7] = ci[0];
}
#endif
#else
#if __BYTE_ORDER == __LITTLE_ENDIAN /* __FLOAT_WORD_ORER == __BIG_ENDIAN */
{
unsigned char *ci, *co;
ci = (unsigned char *)&dVal;
co = (unsigned char *)output;
co[0] = ci[3];
co[1] = ci[2];
co[2] = ci[1];
co[3] = ci[0];
co[4] = ci[7];
co[5] = ci[6];
co[6] = ci[5];
co[7] = ci[4];
}
#else /* __BYTE_ORDER == __BIG_ENDIAN && __FLOAT_WORD_ORER == __LITTLE_ENDIAN */
{
unsigned char *ci, *co;
ci = (unsigned char *)&dVal;
co = (unsigned char *)output;
co[0] = ci[4];
co[1] = ci[5];
co[2] = ci[6];
co[3] = ci[7];
co[4] = ci[0];
co[5] = ci[1];
co[6] = ci[2];
co[7] = ci[3];
}
#endif
#endif
return output+8;
}
static void serialize(vector<__uint8> &s,const utf8 &v,int mode,const utf8 &logMsgPrefix) throw(exception)
{
assert(mode == 0); // AMF3 not yet implemented
__uint16 slen = (__uint16)v.length();
slen = htons(slen);
s.insert(s.end(),(const char *)&slen,((const char *)&slen) + 2);
s.insert(s.end(),v.begin(),v.end());
}
/////////////////////////////////////////////////////////////////////////////////////////////////
AMFObject::AMFObject() throw() {}
AMFObject::~AMFObject() throw()
{
clearProperties();
}
AMFObject::AMFObject(const AMFObject &obj) throw()
{
for(propertyMap_t::const_iterator i = obj.m_properties.begin(); i != obj.m_properties.end(); ++i)
{
m_properties[(*i).first] = new AMFVal(*(*i).second);
}
}
AMFObject& AMFObject::operator=(const AMFObject &obj) throw()
{
clearProperties();
for(propertyMap_t::const_iterator i = obj.m_properties.begin(); i != obj.m_properties.end(); ++i)
{
m_properties[(*i).first] = new AMFVal(*(*i).second);
}
return *this;
}
void AMFObject::clearProperties() throw()
{
for(propertyMap_t::iterator i = m_properties.begin(); i != m_properties.end(); ++i)
{
delete (*i).second;
}
m_properties.clear();
}
// add property. Takes possession of value "v"
// throws if value already exists
void AMFObject::addProperty(const utf8 &key,AMFVal *v) throw(exception)
{
assert(v);
assert(m_properties.find(key) == m_properties.end());
if (m_properties.find(key) != m_properties.end())
throwEx<runtime_error>(string(__FUNCTION__) + " property " + key + " already exists");
if (!v)
throwEx<runtime_error>(string(__FUNCTION__) + " value is null.");
m_properties[key] = v;
}
const AMFVal* AMFObject::getProperty(const uniString::utf8 &key) const throw()
{
propertyMap_t::const_iterator i = m_properties.find(key);
if (i == m_properties.end()) return 0;
return (*i).second;
}
utf8 AMFObject::prettyPrint(int mode,const utf8 &tabs) const throw()
{
utf8 result;
result += tabs + "{" + eol();
for(propertyMap_t::const_iterator i = m_properties.begin(); i != m_properties.end(); ++i)
{
assert((*i).second);
result += tabs + "\t" + (*i).first + ": ";
result += (*i).second->prettyPrint(mode,tabs + "\t");
result += eol();
}
result += tabs + "}";
return result;
}
void AMFObject::serialize(vector<__uint8> &s,int mode,const utf8 &logMsgPrefix) const throw(exception)
{
assert(mode == 0); // AMF3 not yet implemented
for(propertyMap_t::const_iterator i = m_properties.begin(); i != m_properties.end(); ++i)
{
assert((*i).second);
::serialize(s,(*i).first,mode,logMsgPrefix);
(*i).second->serialize(s,mode,logMsgPrefix);
}
s.push_back(0);
s.push_back(0);
s.push_back(AMF0_object_end_marker);
}
void AMFObject::loadFromBitstream(const char *&bitstream,int &bitstreamLen,int mode,const utf8 &logMsgPrefix) throw(exception)
{
assert(mode == 0); // AMF3 not implemented yet
propertyMap_t pmap;
AMFVal *val = 0;
try
{
while(true)
{
if (bitstreamLen < 3) throwEx<runtime_error>(logMsgPrefix + " Insufficient data for AMF0 object marker.");
if (bitstream[0] == 0 && bitstream[1] == 0 && bitstream[2] == 9)
{
// end of object
bitstream += 3;
bitstreamLen -= 3;
break;
}
if (bitstream[0] == 0 && bitstream[1] == 0) throwEx<runtime_error>(logMsgPrefix + " AMF0 object has null string keyed property");
if (bitstreamLen < 4) throwEx<runtime_error>(logMsgPrefix + " Insufficient data for AMF0 object marker.");
// alright, we've taken care of the abberant cases and end-of-object. Now let's get a property
int slen = ntohs(*(__uint16*)bitstream);
bitstream += 2;
bitstreamLen -= 2;
if (bitstreamLen < slen) throwEx<runtime_error>(logMsgPrefix + " Insufficient data for AMF0 object property key.");
utf8 key(bitstream,bitstream + slen);
bitstream += slen;
bitstreamLen -= slen;
assert(!val);
val = new AMFVal;
val->loadFromBitstream(bitstream,bitstreamLen,mode,logMsgPrefix);
pmap[key] = val;
val = 0;
}
clearProperties();
m_properties = pmap;
}
catch(...)
{
delete val;
throw;
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
AMFEMCAArray::AMFEMCAArray() throw() {}
AMFEMCAArray::~AMFEMCAArray() throw()
{
clearProperties();
}
AMFEMCAArray::AMFEMCAArray(const AMFEMCAArray &obj) throw()
{
for(propertyMap_t::const_iterator i = obj.m_properties.begin(); i != obj.m_properties.end(); ++i)
{
m_properties[(*i).first] = new AMFVal(*(*i).second);
}
}
AMFEMCAArray& AMFEMCAArray::operator=(const AMFEMCAArray &obj) throw()
{
clearProperties();
for(propertyMap_t::const_iterator i = obj.m_properties.begin(); i != obj.m_properties.end(); ++i)
{
m_properties[(*i).first] = new AMFVal(*(*i).second);
}
return *this;
}
void AMFEMCAArray::clearProperties() throw()
{
for(propertyMap_t::iterator i = m_properties.begin(); i != m_properties.end(); ++i)
{
delete (*i).second;
}
m_properties.clear();
}
// add property. Takes possession of value "v"
// throws if value already exists
void AMFEMCAArray::addProperty(const utf8 &key,AMFVal *v) throw(exception)
{
assert(v);
assert(m_properties.find(key) == m_properties.end());
if (m_properties.find(key) != m_properties.end())
throwEx<runtime_error>(string(__FUNCTION__) + " property " + key + " already exists");
if (!v)
throwEx<runtime_error>(string(__FUNCTION__) + " value is null.");
m_properties[key] = v;
}
const AMFVal* AMFEMCAArray::getProperty(const uniString::utf8 &key) const throw()
{
propertyMap_t::const_iterator i = m_properties.find(key);
if (i == m_properties.end()) return 0;
return (*i).second;
}
utf8 AMFEMCAArray::prettyPrint(int mode,const utf8 &tabs) const throw()
{
utf8 result;
result += tabs + "{" + eol();
for(propertyMap_t::const_iterator i = m_properties.begin(); i != m_properties.end(); ++i)
{
assert((*i).second);
result += tabs + "\t" + (*i).first + ": ";
result += (*i).second->prettyPrint(mode,tabs + "\t");
result += eol();
}
result += tabs + "}";
return result;
}
void AMFEMCAArray::serialize(vector<__uint8> &s,int mode,const utf8 &logMsgPrefix) const throw(exception)
{
assert(mode == 0); // amf3 not implemented
// wowza seems to always just use zero as array length
s.push_back(0); s.push_back(0); s.push_back(0); s.push_back(0);
for(propertyMap_t::const_iterator i = m_properties.begin(); i != m_properties.end(); ++i)
{
assert((*i).second);
::serialize(s,(*i).first,mode,logMsgPrefix);
(*i).second->serialize(s,mode,logMsgPrefix);
}
s.push_back(0);
s.push_back(0);
s.push_back(AMF0_object_end_marker);
}
void AMFEMCAArray::loadFromBitstream(const char *&bitstream,int &bitstreamLen,int mode,const utf8 &logMsgPrefix) throw(exception)
{
assert(mode == 0); // AMF3 not implemented yet
propertyMap_t pmap;
AMFVal *val = 0;
try
{
if (bitstreamLen < 7) throwEx<runtime_error>(logMsgPrefix + " Insufficient data for AMF0 ECMA array type.");
// skip length
bitstream += 4;
bitstreamLen -= 4;
while(true)
{
if (bitstreamLen < 3) throwEx<runtime_error>(logMsgPrefix + " Insufficient data for ECMA array type.");
if (bitstream[0] == 0 && bitstream[1] == 0 && bitstream[2] == 9)
{
// end of object
bitstream += 3;
bitstreamLen -= 3;
break;
}
if (bitstream[0] == 0 && bitstream[1] == 0) throwEx<runtime_error>(logMsgPrefix + " AMF0 ECMA array type has null string keyed property");
if (bitstreamLen < 4) throwEx<runtime_error>(logMsgPrefix + " Insufficient data for AMF0 ECMA array type.");
// alright, we've taken care of the abberant cases and end-of-object. Now let's get a property
int slen = ntohs(*(__uint16*)bitstream);
bitstream += 2;
bitstreamLen -= 2;
if (bitstreamLen < slen) throwEx<runtime_error>(logMsgPrefix + " Insufficient data for AMF0 ECMA array type property key.");
utf8 key(bitstream,bitstream + slen);
bitstream += slen;
bitstreamLen -= slen;
assert(!val);
val = new AMFVal;
val->loadFromBitstream(bitstream,bitstreamLen,mode,logMsgPrefix);
pmap[key] = val;
val = 0;
}
clearProperties();
m_properties = pmap;
}
catch(...)
{
delete val;
throw;
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
const uniString::utf8 & AMFVal::getString() const throw(std::exception)
{
if (m_type3 == AMF3_string_marker) return m_string_val;
if (m_type0 != AMF0_string_marker) throwEx<runtime_error>("AMFVal type error. Wanted string but type is " + tos(m_type0));
return m_string_val;
}
int AMFVal::getInteger() const throw(std::exception)
{
if (m_type3 != AMF3_integer_marker) throwEx<runtime_error>("AMFVal type error. Wanted integer but type is " + tos(m_type3));
return m_integer_val;
}
double AMFVal::getNumber() const throw(std::exception)
{
if (m_type3 == AMF3_double_marker) return m_number_val;
if (m_type0 != AMF0_number_marker) throwEx<runtime_error>("AMFVal type error. Wanted number but type is " + tos(m_type0));
return m_number_val;
}
bool AMFVal::getBool() const throw(std::exception)
{
if (m_type3 == AMF3_true_marker) return true;
if (m_type3 == AMF3_false_marker) return false;
if (m_type0 != AMF0_boolean_marker) throwEx<runtime_error>("AMFVal type error. Wanted boolean but type is " + tos(m_type0));
return m_boolean_val;
}
const AMFObject& AMFVal::getObject() const throw(std::exception)
{
if (m_type3 == AMF3_object_marker) return m_object_val;
if (m_type0 != AMF0_object_marker) throwEx<runtime_error>("AMFVal type error. Wanted object but type is " + tos(m_type0));
return m_object_val;
}
void AMFVal::serialize(vector<__uint8> &s,int mode,const utf8 &logMsgPrefix) const throw(exception)
{
s.push_back(mode == 3 ? (__uint8)m_type3 : (__uint8)m_type0);
if (mode == 3)
{
switch(m_type3)
{
case AMF3_double_marker:
{
__uint8 buf[8] = {0};
AMF0_EncodeNumber((char *)buf,(char *)buf+8,m_number_val);
s.insert(s.end(),buf,buf+8);
}
break;
default:
throwEx<runtime_error>(logMsgPrefix + __FUNCTION__ + " unsupported type " + tos(m_type3));
}
}
else
{
switch(m_type0)
{
case AMF0_number_marker:
{
__uint8 buf[8] = {0};
AMF0_EncodeNumber((char *)buf,(char *)buf+8,m_number_val);
s.insert(s.end(),buf,buf+8);
}
break;
case AMF0_boolean_marker:
s.push_back(m_boolean_val ? 1 : 0);
break;
case AMF0_string_marker:
::serialize(s,m_string_val,mode,logMsgPrefix);
break;
case AMF0_object_marker:
m_object_val.serialize(s,mode,logMsgPrefix);
break;
case AMF0_ecma_array_marker:
m_ecma_array_val.serialize(s,mode,logMsgPrefix);
break;
case AMF0_null_marker:
break;
default:
throwEx<runtime_error>(logMsgPrefix + __FUNCTION__ + " unsupported type " + tos(m_type0));
break;
}
}
}
utf8 AMFVal::prettyPrint(int mode,const utf8 &tabs) const throw()
{
if (mode == 3)
{
switch(m_type3)
{
case AMF3_double_marker:
return tabs + tos(m_number_val);
case AMF3_integer_marker:
return tabs + tos(m_integer_val);
default:
break;
}
}
else
{
switch(m_type0)
{
case AMF0_number_marker:
return tabs + tos(m_number_val);
case AMF0_boolean_marker:
return tabs + (m_boolean_val ? "true" : "false");
case AMF0_string_marker:
return tabs + m_string_val;
case AMF0_object_marker:
return m_object_val.prettyPrint(mode,tabs);
case AMF0_ecma_array_marker:
return m_ecma_array_val.prettyPrint(mode,tabs);
default:
break;
}
}
return "";
}
void AMFVal::loadFromBitstream(const char *&bitstream,int &bitstreamLen,int mode,const utf8 &logMsgPrefix) throw(exception)
{
if (!bitstreamLen) throwEx<runtime_error>(logMsgPrefix + " AMF bitstream is empty");
if (mode == 3)
{
m_type3 = (AMF3Marker_t)*bitstream;
bitstreamLen -= 1;
bitstream += 1;
switch(m_type3)
{
case AMF3_double_marker:
if (bitstreamLen < 8) throwEx<runtime_error>(logMsgPrefix + " Insufficient data for AMF3 double marker.");
m_number_val = AMF0_DecodeNumber(bitstream);
bitstream += 8;
bitstreamLen -= 8;
break;
case AMF3_null_marker:
case AMF3_false_marker:
case AMF3_true_marker:
case AMF3_integer_marker:
case AMF3_string_marker:
case AMF3_xml_doc_marker:
case AMF3_date_marker:
case AMF3_array_marker:
case AMF3_object_marker:
case AMF3_xml_marker:
case AMF3_byte_array_marker:
case AMF3_undefined_marker:
throwEx<runtime_error>(logMsgPrefix + " Unsupported AMF3 marker " + tos(m_type3));
break;
default:
throwEx<runtime_error>(logMsgPrefix + " Unknown AMF3 marker " + tos(m_type3));
break;
}
}
else
{
m_type0 = (AMF0Marker_t)*bitstream;
bitstreamLen -= 1;
bitstream += 1;
switch(m_type0)
{
case AMF0_number_marker:
if (bitstreamLen < 8) throwEx<runtime_error>(logMsgPrefix + " Insufficient data for AMF0 number marker.");
m_number_val = AMF0_DecodeNumber(bitstream);
bitstream += 8;
bitstreamLen -= 8;
break;
case AMF0_boolean_marker:
if (bitstreamLen < 1) throwEx<runtime_error>(logMsgPrefix + " Insufficient data for AMF0 boolean marker.");
m_boolean_val = ((*bitstream) ? true : false);
bitstream += 1;
bitstreamLen -= 1;
break;
case AMF0_string_marker:
{
if (bitstreamLen < 2) throwEx<runtime_error>(logMsgPrefix + " Insufficient data for AMF0 string marker.");
__uint16 slen = ntohs(*(__uint16*)bitstream);
bitstream += 2;
bitstreamLen -= 2;
if (bitstreamLen < slen) throwEx<runtime_error>(logMsgPrefix + " Insufficient data for AMF0 string marker.");
m_string_val = utf8(bitstream,bitstream + slen);
bitstream += slen;
bitstreamLen -= slen;
}
break;
case AMF0_object_marker:
m_object_val.loadFromBitstream(bitstream,bitstreamLen,0,logMsgPrefix);
break;
case AMF0_ecma_array_marker:
m_ecma_array_val.loadFromBitstream(bitstream,bitstreamLen,0,logMsgPrefix);
break;
case AMF0_undefined_marker:
DEBUG_LOG(logMsgPrefix + "Warning - Undefined AMF0 marker " + tos(m_type0));
case AMF0_null_marker:
break;
case AMF0_reference_marker:
case AMF0_object_end_marker:
case AMF0_strict_array_marker:
case AMF0_date_marker:
case AMF0_long_string_marker:
case AMF0_unsupported_marker:
case AMF0_recordset_marker:
case AMF0_xml_Document_marker:
case AMF0_typed_object_marker:
case AMF0_amvplus_object_marker:
case AMF0_movieclip_marker:
throwEx<runtime_error>(logMsgPrefix + " Unsupported AMF0 marker " + tos(m_type0));
break;
default:
throwEx<runtime_error>(logMsgPrefix + " Unknown AMF0 marker " + tos(m_type0));
break;
}
}
}
///////////////////////////////////////////////////////////////////////////////////////////
void AMFEncoding::loadFromBitstream(const char *bitstream, int bitstreamLen,const uniString::utf8 &logMsgPrefix) throw(exception)
{
int blen = bitstreamLen;
const char *bs = bitstream;
vector<AMFVal> values;
while(blen)
{
AMFVal v;
v.loadFromBitstream(bs,blen,m_mode,logMsgPrefix);
values.push_back(v);
}
m_values=values;
}
const AMFVal& AMFEncoding::getValue(size_t index) const throw(std::exception)
{
if (index >= m_values.size())
throwEx<runtime_error>("AMFEncoding::getValue(" + tos(index) + ") out of range");
return m_values[index];
}
void AMFEncoding::appendValue(const AMFVal &v) throw()
{
m_values.push_back(v);
}
void AMFEncoding::serialize(vector<__uint8> &s,const utf8 &logMsgPrefix) const throw(exception)
{
for(vector<AMFVal>::const_iterator i = m_values.begin(); i != m_values.end(); ++i)
(*i).serialize(s,m_mode,logMsgPrefix);
}
utf8 AMFEncoding::prettyPrint() const throw()
{
utf8 result("INVOKE(");
result += eol();
for(vector<AMFVal>::const_iterator i = m_values.begin(); i != m_values.end(); ++i)
result += (*i).prettyPrint(m_mode,"\t") + eol();
result += ")";
return result;
}
#endif

View File

@ -1,156 +0,0 @@
#ifndef amf_H_
#define amf_H_
#include <vector>
#include <map>
#include <stdexcept>
#include "unicode/uniString.h"
enum AMF0Marker_t
{
AMF0_number_marker = 0x00,
AMF0_boolean_marker,
AMF0_string_marker,
AMF0_object_marker,
AMF0_movieclip_marker,
AMF0_null_marker,
AMF0_undefined_marker,
AMF0_reference_marker,
AMF0_ecma_array_marker,
AMF0_object_end_marker,
AMF0_strict_array_marker,
AMF0_date_marker,
AMF0_long_string_marker,
AMF0_unsupported_marker,
AMF0_recordset_marker,
AMF0_xml_Document_marker,
AMF0_typed_object_marker,
AMF0_amvplus_object_marker
};
enum AMF3Marker_t
{
AMF3_undefined_marker = 0x00,
AMF3_null_marker,
AMF3_false_marker,
AMF3_true_marker,
AMF3_integer_marker,
AMF3_double_marker,
AMF3_string_marker,
AMF3_xml_doc_marker,
AMF3_date_marker,
AMF3_array_marker,
AMF3_object_marker,
AMF3_xml_marker,
AMF3_byte_array_marker,
};
struct AMFStrictArray
{
};
struct AMFDate
{
};
class AMFVal;
struct AMFEMCAArray
{
private:
typedef std::map<uniString::utf8,AMFVal*> propertyMap_t;
std::map<uniString::utf8,AMFVal*> m_properties;
public:
AMFEMCAArray() throw();
~AMFEMCAArray() throw();
AMFEMCAArray(const AMFEMCAArray &obj) throw();
AMFEMCAArray& operator=(const AMFEMCAArray &obj) throw();
void loadFromBitstream(const char *&bitstream,int &bitstreamLen,int mode,const uniString::utf8 &logMsgPrefix) throw(std::exception);
const AMFVal* getProperty(const uniString::utf8 &key) const throw();
void addProperty(const uniString::utf8 &key,AMFVal *v) throw(std::exception); // takes possession of "v"
void clearProperties() throw();
void serialize(std::vector<__uint8> &s,int mode,const uniString::utf8 &logMsgPrefix) const throw(std::exception);
uniString::utf8 prettyPrint(int mode,const uniString::utf8 &tabs) const throw();
};
class AMFObject
{
private:
typedef std::map<uniString::utf8,AMFVal*> propertyMap_t;
std::map<uniString::utf8,AMFVal*> m_properties;
public:
AMFObject() throw();
~AMFObject() throw();
AMFObject(const AMFObject &obj) throw();
AMFObject& operator=(const AMFObject &obj) throw();
void loadFromBitstream(const char *&bitstream,int &bitstreamLen,int mode,const uniString::utf8 &logMsgPrefix) throw(std::exception);
const AMFVal* getProperty(const uniString::utf8 &key) const throw();
void addProperty(const uniString::utf8 &key,AMFVal *v) throw(std::exception); // takes possession of "v"
void clearProperties() throw();
void serialize(std::vector<__uint8> &s,int mode,const uniString::utf8 &logMsgPrefix) const throw(std::exception);
uniString::utf8 prettyPrint(int mode,const uniString::utf8 &tabs) const throw();
};
class AMFVal
{
private:
AMF0Marker_t m_type0; // type
AMF3Marker_t m_type3;
// value depends on type
int m_integer_val;
double m_number_val;
bool m_boolean_val;
uniString::utf8 m_string_val;
AMFObject m_object_val;
__uint16 m_reference_val;
AMFEMCAArray m_ecma_array_val;
AMFStrictArray m_strict_array_val;
AMFDate m_date_val;
public:
void loadFromBitstream(const char *&bitstream,int &bitstreamLen,int mode,const uniString::utf8 &logMsgPrefix) throw(std::exception);
const uniString::utf8 &getString() const throw(std::exception);
double getNumber() const throw(std::exception);
bool getBool() const throw(std::exception);
const AMFObject& getObject() const throw(std::exception);
int getInteger() const throw(std::exception);
AMFVal() throw(): m_type0(AMF0_null_marker),m_type3(AMF3_undefined_marker){}
AMFVal(double v) throw(): m_type0(AMF0_number_marker),m_type3(AMF3_undefined_marker) ,m_number_val(v){}
AMFVal(bool v) throw(): m_type0(AMF0_boolean_marker),m_type3(AMF3_undefined_marker),m_boolean_val(v){}
AMFVal(const uniString::utf8 &v) throw(): m_type0(AMF0_string_marker),m_type3(AMF3_undefined_marker) ,m_string_val(v){}
AMFVal(const AMFObject &v) throw(): m_type0(AMF0_object_marker),m_type3(AMF3_undefined_marker) ,m_object_val(v){}
AMFVal(const AMFEMCAArray &v) throw(): m_type0(AMF0_ecma_array_marker),m_type3(AMF3_undefined_marker),m_ecma_array_val(v){}
void serialize(std::vector<__uint8> &s,int mode,const uniString::utf8 &logMsgPrefix) const throw(std::exception);
uniString::utf8 prettyPrint(int mode,const uniString::utf8 &tabs) const throw();
};
class AMFEncoding
{
private:
std::vector<AMFVal> m_values;
int m_mode;
public:
AMFEncoding(int mode = 0) throw():m_mode(mode){}
~AMFEncoding() throw(){}
void clear() throw() { m_values.clear(); }
void loadFromBitstream(const char *bitstream,int bitstreamLen,const uniString::utf8 &logMsgPrefix) throw(std::exception);
const AMFVal& getValue(size_t index) const throw(std::exception);
void appendValue(const AMFVal &v) throw();
void serialize(std::vector<__uint8> &s,const uniString::utf8 &logMsgPrefix) const throw(std::exception);
uniString::utf8 prettyPrint() const throw();
};
#endif

View File

@ -1,2 +0,0 @@
build:
./unix_build_expat

View File

@ -1,42 +0,0 @@
== How to build expat with cmake (experimental) ==
The cmake based buildsystem for expat works on Windows (cygwin, mingw, Visual
Studio) and should work on all other platform cmake supports.
Assuming ~/expat-2.1.0 is the source directory of expat, add a subdirectory
build and change into that directory:
~/expat-2.1.0$ mkdir build && cd build
~/expat-2.1.0/build$
From that directory, call cmake first, then call make, make test and
make install in the usual way:
~/expat-2.1.0/build$ cmake ..
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
....
-- Configuring done
-- Generating done
-- Build files have been written to: /home/patrick/expat-2.1.0/build
If you want to specify the install location for your files, append
-DCMAKE_INSTALL_PREFIX=/your/install/path to the cmake call.
~/expat-2.1.0/build$ make && make test && make install
Scanning dependencies of target expat
[ 5%] Building C object CMakeFiles/expat.dir/lib/xmlparse.c.o
[ 11%] Building C object CMakeFiles/expat.dir/lib/xmlrole.c.o
....
-- Installing: /usr/local/lib/pkgconfig/expat.pc
-- Installing: /usr/local/bin/xmlwf
-- Installing: /usr/local/share/man/man1/xmlwf.1
For Windows builds, you must make sure to call cmake from an environment where
your compiler is reachable, that means either you call it from the
Visual Studio Command Prompt or when using mingw, you must open a cmd.exe and
make sure that gcc can be called. On Windows, you also might want to specify a
special Generator for CMake:
for Visual Studio builds do:
cmake .. -G "Visual Studio 10" && vcexpress expat.sln
for mingw builds do:
cmake .. -G "MinGW Makefiles" -DCMAKE_INSTALL_PREFIX=D:\expat-install
&& gmake && gmake install

View File

@ -1,111 +0,0 @@
# This file is copyrighted under the BSD-license for buildsystem files of KDE
# copyright 2010, Patrick Spendrin <ps_ml@gmx.de>
project(expat)
cmake_minimum_required(VERSION 2.6)
set(PACKAGE_BUGREPORT "expat-bugs@libexpat.org")
set(PACKAGE_NAME "expat")
set(PACKAGE_VERSION "2.1.0")
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
set(PACKAGE_TARNAME "${PACKAGE_NAME}")
option(BUILD_tools "build the xmlwf tool for expat library" ON)
option(BUILD_examples "build the examples for expat library" ON)
option(BUILD_tests "build the tests for expat library" ON)
option(BUILD_shared "build a shared expat library" ON)
# configuration options
set(XML_CONTEXT_BYTES 1024 CACHE STRING "Define to specify how much context to retain around the current parse point")
option(XML_DTD "Define to make parameter entity parsing functionality available" ON)
option(XML_NS "Define to make XML Namespaces functionality available" ON)
if(XML_DTD)
set(XML_DTD 1)
else(XML_DTD)
set(XML_DTD 0)
endif(XML_DTD)
if(XML_NS)
set(XML_NS 1)
else(XML_NS)
set(XML_NS 0)
endif(XML_NS)
if(BUILD_tests)
enable_testing()
endif(BUILD_tests)
include(ConfigureChecks.cmake)
include_directories(${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/lib)
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -wd4996)
endif(MSVC)
set(expat_SRCS
lib/xmlparse.c
lib/xmlrole.c
lib/xmltok.c
lib/xmltok_impl.c
lib/xmltok_ns.c
)
if(WIN32 AND BUILD_shared)
set(expat_SRCS ${expat_SRCS} lib/libexpat.def)
endif(WIN32 AND BUILD_shared)
if(BUILD_shared)
set(_SHARED SHARED)
else(BUILD_shared)
set(_SHARED STATIC)
endif(BUILD_shared)
add_library(expat ${_SHARED} ${expat_SRCS})
install(TARGETS expat RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix "\${prefix}/bin")
set(libdir "\${prefix}/lib")
set(includedir "\${prefix}/include")
configure_file(expat.pc.in ${CMAKE_CURRENT_BINARY_DIR}/expat.pc)
install(FILES lib/expat.h lib/expat_external.h DESTINATION include)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/expat.pc DESTINATION lib/pkgconfig)
if(BUILD_tools AND NOT WINCE)
set(xmlwf_SRCS
xmlwf/xmlwf.c
xmlwf/xmlfile.c
xmlwf/codepage.c
xmlwf/readfilemap.c
)
add_executable(xmlwf ${xmlwf_SRCS})
target_link_libraries(xmlwf expat)
install(TARGETS xmlwf DESTINATION bin)
install(FILES doc/xmlwf.1 DESTINATION share/man/man1)
endif(BUILD_tools AND NOT WINCE)
if(BUILD_examples)
add_executable(elements examples/elements.c)
target_link_libraries(elements expat)
add_executable(outline examples/outline.c)
target_link_libraries(outline expat)
endif(BUILD_examples)
if(BUILD_tests)
## these are unittests that can be run on any platform
add_executable(runtests tests/runtests.c tests/chardata.c tests/minicheck.c)
target_link_libraries(runtests expat)
add_test(runtests runtests)
add_executable(runtestspp tests/runtestspp.cpp tests/chardata.c tests/minicheck.c)
target_link_libraries(runtestspp expat)
add_test(runtestspp runtestspp)
endif(BUILD_tests)

View File

@ -1,22 +0,0 @@
Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
and Clark Cooper
Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006 Expat maintainers.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Some files were not shown because too many files have changed in this diff Show More