- switch to latest resiprocate

This commit is contained in:
Dmytro Bogovych 2023-05-11 15:34:13 +03:00
parent 55445f6630
commit 95fbaf5379
10736 changed files with 2057171 additions and 38694 deletions

View File

@ -135,7 +135,7 @@ protected:
#pragma endregion
static int generateId();
static resip::AtomicCounter IdGenerator;
static std::atomic_int IdGenerator;
};
typedef std::shared_ptr<Account> PAccount;

View File

@ -152,8 +152,8 @@ class UserAgent: public resip::ClientRegistrationHandler,
public resip::ServerSubscriptionHandler,
public resip::ClientPagerMessageHandler,
public resip::ServerPagerMessageHandler,
public resip::ClientPublicationHandler,
public resip::InternalTransport::TransportLogger
public resip::ClientPublicationHandler
//public resip::InternalTransport::TransportLogger
{
friend class Account;
friend class Session;
@ -397,7 +397,7 @@ public:
#pragma endregion
#pragma region TransportLogger implementation
void onSipMessage(int flow, const char* msg, unsigned int length, const sockaddr* addr, unsigned int addrlen) override;
void onSipMessage(int flow, const char* msg, unsigned int length, const sockaddr* addr, unsigned int addrlen);
#pragma endregion
#pragma region ClientPublicationHandler
@ -437,7 +437,7 @@ public:
#pragma region PagerHandler
void onSuccess(resip::ClientPagerMessageHandle, const resip::SipMessage& status) override;
void onFailure(resip::ClientPagerMessageHandle, const resip::SipMessage& status, std::unique_ptr<resip::Contents> contents) override;
void onFailure(resip::ClientPagerMessageHandle, const resip::SipMessage& status, std::unique_ptr<resip::Contents> contents);
void onMessageArrived(resip::ServerPagerMessageHandle, const resip::SipMessage& message) override;
#pragma endregion

View File

@ -28,15 +28,14 @@
#include "rutil/Logger.hxx"
#include "rutil/Random.hxx"
#include "rutil/WinLeakCheck.hxx"
#include "rutil/AtomicCounter.hxx"
#include "../ice/ICEBox.h"
#include <sstream>
#include <atomic>
#include <time.h>
#include "../config.h"
#include "EP_Session.h"
#include "EP_Account.h"
#include "EP_DataProvider.h"
#include "EP_AudioProvider.h"
@ -318,8 +317,8 @@ public:
void enqueueOffer();
void processQueuedOffer();
static int generateId();
static resip::AtomicCounter IdGenerator;
static resip::AtomicCounter InstanceCounter;
static std::atomic_int IdGenerator;
static std::atomic_int InstanceCounter;
};
typedef std::shared_ptr<Session> PSession;
@ -354,7 +353,7 @@ public:
Type_Call,
Type_Auto
};
static resip::AtomicCounter InstanceCounter;
static std::atomic_int InstanceCounter;
ResipSession(resip::DialogUsageManager& dum);

View File

@ -0,0 +1,321 @@
project (resiprocate)
if (NOT OPENSSL_INCLUDE)
message(FATAL_ERROR "OPENSSL_INCLUDE has to be directory with OpenSSL 1.0.x include files.")
endif()
# Rely on C++ 11
set (CMAKE_CXX_STANDARD 11)
set (CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set (ARES_SOURCES
contrib/ares/ares_timeout.c
contrib/ares/ares_strerror.c
contrib/ares/ares_send.c
contrib/ares/ares_search.c
contrib/ares/ares_query.c
contrib/ares/ares_process.c
contrib/ares/ares_parse_ptr_reply.c
contrib/ares/ares_parse_a_reply.c
contrib/ares/ares_mkquery.c
contrib/ares/ares_local.c
contrib/ares/ares_init.c
contrib/ares/ares_gethostbyname.c
contrib/ares/ares_gethostbyaddr.c
contrib/ares/ares_free_string.c
contrib/ares/ares_free_hostent.c
contrib/ares/ares_free_errmem.c
contrib/ares/ares_fds.c
contrib/ares/ares_expand_name.c
contrib/ares/ares_destroy.c
contrib/ares/ares__read_line.c
contrib/ares/ares__get_hostent.c
contrib/ares/ares__close_sockets.c
)
set (STACK_SOURCES
resip/stack/Compression.cxx
resip/stack/CallId.cxx
resip/stack/BranchParameter.cxx
resip/stack/BasicNonceHelper.cxx
resip/stack/Auth.cxx
resip/stack/ApplicationSip.cxx
resip/stack/ApiCheck.cxx
resip/stack/Aor.cxx
resip/stack/DateCategory.cxx
resip/stack/DataParameter.cxx
resip/stack/CSeqCategory.cxx
resip/stack/CpimContents.cxx
resip/stack/ContentsFactoryBase.cxx
resip/stack/Contents.cxx
resip/stack/ConnectionManager.cxx
resip/stack/ConnectionBase.cxx
resip/stack/Connection.cxx
resip/stack/DnsResult.cxx
resip/stack/DnsInterface.cxx
resip/stack/DeprecatedDialog.cxx
resip/stack/GenericUri.cxx
resip/stack/GenericContents.cxx
resip/stack/FloatParameter.cxx
resip/stack/ExternalBodyContents.cxx
resip/stack/ExtensionParameter.cxx
resip/stack/ExtensionHeader.cxx
resip/stack/ExpiresCategory.cxx
resip/stack/ExistsParameter.cxx
resip/stack/ExistsOrDataParameter.cxx
resip/stack/EventStackThread.cxx
resip/stack/Embedded.cxx
resip/stack/DtlsMessage.cxx
resip/stack/HeaderHash.cxx
resip/stack/HeaderFieldValueList.cxx
resip/stack/HeaderFieldValue.cxx
resip/stack/MsgHeaderScanner.cxx
resip/stack/Mime.cxx
resip/stack/MethodTypes.cxx
resip/stack/MethodHash.cxx
resip/stack/MessageWaitingContents.cxx
resip/stack/MessageFilterRule.cxx
resip/stack/Message.cxx
resip/stack/LazyParser.cxx
resip/stack/KeepAliveMessage.cxx
resip/stack/InvalidContents.cxx
resip/stack/InterruptableStackThread.cxx
resip/stack/InteropHelper.cxx
resip/stack/InternalTransport.cxx
resip/stack/IntegerParameter.cxx
resip/stack/IntegerCategory.cxx
resip/stack/Helper.cxx
resip/stack/HeaderTypes.cxx
resip/stack/Headers.cxx
resip/stack/ParameterHash.cxx
resip/stack/Parameter.cxx
resip/stack/OctetContents.cxx
resip/stack/NonceHelper.cxx
resip/stack/NameAddr.cxx
resip/stack/MultipartSignedContents.cxx
resip/stack/MultipartRelatedContents.cxx
resip/stack/MultipartMixedContents.cxx
resip/stack/MultipartAlternativeContents.cxx
resip/stack/SipStack.cxx
resip/stack/SipMessage.cxx
resip/stack/SipFrag.cxx
resip/stack/SERNonceHelper.cxx
resip/stack/SecurityAttributes.cxx
resip/stack/SdpContents.cxx
resip/stack/RportParameter.cxx
resip/stack/Rlmi.cxx
resip/stack/RequestLine.cxx
resip/stack/RAckCategory.cxx
resip/stack/QValueParameter.cxx
resip/stack/QValue.cxx
resip/stack/QuotedDataParameter.cxx
resip/stack/PrivacyCategory.cxx
resip/stack/PlainContents.cxx
resip/stack/Pkcs8Contents.cxx
resip/stack/Pkcs7Contents.cxx
resip/stack/Pidf.cxx
resip/stack/ParserContainerBase.cxx
resip/stack/ParserCategory.cxx
resip/stack/ParserCategories.cxx
resip/stack/ParameterTypes.cxx
resip/stack/X509Contents.cxx
resip/stack/WarningCategory.cxx
resip/stack/Via.cxx
resip/stack/Uri.cxx
resip/stack/UnknownParameter.cxx
resip/stack/UInt32Parameter.cxx
resip/stack/UInt32Category.cxx
resip/stack/UdpTransport.cxx
resip/stack/TuSelector.cxx
resip/stack/TupleMarkManager.cxx
resip/stack/Tuple.cxx
resip/stack/TuIM.cxx
resip/stack/TransportThread.cxx
resip/stack/TransportSelector.cxx
resip/stack/TransportFailure.cxx
resip/stack/Transport.cxx
resip/stack/TransactionUserMessage.cxx
resip/stack/TransactionUser.cxx
resip/stack/TransactionState.cxx
resip/stack/TransactionMap.cxx
resip/stack/TransactionController.cxx
resip/stack/Token.cxx
resip/stack/TimerQueue.cxx
resip/stack/TimerMessage.cxx
resip/stack/TimeAccumulate.cxx
resip/stack/TcpTransport.cxx
resip/stack/TcpConnection.cxx
resip/stack/TcpBaseTransport.cxx
resip/stack/Symbols.cxx
resip/stack/StringCategory.cxx
resip/stack/StatusLine.cxx
resip/stack/StatisticsMessage.cxx
resip/stack/StatisticsManager.cxx
resip/stack/StatisticsHandler.cxx
resip/stack/StatelessHandler.cxx
resip/stack/StackThread.cxx
resip/stack/ssl/Security.cxx
resip/stack/ssl/MacSecurity.cxx
resip/stack/ssl/WinSecurity.cxx
resip/stack/ssl/TlsConnection.cxx
resip/stack/ssl/TlsTransport.cxx
)
set (DUM_SOURCES
resip/dum/DialogUsageManager.cxx
resip/dum/DialogUsage.cxx
resip/dum/DialogSetId.cxx
resip/dum/DialogSet.cxx
resip/dum/DialogId.cxx
resip/dum/DialogEventStateManager.cxx
resip/dum/DialogEventInfo.cxx
resip/dum/Dialog.cxx
resip/dum/DestroyUsage.cxx
resip/dum/DefaultServerReferHandler.cxx
resip/dum/ContactInstanceRecord.cxx
resip/dum/ClientSubscription.cxx
resip/dum/ClientRegistration.cxx
resip/dum/ClientPublication.cxx
resip/dum/ClientPagerMessage.cxx
resip/dum/ClientOutOfDialogReq.cxx
resip/dum/ClientInviteSession.cxx
resip/dum/ClientAuthManager.cxx
resip/dum/ClientAuthExtension.cxx
resip/dum/ChallengeInfo.cxx
resip/dum/CertMessage.cxx
resip/dum/BaseUsage.cxx
resip/dum/BaseSubscription.cxx
resip/dum/BaseCreator.cxx
resip/dum/AppDialogSetFactory.cxx
resip/dum/AppDialogSet.cxx
resip/dum/AppDialog.cxx
resip/dum/KeepAliveTimeout.cxx
resip/dum/KeepAliveManager.cxx
resip/dum/InviteSessionHandler.cxx
resip/dum/InviteSessionCreator.cxx
resip/dum/InviteSession.cxx
resip/dum/InMemorySyncRegDb.cxx
resip/dum/InMemoryRegistrationDatabase.cxx
resip/dum/IdentityHandler.cxx
resip/dum/HttpProvider.cxx
resip/dum/HttpGetMessage.cxx
resip/dum/HandleManager.cxx
resip/dum/HandleException.cxx
resip/dum/Handled.cxx
resip/dum/Handle.cxx
resip/dum/EncryptionRequest.cxx
resip/dum/DumTimeout.cxx
resip/dum/DumThread.cxx
resip/dum/DumProcessHandler.cxx
resip/dum/DumHelper.cxx
resip/dum/DumFeatureMessage.cxx
resip/dum/DumFeatureChain.cxx
resip/dum/DumFeature.cxx
resip/dum/DumDecrypted.cxx
resip/dum/ServerSubscription.cxx
resip/dum/ServerRegistration.cxx
resip/dum/ServerPublication.cxx
resip/dum/ServerPagerMessage.cxx
resip/dum/ServerOutOfDialogReq.cxx
resip/dum/ServerInviteSession.cxx
resip/dum/ServerAuthManager.cxx
resip/dum/RegistrationHandler.cxx
resip/dum/RegistrationCreator.cxx
resip/dum/RedirectManager.cxx
resip/dum/RADIUSServerAuthManager.cxx
resip/dum/PublicationCreator.cxx
resip/dum/Profile.cxx
resip/dum/PagerMessageCreator.cxx
resip/dum/OutOfDialogReqCreator.cxx
resip/dum/OutgoingEvent.cxx
resip/dum/NonDialogUsage.cxx
resip/dum/NetworkAssociation.cxx
resip/dum/MergedRequestRemovalCommand.cxx
resip/dum/MergedRequestKey.cxx
resip/dum/MasterProfile.cxx
resip/dum/UserProfile.cxx
resip/dum/UserAuthInfo.cxx
resip/dum/TlsPeerAuthManager.cxx
resip/dum/TargetCommand.cxx
resip/dum/SubscriptionState.cxx
resip/dum/SubscriptionHandler.cxx
resip/dum/SubscriptionCreator.cxx
resip/dum/ssl/EncryptionManager.cxx
)
SET (RUTIL_SOURCES
rutil/FileSystem.cxx
rutil/FdPoll.cxx
rutil/DnsUtil.cxx
rutil/ssl/OpenSSLInit.cxx
rutil/ssl/SHA1Stream.cxx
rutil/dns/RRVip.cxx
rutil/dns/RROverlay.cxx
rutil/dns/RRList.cxx
rutil/dns/RRCache.cxx
rutil/dns/QueryTypes.cxx
rutil/dns/LocalDns.cxx
rutil/dns/ExternalDnsFactory.cxx
rutil/dns/DnsThread.cxx
rutil/dns/DnsStub.cxx
rutil/dns/DnsSrvRecord.cxx
rutil/dns/DnsResourceRecord.cxx
rutil/dns/DnsNaptrRecord.cxx
rutil/dns/DnsHostRecord.cxx
rutil/dns/DnsCnameRecord.cxx
rutil/dns/DnsAAAARecord.cxx
rutil/dns/AresDns.cxx
rutil/DataStream.cxx
rutil/Data.cxx
rutil/CountStream.cxx
rutil/ConfigParse.cxx
rutil/Condition.cxx
rutil/Coders.cxx
rutil/BaseException.cxx
rutil/AbstractFifo.cxx
rutil/XMLCursor.cxx
rutil/vmd5.cxx
rutil/TransportType.cxx
rutil/Timer.cxx
rutil/Time.cxx
rutil/ThreadIf.cxx
rutil/SysLogStream.cxx
rutil/SysLogBuf.cxx
rutil/Subsystem.cxx
rutil/stun/Udp.cxx
rutil/stun/Stun.cxx
rutil/Socket.cxx
rutil/ServerProcess.cxx
rutil/SelectInterruptor.cxx
rutil/RWMutex.cxx
rutil/resipfaststreams.cxx
rutil/RecursiveMutex.cxx
rutil/Random.cxx
rutil/RADIUSDigestAuthenticator.cxx
rutil/PoolBase.cxx
rutil/Poll.cxx
rutil/ParseException.cxx
rutil/ParseBuffer.cxx
rutil/Mutex.cxx
rutil/MD5Stream.cxx
rutil/Log.cxx
rutil/Lock.cxx
rutil/KeyValueStore.cxx
rutil/HeapInstanceCounter.cxx
rutil/GeneralCongestionManager.cxx
rutil/AtomicCounter.cxx
rutil/WinCompat.cxx
)
add_library(resiprocate ${ARES_SOURCES} ${RUTIL_SOURCES} ${STACK_SOURCES} ${DUM_SOURCES})
target_include_directories(resiprocate PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/contrib/ares
${OPENSSL_INCLUDE}
)
target_compile_definitions(resiprocate PUBLIC -DUSE_ARES -DUSE_SSL)
#add_library(resiprocate_lite ${RUTIL_SOURCES} ${STACK_SOURCES})

View File

@ -0,0 +1,45 @@
Quick guide to building the libraries and tests:
------------------------------------------------
1) ./configure
By default, configure runs interactively, prompting for each configuration option. configure may be run in non-interactive mode by using a -y flag. Additionally, a -m flag may be used for menu-based configuration.
2) make
Notes:
- all binaries and object files will be placed in a subdirectory of the directory containing the source files.
- a symbolic link is made to any target executables in the directory where the main is
- If you configure --with-shared-libs, it will only build shared libraries so you will need to set LD_LIBRARY_PATH. (DYLD_LIBRARY_PATH under OS X)
e.g. BASH example on linux with debug libraries
export LD_LIBRARY_PATH=$(RESIP_PATH)/lib.debug.Linux.i686
e.g. tcsh example on linux with optimized libraries
setenv LD_LIBRARY_PATH $(RESIP_PATH)/lib.opt.Linux.i686
e.g. BASH example on an Intel Macintosh running OS X
export DYLD_LIBRARY_PATH=$(RESIP_PATH)/obj.debug.Darwin.i386
To build with distcc for distributed compilation (assume you have 4 hosts runing distccd)
See http://distcc.samba.org/
% ./configure --with-distcc
% make -j 8
Supported Systems
-----------------
Supported Platforms: (to add new platform support see build/Makefile.osarch)
FreeBSD
Linux
QNX
SunOS
Mac
cygwin
Supported toolchains: (to add new toolchain support see build/Makefile.tools)
gnu (g++)
Intel (icc)
ARM cross-compiler (arm-linux-g++)
Sunpro (CC)

View File

@ -0,0 +1,88 @@
The reSIProcate build system is derived from the VOCAL build system (http://www.vovida.org).
Adding New Files to a module
----------------------------
Example: Adding a new file Foo.cxx to the stack
1) Edit resip/stack/Makefile
2) Add Foo.cxx to the SRC list
Example: Adding a new file Bar.cxx to rutil
1) Edit rutil/Makefile
2) Add Bar.cxx to the SRC list
Notes:
- All files noted in SRC list will be added to the target library
- Adding a new header file does not need to be noted in the Makefile
- To add something to the compile line add to CXXFLAGS.
e.g. CXXFLAGS += -DMYSPECIALDEFINE
- To add something to the link line add to LDFLAGS and/or LDLIBS
e.g. LDFLAGS += -L/usr/local/myspeciallibdir
e.g. LDLIBS += -lmyspeciallib
Creating an application based on the stack:
Option 1: (Using the resip build system)
For example applications using the resip build system look at resip/stack/test or at repro.
###########################################################################################
# Create a Makefile in the directory with the units with the following template
# This should be the path to the build directory of resip (in the sip subdirectory)
BUILD = ../../build
# Includes macros
include $(BUILD)/Makefile.pre
# Add any options that need to be passed to the C++ compiler here
#CXXFLAGS += -DMYSPECIALDEFINE
# Add any options that need to be passed to the C compiler here
#CFLAGS += -DMYOTHERDEFINE
# Add any options that need to be passed to the linker here
#LDFLAGS += -L/usr/local/mydir
# Add any libraries that need to be passed to the linker here
#LDLIBS += -lmylib
# All of these packages are prerequisites for resiprocate
PACKAGES += RESIP RUTIL OPENSSL ARES PTHREAD
# Add an entry to TESTPROGRAMS for each target that has a main in it
# On linux this will generate an executable in bin.debug.Linux.i686/main
TESTPROGRAMS += main.cxx
# Add each of the C++ or C files that other than the main
# Each main target (from TESTPROGRAMS) will be linked with all of the files in SRC
SRC = TestSupport.cxx
# Includes macros
include $(BUILD)/Makefile.post
###########################################################################################
Option 2: (Using a third party build system)
Prerequisites:
- Install ares library from contrib/ares
- cd contrib/ares
- ./configure
- make
- make install
Pass the following flags to C++ compiler:
Assumptions:
- have pthreads
- have openssl installed
- have ares installed
- resiprocate library is built and installed
# Linux Example
CXXFLAGS += -Wall -fPIC -Wno-deprecated -march=i686 \
-D_REENTRANT -DUSE_SSL -DNEW_MSG_HEADER_SCANNER -DUSE_IPV6 -DUSE_ARES \
-I/usr/kerberos/include -I$(RESIP_DIR)/lib.debug.Linux.i686
LDFLAGS += -L$(RESIP_DIR)/lib.debug.Linux.i686
LDLIBS += -lresip -lrutil -lssl -lcrypto -lares -lpthread

View File

@ -0,0 +1,175 @@
#
# SYNOPSIS
#
# AX_RESIP([MINIMUM-VERSION])
#
# NOTE
# Currently macros does not check the version of the resiprocate library
#
# DESCRIPTION
#
# This macro provides tests of availability of the resiprocate library (resiprocate.org)
#
# Next options are available:
# --with-resip=path defines the complete path to the Resiprocate includes and
# libraries
# --with-resip-inc=path defines the complete path to resip headers
# --with-resip-lib=path defines the complete path to resip library
#
# This macro calls:
#
# AC_SUBST(RESIP_CPPFLAGS)
# AC_SUBST(RESIP_LDFLAGS)
# AC_SUBST(RESIP_LIBS)
#
# And sets:
#
# HAVE_RESIPROCATE
#
# COPYLEFT
#
# Copyright (c) 2009 Tarasenko Volodymyr <tvntsr@yahoo.com>
#
# 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 any warranty.
AC_DEFUN([AX_RESIP],
[
AC_ARG_WITH([resip],
AC_HELP_STRING([--with-resip=@<:@ARG@:>@],
[use Resiprocate library @<:@default=yes@:>@, optionally specify a path to includes and library]
),
[
if test "$withval" = "no"; then
want_resip="no"
elif test "$withval" = "yes"; then
want_resip="yes"
else
want_resip="yes"
resip_path="$withval"
fi
],
[want_resip="yes"]
)
dnl
dnl RESIP includes
dnl
AC_ARG_WITH([resip_inc],
AC_HELP_STRING([--with-resip-inc=@<:@ARG@:>@],
[specify Resiprocate includes]
),
[
case "$withval" in
/* ) ;;
* ) AC_MSG_ERROR([The Resiprocate includes directory must be an absolute path.]) ;;
esac
resip_inc_path="$withval"
],
[resip_inc_path="/usr/include /usr/include/resip /usr/local/include /usr/local/resip"]
)
dnl
dnl RESIP libraries
dnl
AC_ARG_WITH([resip_lib],
AC_HELP_STRING([--with-resip-lib=@<:@ARG@:>@],
[specify Resiprocate library path]
),
[
case "$withval" in
/* ) ;;
* ) AC_MSG_ERROR([The Resiprocate library path directory must be an absolute path.]) ;;
esac
resip_lib_path="$withval"
],
[resip_lib_path="/lib /usr/lib /usr/lib64 /usr/local/lib /usr/local/resip"]
)
RESIP_CPPFLAGS=""
RESIP_LDFLAGS=""
RESIP_LIBS=""
dnl
dnl Do checks
dnl
AC_MSG_CHECKING([for Resiprocate library])
if test "x$want_resip" = "xyes"; then
AC_REQUIRE([AC_PROG_CPP])
AC_REQUIRE([AC_CANONICAL_BUILD])
if test -n "$resip_path"; then
RESIP_CPPFLAGS="-I$resip_path"
RESIP_LDFLAGS="-L$resip_path"
else
for inc in $resip_inc_path; do
if test -f "$inc/resip/stack/SipStack.hxx"; then
RESIP_CPPFLAGS="-I$inc"
break
fi
done
for inc in $resip_lib_path; do
if test -f "$inc/libresip.so" || test -f "$inc/libresip.a"
then
RESIP_LDFLAGS="-L$inc"
break
fi
done
fi
dnl
dnl Simple add libresip and librutil, should be fixed in future
RESIP_LIBS="-ldum -lresip -lrutil -lares"
CPPFLAGS_SAVED="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $RESIP_CPPFLAGS $CFLAGS"
LDFLAGS_SAVED="$LDFLAGS"
LDFLAGS="$LDFLAGS $RESIP_LDFLAGS"
LIBS_SAVED="$LIBS"
LIBS="$RESIP_LIBS $LIBS"
AC_LANG_PUSH(C++)
AC_LINK_IFELSE(AC_LANG_PROGRAM([[ @%:@include <resip/stack/SipStack.hxx>
]],
[[
resip::SipStack stack(0, resip::DnsStub::EmptyNameserverList,0,false,0);
return 0;
]]),
[resip_found="yes"],
[resip_found="no"])
AC_LANG_POP([C++])
LDFLAGS="$LDFLAGS_SAVED"
CPPFLAGS="$CPPFLAGS_SAVED"
LIBS="$LIBS_SAVED"
if test "x$resip_found" = "xyes"; then
AC_DEFINE([HAVE_RESIPROCATE], [1],
[Define to 1 if RESIPROCATE library is available])
AC_SUBST(RESIP_CPPFLAGS)
AC_SUBST(RESIP_LDFLAGS)
AC_SUBST(RESIP_LIBS)
AC_MSG_RESULT([yes])
else
AC_MSG_ERROR([[Could not detect the Resiprocate libraries.]])
AC_MSG_RESULT([no])
fi
else
AC_MSG_RESULT([no])
fi
])

View File

@ -0,0 +1,68 @@
#!/usr/bin/perl
$uname = `uname -a`;
&section ("uname -a");
print "$uname \n";
$cc = `make show.CC`;
chop $cc;
$cc =~ s/.*=//g;
&exec("$cc --version");
$conf = `grep := build/Makefile.conf`;
&section("Makefile.conf");
print $conf."\n";
while ($conf =~ /([^ ]*) *:= *(.*)/g)
{
$name = $1;
$val = $2;
$name =~ s/[\r\n]//g;
$val =~ s/[\r\n]//g;
$conf{$name} = $val;
}
if ($conf{'USE_SSL'} eq 'yes')
{
if (length ($conf{SSL_LOCATION}))
{
&exec("${SSL_LOCATION}/apps/openssl version");
}
else
{
&exec("openssl version");
}
}
&exec ("svnversion");
if (-e 'ReleaseNotes.txt')
{
&exec ("head ReleaseNotes.txt");
}
if ($uname =~ /Darwin/i)
{
&exec ("sysctl -a hw");
}
elsif ($uname =~ /Linux/i)
{
&exec ("cat /proc/cpuinfo");
}
sub exec
{
my ($cmd) = shift;
&section($cmd);
print `$cmd`."\n";
}
sub section
{
my ($title) = shift;
my ($center) = int(36 - length($title)/2);
print (('='x$center)." $title ".('='x$center)."\n");
}

View File

@ -0,0 +1 @@
.DS_Store

View File

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

View File

@ -0,0 +1,509 @@
[ 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

@ -0,0 +1,628 @@
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

@ -0,0 +1,80 @@
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

@ -0,0 +1,365 @@
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

@ -0,0 +1,11 @@
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

@ -0,0 +1,84 @@
#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

@ -0,0 +1,35 @@
#!/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

@ -0,0 +1,26 @@
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

@ -0,0 +1,25 @@
#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

@ -0,0 +1,401 @@
/* -*- 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

@ -0,0 +1,255 @@
/* -*- 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

@ -0,0 +1,8 @@
#! /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

@ -0,0 +1,19 @@
# 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

@ -0,0 +1,16 @@
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

@ -0,0 +1,19 @@
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

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -0,0 +1,14 @@
# 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 "";
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,307 @@
/* -*- 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)
/* 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 */

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