- update README.txt + remove old outdated source code
This commit is contained in:
parent
028ce8b982
commit
94fea9d5a9
|
|
@ -0,0 +1,141 @@
|
|||
# RTPhone Platform
|
||||
|
||||
RTPhone is a comprehensive real-time communication (RTC) platform that provides a complete software stack for building VoIP/SIP-based communication applications. Developed by VoIP Objects (Sevana), RTPhone delivers production-ready voice communication capabilities with extensive codec support and cross-platform compatibility.
|
||||
|
||||
## Overview
|
||||
|
||||
RTPhone serves as a static library (`librtphone.a`) that can be integrated into larger telephony and communication systems. It provides a JSON-based command interface for easy integration and control, making it suitable for building softphones, PBX systems, WebRTC gateways, and carrier-grade voice solutions.
|
||||
|
||||
## Key Features
|
||||
|
||||
### Audio Codec Support
|
||||
RTPhone supports an extensive range of audio codecs:
|
||||
|
||||
**Standard Codecs:**
|
||||
- G.711 (A-law/¼-law)
|
||||
- G.722 (16kHz wideband)
|
||||
- G.729
|
||||
- GSM (Full Rate, Half Rate, Enhanced Full Rate)
|
||||
- iLBC (20ms/30ms)
|
||||
- ISAC (16kHz/32kHz)
|
||||
|
||||
**Advanced Codecs:**
|
||||
- AMR-NB/AMR-WB (Adaptive Multi-Rate Narrowband/Wideband) - please be aware - there is no patents for AMR codecs usage included ! You should acquire them on your own.
|
||||
- EVS (Enhanced Voice Services) - 3GPP's latest codec. Again - please be aware - there is no patents for EVS codec usage included ! You should acquire them on your own.
|
||||
- Opus - Modern low-latency codec
|
||||
- Speex (with acoustic echo cancellation)
|
||||
|
||||
**Codec Features:**
|
||||
- Bandwidth-efficient and octet-aligned modes
|
||||
- IuUP (Iu User Plane) protocol support for 3G networks
|
||||
- Dynamic codec switching
|
||||
- Packet loss concealment (PLC)
|
||||
- Comfort noise generation (CNG)
|
||||
|
||||
### Network & Protocol Support
|
||||
|
||||
**SIP Features:**
|
||||
- Full SIP 2.0 implementation via reSIProcate
|
||||
- Multiple transport protocols (UDP, TCP, TLS)
|
||||
- Registration, authentication, and session management
|
||||
- SIP MESSAGE, presence, and REFER support
|
||||
|
||||
**Media Transport:**
|
||||
- RTP/RTCP for media streaming
|
||||
- SRTP for secure media
|
||||
- ICE for NAT traversal with STUN/TURN support
|
||||
- WebRTC integration components
|
||||
- IPv4 and IPv6 support
|
||||
|
||||
### Cross-Platform Audio Support
|
||||
- DirectSound/WMME (Windows)
|
||||
- Core Audio (macOS/iOS)
|
||||
- ALSA/PulseAudio (Linux)
|
||||
- Oboe (Android) for low-latency audio
|
||||
- PortAudio fallback support
|
||||
|
||||
### Audio Quality Features
|
||||
- 48kHz sample rate support
|
||||
- Acoustic Echo Cancellation (AEC)
|
||||
- Audio resampling and format conversion
|
||||
- Multi-channel audio mixing
|
||||
- Perceptual Voice Quality Assessment (PVQA)
|
||||
|
||||
## Architecture
|
||||
|
||||
The platform is organized into several core modules:
|
||||
|
||||
- **Engine/Agent**: JSON-based command interface
|
||||
- **Engine/Endpoint**: SIP user agent implementation
|
||||
- **Engine/Media**: Audio codec management and processing
|
||||
- **Engine/Audio**: Cross-platform audio I/O handling
|
||||
- **Engine/Helper**: Utility functions (networking, logging, threading)
|
||||
|
||||
## Supported Platforms
|
||||
|
||||
- Linux (x64, ARM/Raspberry Pi)
|
||||
- Windows (32/64-bit)
|
||||
- macOS
|
||||
- Android (with Oboe integration)
|
||||
- iOS
|
||||
|
||||
## Building
|
||||
|
||||
RTPhone uses a CMake-based build system with cross-compilation support:
|
||||
|
||||
### Linux
|
||||
```bash
|
||||
python3 build_linux.py
|
||||
```
|
||||
|
||||
### Android
|
||||
```bash
|
||||
python3 build_android.py
|
||||
# or
|
||||
./build_android.sh
|
||||
```
|
||||
|
||||
### Dependencies
|
||||
- CMake 3.10+
|
||||
- OpenSSL 1.1+
|
||||
- Boost libraries
|
||||
- Platform-specific audio libraries
|
||||
|
||||
## Recent Updates
|
||||
|
||||
Recent development has focused on:
|
||||
- AMR codec parsing and decoding improvements
|
||||
- Octet-aligned mode fixes for AMR-WB
|
||||
- RTP SSRC handling enhancements
|
||||
- Build system optimizations
|
||||
- Code modernization to C++20
|
||||
|
||||
## Use Cases
|
||||
|
||||
RTPhone is good for building:
|
||||
- VoIP softphones and mobile applications
|
||||
- PBX and telephony server systems
|
||||
- RTP proxies
|
||||
- Carrier-grade voice communication platforms
|
||||
- 3GPP/IMS-compliant systems
|
||||
|
||||
## Security
|
||||
|
||||
RTPhone includes comprehensive security features:
|
||||
- OpenSSL 1.1 integration for encryption
|
||||
- TLS transport layer security
|
||||
- SRTP media encryption
|
||||
- Certificate management support
|
||||
|
||||
## Integration
|
||||
|
||||
The platform provides a developer-friendly interface with:
|
||||
- Event-driven architecture
|
||||
- Comprehensive logging system
|
||||
- Modern C++20 codebase
|
||||
|
||||
For detailed integration instructions and API documentation, please refer to the source code and header files in the `/src/engine/` directory.
|
||||
|
||||
## License
|
||||
|
||||
Our source code is licensed under the MIT license. Naturally, any third-party components we use are subject to their respective licenses.
|
||||
|
|
@ -1,321 +0,0 @@
|
|||
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})
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
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)
|
||||
|
||||
|
|
@ -1,350 +0,0 @@
|
|||
BUILD = build
|
||||
-include $(BUILD)/Makefile.conf
|
||||
-include $(BUILD)/Makefile.all
|
||||
-include $(BUILD)/Makefile.tools
|
||||
-include $(BUILD)/Makefile.osarch
|
||||
|
||||
DEFAULTS :=
|
||||
ifeq ($(BUILD_RECON), yes)
|
||||
DEFAULTS += dtls-srtp-openssl
|
||||
endif
|
||||
DEFAULTS += stack
|
||||
ifeq ($(BUILD_REPRO),yes)
|
||||
DEFAULTS += repro
|
||||
endif
|
||||
ifeq ($(BUILD_RECON),yes)
|
||||
DEFAULTS += recon
|
||||
endif
|
||||
ifeq ($(BUILD_RETURN_CLIENT),yes)
|
||||
DEFAULTS += return-client
|
||||
endif
|
||||
ifeq ($(BUILD_RETURN_SERVER),yes)
|
||||
DEFAULTS += return-server
|
||||
endif
|
||||
ifeq ($(BUILD_TFM),yes)
|
||||
DEFAULTS += tfm
|
||||
endif
|
||||
|
||||
default: $(DEFAULTS)
|
||||
#default: repro dum tests
|
||||
|
||||
stack: dum tests
|
||||
|
||||
all: repro dum tests tfm apps recon
|
||||
|
||||
tfm: tfmcontrib
|
||||
$(MAKE) -C tfm
|
||||
|
||||
contrib:
|
||||
|
||||
rutil: contrib
|
||||
$(MAKE) -C rutil
|
||||
|
||||
resiprocate: rutil
|
||||
$(MAKE) -C resip/stack
|
||||
|
||||
dum: resiprocate
|
||||
$(MAKE) -C resip/dum
|
||||
|
||||
b2bua: resiprocate
|
||||
$(MAKE) -C b2bua
|
||||
|
||||
repro: dum
|
||||
$(MAKE) -C repro
|
||||
|
||||
tests: resiprocate
|
||||
$(MAKE) -C rutil/test
|
||||
$(MAKE) -C resip/stack/test
|
||||
$(MAKE) -C resip/dum/test
|
||||
|
||||
check: tests
|
||||
cd resip/stack/test && ./runtests.sh
|
||||
cd rutil/test && ./runtests.sh
|
||||
|
||||
presSvr: resiprocate
|
||||
$(MAKE) -C presSvr
|
||||
|
||||
apps: dum
|
||||
$(MAKE) -C apps
|
||||
|
||||
return: return-server return-client
|
||||
|
||||
reTurn: return
|
||||
|
||||
reTURN: return
|
||||
|
||||
return-server: rutil
|
||||
$(MAKE) -C reTurn
|
||||
|
||||
return-client: rutil
|
||||
$(MAKE) -C reTurn/client
|
||||
$(MAKE) -C reTurn/client/test
|
||||
|
||||
recon: dum reflow
|
||||
$(MAKE) -C resip/recon
|
||||
$(MAKE) -C resip/recon/test
|
||||
|
||||
reflow: dtls-srtp-openssl return-client srtp
|
||||
$(MAKE) -C reflow
|
||||
|
||||
ifeq (${BUILD_SHARED_LIBS},no)
|
||||
NETXX_USE_SHARED_LIBS=--disable-shared
|
||||
CPPUNIT_USE_SHARED_LIBS=--enable-shared=false
|
||||
endif
|
||||
|
||||
configure_netxx: tfm/contrib/Netxx-0.3.2/Makefile
|
||||
|
||||
tfm/contrib/Netxx-0.3.2/Makefile:
|
||||
cd tfm/contrib/Netxx-0.3.2 && CXX="$(CXX)" CXXFLAGS='$(CXXFLAGS)' perl configure.pl --contrib --disable-examples ${NETXX_USE_SHARED_LIBS}
|
||||
|
||||
ifeq ($(OSTYPE),MinGW)
|
||||
netxx:
|
||||
$(MAKE) -C tfm/contrib/Netxx-0.3.2 -f Makefile.MinGW
|
||||
else
|
||||
netxx: configure_netxx
|
||||
$(MAKE) -C tfm/contrib/Netxx-0.3.2
|
||||
endif
|
||||
|
||||
configure_cppunit: tfm/contrib/cppunit/Makefile
|
||||
|
||||
tfm/contrib/cppunit/Makefile:
|
||||
cd tfm/contrib/cppunit && CC="$(CC)" CFLAGS='$(CFLAGS)' CXX="$(CXX)" CXXFLAGS='$(CXXFLAGS)' ./configure ${CPPUNIT_USE_SHARED_LIBS} ${CONFIGURE_ARGS} --disable-doxygen
|
||||
|
||||
cppunit: configure_cppunit
|
||||
$(MAKE) -C tfm/contrib/cppunit/src/cppunit libcppunit.la
|
||||
|
||||
contrib/srtp/Makefile:
|
||||
cd contrib/srtp && ./configure ${CONFIGURE_ARGS}
|
||||
|
||||
configure_srtp: contrib/srtp/Makefile
|
||||
|
||||
srtp: configure_srtp
|
||||
$(MAKE) -C contrib/srtp
|
||||
|
||||
ifneq ($(SSL_LOCATION),)
|
||||
$(SSL_LOCATION)/Makefile:
|
||||
cd $(SSL_LOCATION) && ./Configure linux-generic32 --openssldir=/usr enable-tlsext ${CONFIGURE_ARGS} && $(MAKE) depend
|
||||
|
||||
configure_dtls-srtp-openssl: $(SSL_LOCATION)/Makefile
|
||||
|
||||
dtls-srtp-openssl: configure_dtls-srtp-openssl
|
||||
$(MAKE) -C $(SSL_LOCATION)
|
||||
else
|
||||
dtls-srtp-openssl:
|
||||
endif
|
||||
|
||||
tfmcontrib: cppunit netxx
|
||||
|
||||
###########################################################################
|
||||
# Resiprocate Custom ares rules
|
||||
|
||||
ifeq ($(DNS_RESOLVER),resip-ares)
|
||||
|
||||
ifeq (${USE_IPV6},yes)
|
||||
ARES_IPV6=--with-ipv6
|
||||
endif
|
||||
|
||||
ifeq (${ARES_PREFIX},)
|
||||
ARES_PREFIX_ARG=
|
||||
else
|
||||
ARES_PREFIX_ARG=--prefix=${ARES_PREFIX}
|
||||
endif
|
||||
|
||||
contrib/ares-build.$(OS_ARCH)/Makefile:
|
||||
mkdir -p contrib/ares-build.$(OS_ARCH)
|
||||
cd contrib/ares-build.$(OS_ARCH) && \
|
||||
../ares/configure ${ARES_IPV6} ${ARES_PREFIX_ARG} ${CONFIGURE_ARGS}
|
||||
|
||||
configure_ares: contrib/ares-build.$(OS_ARCH)/Makefile
|
||||
|
||||
ares: configure_ares
|
||||
$(MAKE) -C contrib/ares-build.$(OS_ARCH)
|
||||
|
||||
contrib: ares
|
||||
|
||||
install-ares:
|
||||
$(MAKE) -C contrib/ares-build.$(OS_ARCH) install
|
||||
|
||||
else
|
||||
# Dummy rules to use when resip-ares is not being used
|
||||
install-ares:
|
||||
endif
|
||||
|
||||
clean-ares:
|
||||
-rm -Rf contrib/ares-build.*
|
||||
|
||||
###########################################################################
|
||||
# Various clean targets
|
||||
CLEANDIRS := resip/stack resip/dum resip/dum/test resip/stack/test presSvr \
|
||||
repro rutil rutil/test tfm apps reTurn reTurn/client \
|
||||
reTurn/client/test p2p p2p/s2c/s2c reflow resip/recon resip/recon/test
|
||||
|
||||
|
||||
cleancontrib: clean-ares
|
||||
-$(MAKE) -C tfm/contrib/cppunit distclean
|
||||
-$(MAKE) -C tfm/contrib/Netxx-0.3.2 realclean
|
||||
find tfm/contrib/Netxx-0.3.2 -name 'Netxx-config' -exec rm -f '{}' \;
|
||||
-$(MAKE) -C contrib/srtp superclean
|
||||
-$(MAKE) -C contrib/srtp/crypto superclean
|
||||
-$(MAKE) -C contrib/srtp/doc superclean
|
||||
-$(MAKE) -C contrib/openssl clean
|
||||
|
||||
clean: cleanpkg
|
||||
for dir in $(CLEANDIRS); do $(MAKE) -C $$dir clean; done ; true
|
||||
|
||||
cleanall: cleancontrib
|
||||
for dir in $(CLEANDIRS); do $(MAKE) -C $$dir cleanall; done ; true
|
||||
|
||||
superclean: cleancontrib cleanpkg
|
||||
for dir in $(CLEANDIRS); do $(MAKE) -C $$dir distclean; done ; true
|
||||
find * -name '*.db' -exec rm -f '{}' \;
|
||||
-rm -Rf .make_prefs
|
||||
-rm -f SVN-VERSION
|
||||
-rm -Rf lib.*.*
|
||||
|
||||
distclean: superclean
|
||||
-rm -Rf build/Makefile.conf
|
||||
|
||||
###########################################################################
|
||||
install: install-ares install-rutil install-resip install-dum
|
||||
|
||||
install-rutil:
|
||||
$(MAKE) -C rutil install
|
||||
|
||||
install-resip:
|
||||
$(MAKE) -C resip/stack install
|
||||
|
||||
install-dum:
|
||||
$(MAKE) -C resip/dum install
|
||||
|
||||
install-repro:
|
||||
$(MAKE) -C repro install
|
||||
|
||||
install-recon: install install-reflow install-returnclient
|
||||
$(MAKE) -C resip/recon install
|
||||
|
||||
install-reflow:
|
||||
$(MAKE) -C reflow install
|
||||
|
||||
install-returnclient:
|
||||
$(MAKE) -C reTurn/client install
|
||||
|
||||
SVN-VERSION:
|
||||
@if test -d .svn ; \
|
||||
then \
|
||||
echo "Generating SVN-VERSION from svnversion"; \
|
||||
svnversion . \
|
||||
| perl -p \
|
||||
-e 'm /(\d+)/ && do { $$padded=sprintf( "%06d", $$1 ); s/\d+/$$padded/; };' \
|
||||
-e 's/:/./; s/M/.M/;' \
|
||||
> SVN-VERSION ; \
|
||||
elif test -r SVN-EXPORT-VERSION ; \
|
||||
then \
|
||||
echo "Copying SVN-VERSION from SVN-EXPORT-VERSION"; \
|
||||
cp SVN-EXPORT-VERSION SVN-VERSION ; \
|
||||
else \
|
||||
echo "Unknown SVN-VERSION"; \
|
||||
echo '0' > SVN-VERSION ; \
|
||||
fi
|
||||
@echo -n "SVN-VERSION=" ; cat SVN-VERSION; echo ""
|
||||
|
||||
REPRO_VERSION = $(shell cat repro/VERSION)
|
||||
|
||||
RPMBUILD_TOPDIR = $(shell pwd)/rpm
|
||||
repro-rpm: repro-dist rpmbuild-area
|
||||
rpmbuild -ta \
|
||||
--define="buildno $(shell cat SVN-VERSION)" \
|
||||
--define="_topdir $(RPMBUILD_TOPDIR)" \
|
||||
repro-$(REPRO_VERSION).tar.gz
|
||||
ls -l $(RPMBUILD_TOPDIR)/SRPMS/repro-$(REPRO_VERSION)-*.rpm
|
||||
ls -l $(RPMBUILD_TOPDIR)/RPMS/*/repro*-$(REPRO_VERSION)-*.rpm
|
||||
|
||||
RPMBUILD_SUBDIRS = BUILD RPMS SOURCES SPECS SRPMS
|
||||
rpmbuild-area: $(foreach subdir,$(RPMBUILD_SUBDIRS),$(RPMBUILD_TOPDIR)/$(subdir))
|
||||
|
||||
$(RPMBUILD_TOPDIR) :
|
||||
test -d $(RPMBUILD_TOPDIR) || mkdir $(RPMBUILD_TOPDIR)
|
||||
|
||||
$(foreach subdir,$(RPMBUILD_SUBDIRS),$(RPMBUILD_TOPDIR)/$(subdir)) : $(RPMBUILD_TOPDIR)
|
||||
test -d $@ || mkdir $@
|
||||
|
||||
repro-dist: cleanpkg repro-$(REPRO_VERSION).tar.gz repro-$(REPRO_VERSION).tar.gz.md5
|
||||
|
||||
tmptarfile=/tmp/repro.tar.gz.$$
|
||||
repro-$(REPRO_VERSION).tar.gz: SVN-VERSION repro.spec
|
||||
rm -f repro-$(REPRO_VERSION)
|
||||
ln -s . repro-$(REPRO_VERSION)
|
||||
find repro-$(REPRO_VERSION)/ \( -name .svn -prune -o -type f -print0 \) \
|
||||
| tar -c -f $(tmptarfile) -z --null -h -T -
|
||||
mv $(tmptarfile) $@
|
||||
rm -f repro-$(REPRO_VERSION)
|
||||
|
||||
repro-$(REPRO_VERSION).tar.gz.md5: repro-$(REPRO_VERSION).tar.gz
|
||||
md5sum repro-$(REPRO_VERSION).tar.gz > repro-$(REPRO_VERSION).tar.gz.md5
|
||||
|
||||
repro.spec: repro/repro.spec
|
||||
$(MAKE) -C repro repro.spec.inst
|
||||
mv repro/repro.spec.inst repro.spec
|
||||
|
||||
cleanpkg:
|
||||
rm -f repro-*.tar.gz repro-*.tar.gz.md5 repro-*.rpm
|
||||
rm -rf rpm repro-$(REPRO_VERSION)
|
||||
|
||||
# If the make configuration isn't there, create a default one.
|
||||
$(BUILD)/Makefile.conf:
|
||||
./configure -y
|
||||
|
||||
.PHONY: resiprocate tests contrib ares srtp dtls-srtp-openssl
|
||||
.PHONY: install install-ares install-rutil install-resip install-repro install-dum install-reflow install-returnclient install-recon
|
||||
.PHONY: SVN-VERSION repro-rpm repro-dist cleanpkg rpmbuild-area
|
||||
.PHONY: repro dum tests tfm tfmcontrib contrib rutil check presSvr
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# The Vovida Software License, Version 1.0
|
||||
# Copyright (c) 2000-2007 Vovida Networks, Inc. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
#
|
||||
# 3. The names "VOCAL", "Vovida Open Communication Application Library",
|
||||
# and "Vovida Open Communication Application Library (VOCAL)" must
|
||||
# not be used to endorse or promote products derived from this
|
||||
# software without prior written permission. For written
|
||||
# permission, please contact vocal@vovida.org.
|
||||
#
|
||||
# 4. Products derived from this software may not be called "VOCAL", nor
|
||||
# may "VOCAL" appear in their name, without prior written
|
||||
# permission of Vovida Networks, Inc.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
|
||||
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
|
||||
# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
|
||||
# NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
|
||||
# IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||
# DAMAGE.
|
||||
#
|
||||
# ====================================================================
|
||||
#
|
||||
# This software consists of voluntary contributions made by Vovida
|
||||
# Networks, Inc. and many individuals on behalf of Vovida Networks,
|
||||
# Inc. For more information on Vovida Networks, Inc., please see
|
||||
# <http://www.vovida.org/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
|
@ -1,88 +0,0 @@
|
|||
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
|
||||
|
||||
|
||||
|
|
@ -1,104 +0,0 @@
|
|||
= Release Notes v 1.6 =
|
||||
|
||||
==General==
|
||||
===New features===
|
||||
* new clicktocall project
|
||||
* new ichat to SIP gateway project
|
||||
* adding Tarasenko Volodymyr's autotools macro for use in external projects
|
||||
|
||||
==Build system==
|
||||
===New features===
|
||||
* auto-detect c-ares headers/libs, both for in-place builds, and installed headers
|
||||
* added VS2010 project files
|
||||
|
||||
===Bug fixes===
|
||||
* added missing LEAK_CHECK defines to windows DEBUG builds of dum, resiprocate and rutil
|
||||
* if popt is in a default location, don't include it with -I and -L
|
||||
* added missing AresCompat.hxx (in rutil VS 9.0 project file)
|
||||
|
||||
==rutil==
|
||||
===New features===
|
||||
* added ParseBuffer::skipBackToOneOf()
|
||||
* added ability to createLocalLogger instances, and assign these instances to threads (Thanks to Alexander Chemeris)
|
||||
|
||||
===Bug fixes===
|
||||
* remove spurious boost include
|
||||
* override std::exception::what() in BaseException, so we actually get a usable error if we don't catch one
|
||||
* stop asserting if we get an empty DNS response, and implemented handling code for this case
|
||||
|
||||
==stack==
|
||||
===New features===
|
||||
* define Remote-Party-Id header as a multi header
|
||||
* change from Gregor Jasny to be tolerant of rtpmap lines missing the rate parameter
|
||||
* new generic DigestStream class for any openSSL digest
|
||||
* change to allow XMLCursor to parse an XML document with no prolog
|
||||
* change to SDP parser to be tolerant of whitespace following the codec id on the m line
|
||||
* added Uri::getAorNoReally() which actually returns the AoR as defined by RFC 3261
|
||||
* send 503 to TU instead of 408 if DNS times out
|
||||
* better reason phrases when timeouts occur
|
||||
* changes to resip stack to allow passing a port of 0 into addTransport interface to allow OS to choose an appropriate port number
|
||||
|
||||
===Bug fixes===
|
||||
* some fixes to the sigcomp code
|
||||
* fixing a few params to be quoted-string instead of non-quoted data (vendor, model, and version)
|
||||
* don't call encode twice on bodies (major inefficiency, but didn't really result in bad behavior)
|
||||
* replace a couple of static objects with member objects, so we don't have problems with multiple SipStacks in the same process
|
||||
* close connected-UDP sockets (used by TransportSelector to query the routing table when we haven't explicitly specified what interface we want to use when sending) on teardown; allows a single process to create and destroy SipStacks repeatedly without leaking fds (mainly for unit-tests)
|
||||
* stop sitting around on our thumbs for 200ms when DNS processing needs to be done
|
||||
* removed incorrect Q value compare fn in Uri class - q-value is a contact/name-addr parameter, not a uri parameter
|
||||
* fix issue with logging errno after SSL_ERROR_SYSCALL in TlsConnection
|
||||
* moved various fn local static variables to file level static variables to avoid multi-threaded first call runtime race conditions with initializing local static variables
|
||||
|
||||
==DUM==
|
||||
===New features===
|
||||
* patch from Chris Brody so that the tests will build if not using POPT
|
||||
* added "invariant" reason code from 3265bis00 (for subscriptions)
|
||||
* change optional RWMutex parameter to Lockable base type in dum::process to allow other types of Mutex's to be passed in
|
||||
|
||||
===Bug fixes===
|
||||
* fix bug where wrong terminated reason is sent in callback when receiving a CANCEL
|
||||
* ClientInviteSession changes to react appropriately to reception of UPDATE messages before connected state
|
||||
* always allow reject to be called after onOffer - adding case where offer comes in 2xx response after invite with no sdp - ACK 200, then BYE session
|
||||
* fix to UAC handling to be able to handle sending ACK then BYE when a CANCEL request crosses a 200/Inv. This fix handles the case when we don't have any formed dialogs at the time of cancel
|
||||
* fixed bug where DialogSet::ifMatch() would not work for resubscribes
|
||||
* don't tear down server subscriptions when the app sends an error response that implies either an optional retry-after, or implies application-dependent behavior
|
||||
* fixed RedirectManager Q-Value ordering function - it was looking for q-value as a uri parameter - also changed to treat no q-value as q=1.0
|
||||
* ensure auth headers are cleared out before retrying client registration
|
||||
* fixing a bug with Glare timers if we placed the call (UAC) - they were not being properly dispatched to InviteSession
|
||||
* use supported mimetype for subscriptions in NOTIFY messages instead of SUBSCRIBE messages
|
||||
* stop using UPDATE for confirmed dialogs, since it is recommended against in RFC 3311
|
||||
* fixed a bug in client subscription if AppDialogSet's are used, and a retry is attempted
|
||||
* fixed a ClientSubscription bug when retrying - not reusing profile used in original subscription setup
|
||||
* fixed a difficult to find, and long standing memory leak bug in ClientSubscriptions
|
||||
* added handling to ClientRegistration for strange border case where registrar returns an Expires header of 0 after attempting to register
|
||||
|
||||
==repro==
|
||||
===New features===
|
||||
* some logging improvements
|
||||
* better description of defaults for command-line options
|
||||
* modification to repro so that contacts without a q-value are treated as having q=1.0
|
||||
* changes to repro to allow Registration, and Publish/Subscribe forwarding to other domains
|
||||
|
||||
===Bug fixes===
|
||||
* actual Proxy-Require support (yeah, yeah, about time, I know)
|
||||
* reject requests with a garbage next-hop Route header immediately, instead of having the stack complain when we try to forward
|
||||
* various bugfixes related to outbound
|
||||
* ignore user-part of topmost Route header if it doesn't parse as a flow-token
|
||||
|
||||
==reTurn==
|
||||
===New features===
|
||||
* pad the content of the SOFTWARE header so that we are on a 4 byte boundary for size (prevents STUN messages from reTurn showing up in Wireshark as malformed packets)
|
||||
|
||||
===Bug fixes===
|
||||
* fix a couple of spots where we try to erase from mActiveRequestMap using an invalidated iterator
|
||||
* fixed a bug in processTurnAllocateRequest that led to reTurnServer giving "unauthorized" errors
|
||||
|
||||
==recon==
|
||||
|
||||
===Bug fixes===
|
||||
* recon memory leak fixes - thanks to Julio Cabezas
|
||||
* update to recon VS2008/2005/2003 solution files for sipXtapi rev 11413 with speex update
|
||||
* allow recon to properly reject media lines with unknown media types and protocols
|
||||
* fixup sdp direction attribute in our offers in scenarios where we are being held by the other party
|
||||
* fix UserProfile selection when receiving refer with no subscription
|
||||
* make sure our ReferTo header doesn't have tags in it
|
||||
|
|
@ -1,175 +0,0 @@
|
|||
#
|
||||
# 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
|
||||
])
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
|
||||
#ifndef __AccountingManager_h
|
||||
#define __AccountingManager_h
|
||||
|
||||
|
||||
#include "rutil/Data.h"
|
||||
|
||||
namespace b2bua
|
||||
{
|
||||
|
||||
class AccountingManager {
|
||||
|
||||
public:
|
||||
// Call has entered system
|
||||
virtual void onCallStart() = 0;
|
||||
// Call has been authorised
|
||||
virtual void onCallAuthorise() = 0;
|
||||
// Call has connected
|
||||
virtual void onCallConnect() = 0;
|
||||
// A route has failed
|
||||
virtual void onCallRouteFail() = 0;
|
||||
// All routes have been tried and failed, or the call was not authorised
|
||||
virtual void onCallFail() = 0;
|
||||
// The call connected and completed successfully
|
||||
virtual void onCallFinish() = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* ====================================================================
|
||||
*
|
||||
* Copyright 2012 Daniel Pocock. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. Neither the name of the author(s) nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
|
||||
#include "AuthenticationManager.hxx"
|
||||
|
||||
using namespace b2bua;
|
||||
|
||||
AuthenticationManager::SecretListener::~SecretListener() {
|
||||
}
|
||||
|
||||
/* ====================================================================
|
||||
*
|
||||
* Copyright 2012 Daniel Pocock. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. Neither the name of the author(s) nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
|
||||
#ifndef __AuthenticationManager_h
|
||||
#define __AuthenticationManager_h
|
||||
|
||||
#include "rutil/Data.hxx"
|
||||
|
||||
namespace b2bua
|
||||
{
|
||||
|
||||
class AuthenticationManager {
|
||||
|
||||
// const resip::Data& realm;
|
||||
// const resip::Data& user;
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* The application should implement SecretListener to receive callbacks
|
||||
* when authentication is complete.
|
||||
*/
|
||||
class SecretListener {
|
||||
public:
|
||||
virtual ~SecretListener();
|
||||
// Called when the secret is found successfully
|
||||
virtual void onSuccess(const resip::Data& realm, const resip::Data& user, const resip::Data& secret) = 0;
|
||||
// Called when the user ID is not recognised
|
||||
virtual void onUserUnknown(const resip::Data& realm, const resip::Data& user) = 0;
|
||||
// Called when an internal failure or timeout occurs
|
||||
virtual void onFailure(const resip::Data& realm, const resip::Data& user) = 0;
|
||||
};
|
||||
|
||||
virtual ~AuthenticationManager() {};
|
||||
|
||||
virtual void getSecret(const resip::Data& realm, const resip::Data& user, AuthenticationManager::SecretListener *secretListener) = 0;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* ====================================================================
|
||||
*
|
||||
* Copyright 2012 Daniel Pocock. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. Neither the name of the author(s) nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -1,92 +0,0 @@
|
|||
|
||||
#ifndef __AuthorizationManager_h
|
||||
#define __AuthorizationManager_h
|
||||
|
||||
#include "rutil/Data.hxx"
|
||||
|
||||
#include "CallHandle.hxx"
|
||||
|
||||
namespace b2bua
|
||||
{
|
||||
|
||||
class AuthorizationManager {
|
||||
|
||||
public:
|
||||
|
||||
typedef enum DenialReason {
|
||||
AuthenticationRequired, // A username is required
|
||||
PeerUnknown, // IP or username unrecognised by
|
||||
// the AuthorizationManager
|
||||
InsufficientFunds, // Deposit more funds
|
||||
Unspecified, // Request denied for an unspecified
|
||||
// reason (e.g. account suspended),
|
||||
// but not due to error
|
||||
DestinationIncomplete, // Number is too short
|
||||
DestinationInvalid, // Unrecognised destination prefix
|
||||
// or name
|
||||
InvalidRequest, // Some other aspect of the request
|
||||
// is invalid
|
||||
NetworkError, // An error occurred communicating
|
||||
// with a remote auth server
|
||||
Timeout, // A timeout occurred
|
||||
GeneralError // An error while processing
|
||||
};
|
||||
|
||||
class AuthorizationListener {
|
||||
public:
|
||||
virtual ~AuthorizationListener() {};
|
||||
// Call is authorized
|
||||
virtual void onSuccess() = 0;
|
||||
// Call is denied
|
||||
virtual void onDeny(AuthorizationManager::DenialReason reason) = 0;
|
||||
};
|
||||
|
||||
//virtual void getAuthorization();
|
||||
|
||||
virtual ~AuthorizationManager() {};
|
||||
|
||||
virtual CallHandle *authorizeCall(const resip::NameAddr& sourceAddr, const resip::Uri& destinationAddr, const resip::Data& authRealm, const resip::Data& authUser, const resip::Data& authPass, const resip::Data& srcIp, const resip::Data& contextId, const resip::Data& accountId, const resip::Data& baseIp, const resip::Data& controlId, time_t startTime) = 0;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* ====================================================================
|
||||
*
|
||||
* Copyright 2012 Daniel Pocock. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. Neither the name of the author(s) nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,308 +0,0 @@
|
|||
|
||||
#ifndef __B2BCall_h
|
||||
#define __B2BCall_h
|
||||
|
||||
/* B2BCall models a bridged call between a caller and a callee
|
||||
*/
|
||||
|
||||
#include "rutil/Data.hxx"
|
||||
#include "resip/dum/DialogUsageManager.hxx"
|
||||
|
||||
namespace b2bua
|
||||
{
|
||||
|
||||
class B2BCall;
|
||||
class MyDialogSetHandler;
|
||||
|
||||
}
|
||||
|
||||
#include "AuthorizationManager.hxx"
|
||||
#include "CallHandle.hxx"
|
||||
#include "CDRHandler.hxx"
|
||||
#include "MediaManager.hxx"
|
||||
#include "MyAppDialog.hxx"
|
||||
|
||||
|
||||
namespace b2bua
|
||||
{
|
||||
|
||||
class B2BCall {
|
||||
|
||||
protected:
|
||||
|
||||
typedef enum B2BCallState {
|
||||
NewCall = 0, // just started
|
||||
CallerCancel, // CANCEL received from A leg
|
||||
AuthorizationPending,
|
||||
AuthorizationSuccess,
|
||||
AuthorizationFail,
|
||||
// RoutesPending, // routes requested
|
||||
// RoutesSuccess,
|
||||
// RoutesFail,
|
||||
// MediaProxyPending, // Media Proxy requested
|
||||
MediaProxySuccess,
|
||||
MediaProxyFail,
|
||||
ReadyToDial, // Route ready
|
||||
DialInProgress, // INVITE sent
|
||||
DialFailed, // Network error, e.g. ICMP
|
||||
DialRejected, // SIP error received
|
||||
// error code in data member
|
||||
// failureStatusCode
|
||||
SelectAlternateRoute, // Need to select another
|
||||
// route
|
||||
DialAborted, // No other carriers
|
||||
// available, or a failure
|
||||
// that doesn't require us
|
||||
// to try another carrier
|
||||
// e.g. Busy
|
||||
// DialReceived100, // 100 response received
|
||||
DialReceived180, // 180 response received
|
||||
// DialReceived183, // 183 response received
|
||||
DialReceivedEarlyAnswer, // early answer (SDP) received
|
||||
// DialEarlyMediaProxyRequested, // Media proxy requested for
|
||||
// early media
|
||||
DialEarlyMediaProxySuccess, // Media Proxy ready
|
||||
DialEarlyMediaProxyFail, // Media Proxy failed
|
||||
CallAccepted, // 200 received
|
||||
// CallAcceptedMediaProxyRequested, // Media proxy requested for
|
||||
// media
|
||||
CallAcceptedMediaProxySuccess, // Media Proxy ready
|
||||
CallAcceptedMediaProxyFail, // Media proxy failed
|
||||
CallActive, // Call in progress
|
||||
CallerHangup, // Caller has hungup
|
||||
CalleeHangup, // Callee has hungup
|
||||
LocalHangup, // B2BUA initiated hangup
|
||||
CallStop, // Call is stopped
|
||||
// CallStopMediaProxyNotified, // Media proxy informed
|
||||
CallStopMediaProxySuccess, // Media proxy acknowledged
|
||||
CallStopMediaProxyFail, // Media proxy failed to ack
|
||||
CallStopFinal // Call can be purged from
|
||||
// the system
|
||||
};
|
||||
|
||||
static resip::Data callStateNames[];
|
||||
|
||||
typedef enum BasicClearingReason {
|
||||
NoAnswer = 0, // caller gave up/timeout
|
||||
Busy, // callee indicated busy
|
||||
Congestion, // callee indicated congestion
|
||||
Error, // callee indicated error
|
||||
Answered // call was answered
|
||||
};
|
||||
|
||||
static const char *basicClearingReasonName[];
|
||||
|
||||
typedef enum FullClearingReason {
|
||||
Unset,
|
||||
|
||||
// No attempted
|
||||
InvalidDestination,
|
||||
AuthError,
|
||||
|
||||
// not answered
|
||||
NoAnswerCancel,
|
||||
NoAnswerTimeout,
|
||||
NoAnswerError, // media negotiation failed
|
||||
|
||||
// Rejected
|
||||
RejectBusy,
|
||||
RejectOther, // rejectOtherCode = SIP error code
|
||||
|
||||
// Answered
|
||||
AnsweredALegHangup, // A leg hangup first
|
||||
AnsweredBLegHangup, // B leg hangup first
|
||||
AnsweredLimit, // reached limit
|
||||
AnsweredShutdown, // Answered, B2BUA shutdown
|
||||
AnsweredError, // An error occured, e.g. during a re-INVITE
|
||||
AnsweredNoMedia, // Media stopped
|
||||
AnsweredUnknown // Answered, hangup for unknown reason
|
||||
};
|
||||
|
||||
CDRHandler& cdrHandler;
|
||||
resip::DialogUsageManager& dum;
|
||||
//CallController *callController;
|
||||
AuthorizationManager& authorizationManager;
|
||||
|
||||
//static std::list<B2BCall *> calls;
|
||||
|
||||
// Attributes of the call, from the original INVITE
|
||||
resip::NameAddr sourceAddr;
|
||||
resip::Uri destinationAddr;
|
||||
resip::Data authRealm;
|
||||
resip::Data authUser;
|
||||
resip::Data authPassword;
|
||||
resip::Data srcIp;
|
||||
resip::Data contextId;
|
||||
resip::Data accountId;
|
||||
resip::Data baseIp;
|
||||
resip::Data controlId;
|
||||
|
||||
//int callState;
|
||||
|
||||
B2BCallState callState;
|
||||
|
||||
BasicClearingReason basicClearingReason;
|
||||
FullClearingReason fullClearingReason;
|
||||
int rejectOtherCode;
|
||||
|
||||
// Call time information
|
||||
time_t startTime;
|
||||
time_t connectTime;
|
||||
time_t finishTime;
|
||||
|
||||
// CallHandle from CallController
|
||||
CallHandle *callHandle;
|
||||
std::list<CallRoute *>::iterator callRoute;
|
||||
resip::Data appRef1;
|
||||
resip::Data appRef2;
|
||||
|
||||
// If we are waiting for something, this is the timeout
|
||||
time_t timeout;
|
||||
|
||||
MyAppDialog *aLegAppDialog;
|
||||
MyAppDialog *bLegAppDialog;
|
||||
MyAppDialogSet *bLegAppDialogSet;
|
||||
//resip::SdpContents *aLegSdp; // most recent offer from A leg
|
||||
//resip::SdpContents *bLegSdp; // most recent offer from B leg
|
||||
bool earlyAnswerSent;
|
||||
MediaManager *mediaManager;
|
||||
// resip::SharedPtr<resip::UserProfile> outboundUserProfile;
|
||||
|
||||
int failureStatusCode;
|
||||
resip::Data *failureReason;
|
||||
|
||||
// Returns true if successful, false if new state is not
|
||||
// permitted
|
||||
bool setCallState(B2BCallState newCallState);
|
||||
bool isCallStatePermitted(B2BCallState newCallState);
|
||||
const resip::Data& getCallStateName(B2BCallState s);
|
||||
|
||||
void setALegSdp(const resip::SdpContents& sdp, const in_addr_t& msgSourceAddress);
|
||||
void setBLegSdp(const resip::SdpContents& sdp, const in_addr_t& msgSourceAddress);
|
||||
|
||||
void doNewCall();
|
||||
void doCallerCancel();
|
||||
void doAuthorizationPending();
|
||||
void doAuthorizationSuccess();
|
||||
void doAuthorizationFail();
|
||||
void doMediaProxySuccess();
|
||||
void doMediaProxyFail();
|
||||
void doReadyToDial();
|
||||
void doDialFailed();
|
||||
void doDialRejected();
|
||||
void doSelectAlternateRoute();
|
||||
void doDialAborted();
|
||||
//void doDialReceived100();
|
||||
void doDialReceived180();
|
||||
//void doCallDial183();
|
||||
void doDialReceivedEarlyAnswer();
|
||||
void doDialEarlyMediaProxySuccess();
|
||||
void doDialEarlyMediaProxyFail();
|
||||
void doCallAccepted();
|
||||
void doCallAcceptedMediaProxySuccess();
|
||||
void doCallAcceptedMediaProxyFail();
|
||||
void doCallActive();
|
||||
void doHangup();
|
||||
void doCallStop();
|
||||
void doCallStopMediaProxySuccess();
|
||||
void doCallStopMediaProxyFail();
|
||||
void doCallStopFinal();
|
||||
|
||||
// sets the clearing reason codes if necessary
|
||||
void setClearingReason(FullClearingReason reason, int code);
|
||||
void setClearingReasonMediaFail();
|
||||
|
||||
void writeCDR();
|
||||
|
||||
public:
|
||||
|
||||
// More basic then B2BCallState, used for reporting
|
||||
typedef enum CallStatus {
|
||||
PreDial, // the call hasn't started dialing
|
||||
Dialing, // the call is dialing
|
||||
Connected, // the call has connected
|
||||
Finishing, // the call has been hung up
|
||||
Unknown // unknown
|
||||
};
|
||||
|
||||
void checkProgress(time_t now, bool stopping);
|
||||
bool isComplete();
|
||||
|
||||
CallStatus getStatus();
|
||||
|
||||
//static void setDum(resip::DialogUsageManager *dum);
|
||||
//static void setCallController(CallController *callController);
|
||||
|
||||
// B2BCall(MyAppDialog *aLegDialog);
|
||||
B2BCall(CDRHandler& cdrHandler, resip::DialogUsageManager& dum, AuthorizationManager& authorizationManager, MyAppDialog *aLegDialog, const resip::NameAddr& sourceAddr, const resip::Uri& destinationAddr, const resip::Data& authRealm, const resip::Data& authUser, const resip::Data& authPassword, const resip::Data& srcIp, const resip::Data& contextId, const resip::Data& accountId, const resip::Data& baseIp, const resip::Data& controlId);
|
||||
virtual ~B2BCall();
|
||||
|
||||
void setBLegAppDialog(MyAppDialog *myAppDialog);
|
||||
|
||||
// called every time we go through the main program loop
|
||||
//static void checkCalls();
|
||||
|
||||
// For InviteSessionHandler
|
||||
//void onTrying();
|
||||
void onRinging();
|
||||
//void onSessionProgress();
|
||||
void onEarlyMedia(const resip::SdpContents& sdp, const in_addr_t& msgSourceAddress);
|
||||
void onCancel();
|
||||
void onFailure(MyAppDialog *myAppDialog);
|
||||
void onRejected(int statusCode, const resip::Data& reason);
|
||||
void onOffer(MyAppDialog *myAppDialog, const resip::SdpContents& sdp, const in_addr_t& msgSourceAddress);
|
||||
void onAnswer(MyAppDialog *myAppDialog, const resip::SdpContents& sdp, const in_addr_t& msgSourceAddress);
|
||||
void onMediaTimeout();
|
||||
void onHangup(MyAppDialog *myAppDialog);
|
||||
|
||||
// For B2BCallManager
|
||||
void onStopping();
|
||||
|
||||
void releaseAppDialog(MyAppDialog *myAppDialog);
|
||||
void releaseAppDialogSet(MyAppDialogSet *myAppDialogSet);
|
||||
|
||||
friend class MyDialogSetHandler;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* ====================================================================
|
||||
*
|
||||
* Copyright 2012 Daniel Pocock. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. Neither the name of the author(s) nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -1,135 +0,0 @@
|
|||
|
||||
|
||||
#include <syslog.h>
|
||||
|
||||
#include "B2BCallManager.hxx"
|
||||
#include "Logging.hxx"
|
||||
|
||||
using namespace b2bua;
|
||||
using namespace resip;
|
||||
using namespace std;
|
||||
|
||||
B2BCallManager::B2BCallManager(resip::DialogUsageManager& dum, AuthorizationManager *authorizationManager, CDRHandler& cdrHandler) : dum(dum), authorizationManager(authorizationManager), cdrHandler(cdrHandler) {
|
||||
stopping = false;
|
||||
mustStopCalls = false;
|
||||
}
|
||||
|
||||
B2BCallManager::~B2BCallManager() {
|
||||
}
|
||||
|
||||
void B2BCallManager::setAuthorizationManager(AuthorizationManager *authorizationManager) {
|
||||
this->authorizationManager = authorizationManager;
|
||||
}
|
||||
|
||||
TaskManager::TaskResult B2BCallManager::doTaskProcessing() {
|
||||
time_t now;
|
||||
|
||||
if(mustStopCalls) {
|
||||
B2BUA_LOG_NOTICE("notifying calls to stop");
|
||||
list<B2BCall *>::iterator call = calls.begin();
|
||||
while(call != calls.end()) {
|
||||
(*call)->onStopping();
|
||||
call++;
|
||||
}
|
||||
mustStopCalls = false;
|
||||
}
|
||||
|
||||
time(&now);
|
||||
list<B2BCall *>::iterator i = calls.begin();
|
||||
while(i != calls.end()) {
|
||||
(*i)->checkProgress(now, stopping);
|
||||
if((*i)->isComplete()) {
|
||||
B2BCall *call = *i;
|
||||
i++;
|
||||
calls.remove(call);
|
||||
delete call;
|
||||
} else
|
||||
i++;
|
||||
}
|
||||
if(stopping && calls.begin() == calls.end()) {
|
||||
B2BUA_LOG_NOTICE("no (more) calls in progress");
|
||||
return TaskManager::TaskComplete;
|
||||
}
|
||||
return TaskManager::TaskNotComplete;
|
||||
}
|
||||
|
||||
void B2BCallManager::stop() {
|
||||
stopping = true;
|
||||
mustStopCalls = true;
|
||||
}
|
||||
|
||||
bool B2BCallManager::isStopping() {
|
||||
return stopping;
|
||||
}
|
||||
|
||||
void B2BCallManager::onNewCall(MyAppDialog *aLegDialog, const resip::NameAddr& sourceAddr, const resip::Uri& destinationAddr, const resip::Data& authRealm, const resip::Data& authUser, const resip::Data& authPassword, const resip::Data& srcIp, const resip::Data& contextId, const resip::Data& accountId, const resip::Data& baseIp, const resip::Data& controlId) {
|
||||
|
||||
B2BCall *call = new B2BCall(cdrHandler, dum, *authorizationManager, aLegDialog, sourceAddr, destinationAddr, authRealm, authUser, authPassword, srcIp, contextId, accountId, baseIp, controlId);
|
||||
|
||||
calls.push_back(call);
|
||||
|
||||
}
|
||||
|
||||
void B2BCallManager::logStats() {
|
||||
int preDial = 0, dialing = 0, connected = 0, finishing = 0, unknown = 0;
|
||||
list<B2BCall *>::iterator call = calls.begin();
|
||||
while(call != calls.end()) {
|
||||
switch((*call)->getStatus()) {
|
||||
case B2BCall::PreDial:
|
||||
preDial++;
|
||||
break;
|
||||
case B2BCall::Dialing:
|
||||
dialing++;
|
||||
break;
|
||||
case B2BCall::Connected:
|
||||
connected++;
|
||||
break;
|
||||
case B2BCall::Finishing:
|
||||
finishing++;
|
||||
break;
|
||||
default:
|
||||
unknown++;
|
||||
break;
|
||||
}
|
||||
call++;
|
||||
}
|
||||
B2BUA_LOG_NOTICE("call info: preDial = %d, dialing = %d, connected = %d, finishing = %d, unknown = %d, total = %d", preDial, dialing, connected, finishing, unknown, (preDial + dialing + connected + finishing + unknown));
|
||||
}
|
||||
|
||||
/* ====================================================================
|
||||
*
|
||||
* Copyright 2012 Daniel Pocock. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. Neither the name of the author(s) nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -1,94 +0,0 @@
|
|||
|
||||
#ifndef __B2BCallManager_h
|
||||
#define __B2BCallManager_h
|
||||
|
||||
#include <fstream>
|
||||
#include <list>
|
||||
|
||||
|
||||
#include "resip/dum/DialogUsageManager.hxx"
|
||||
|
||||
#include "AuthorizationManager.hxx"
|
||||
#include "B2BCall.hxx"
|
||||
#include "CDRHandler.hxx"
|
||||
#include "TaskManager.hxx"
|
||||
|
||||
namespace b2bua
|
||||
{
|
||||
|
||||
class B2BCallManager : public TaskManager::RecurringTask {
|
||||
|
||||
protected:
|
||||
resip::DialogUsageManager& dum;
|
||||
AuthorizationManager *authorizationManager;
|
||||
|
||||
std::list<B2BCall *> calls;
|
||||
|
||||
bool stopping;
|
||||
bool mustStopCalls;
|
||||
|
||||
CDRHandler& cdrHandler;
|
||||
|
||||
public:
|
||||
B2BCallManager(resip::DialogUsageManager& dum, AuthorizationManager *authorizationManager, CDRHandler& cdrHandler);
|
||||
virtual ~B2BCallManager();
|
||||
|
||||
void setAuthorizationManager(AuthorizationManager *authorizationManager);
|
||||
|
||||
TaskManager::TaskResult doTaskProcessing();
|
||||
|
||||
/**
|
||||
* Stop accepting new calls
|
||||
* Shutdown existing calls
|
||||
* Blocks until all existing calls stopped
|
||||
*/
|
||||
void stop();
|
||||
bool isStopping();
|
||||
|
||||
void onNewCall(MyAppDialog *aLegDialog, const resip::NameAddr& sourceAddr, const resip::Uri& destinationAddr, const resip::Data& authRealm, const resip::Data& authUser, const resip::Data& authPassword, const resip::Data& srcIp, const resip::Data& contextId, const resip::Data& accountId, const resip::Data& baseIp, const resip::Data& controlId);
|
||||
|
||||
void logStats();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* ====================================================================
|
||||
*
|
||||
* Copyright 2012 Daniel Pocock. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. Neither the name of the author(s) nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -1,111 +0,0 @@
|
|||
|
||||
|
||||
#include "resip/stack/SipMessage.hxx"
|
||||
#include "resip/dum/ClientAuthManager.hxx"
|
||||
#include "resip/dum/DialogUsageManager.hxx"
|
||||
#include "resip/dum/MasterProfile.hxx"
|
||||
#include "resip/dum/ServerAuthManager.hxx"
|
||||
|
||||
#include "B2BUA.hxx"
|
||||
#include "DefaultAuthorizationManager.hxx"
|
||||
#include "DialogUsageManagerRecurringTask.hxx"
|
||||
#include "Logging.hxx"
|
||||
#include "MyAppDialog.hxx"
|
||||
#include "MyDialogSetHandler.hxx"
|
||||
#include "MyInviteSessionHandler.hxx"
|
||||
|
||||
using namespace b2bua;
|
||||
using namespace resip;
|
||||
using namespace std;
|
||||
|
||||
B2BUA::B2BUA(AuthorizationManager *authorizationManager, CDRHandler& cdrHandler) {
|
||||
|
||||
if(authorizationManager == NULL) {
|
||||
authorizationManager = new DefaultAuthorizationManager();
|
||||
}
|
||||
|
||||
taskManager = new TaskManager();
|
||||
|
||||
sipStack = new SipStack();
|
||||
dialogUsageManager = new DialogUsageManager(*sipStack);
|
||||
uasMasterProfile = SharedPtr<MasterProfile>(new MasterProfile);
|
||||
dialogUsageManager->setMasterProfile(uasMasterProfile);
|
||||
auto_ptr<AppDialogSetFactory> myAppDialogSetFactory(new MyAppDialogSetFactory);
|
||||
dialogUsageManager->setAppDialogSetFactory(myAppDialogSetFactory);
|
||||
|
||||
// Set up authentication when we act as UAC
|
||||
auto_ptr<ClientAuthManager> clientAuth(new ClientAuthManager);
|
||||
dialogUsageManager->setClientAuthManager(clientAuth);
|
||||
|
||||
dialogUsageManager->setDialogSetHandler(new MyDialogSetHandler());
|
||||
|
||||
DialogUsageManagerRecurringTask *dialogUsageManagerTask = new DialogUsageManagerRecurringTask(*sipStack, *dialogUsageManager);
|
||||
taskManager->addRecurringTask(dialogUsageManagerTask);
|
||||
callManager = new B2BCallManager(*dialogUsageManager, authorizationManager, cdrHandler);
|
||||
taskManager->addRecurringTask(callManager);
|
||||
|
||||
MyInviteSessionHandler *uas = new MyInviteSessionHandler(*dialogUsageManager, *callManager);
|
||||
dialogUsageManager->setInviteSessionHandler(uas);
|
||||
|
||||
}
|
||||
|
||||
B2BUA::~B2BUA() {
|
||||
}
|
||||
|
||||
void B2BUA::setAuthorizationManager(AuthorizationManager *authorizationManager) {
|
||||
this->authorizationManager = authorizationManager;
|
||||
callManager->setAuthorizationManager(authorizationManager);
|
||||
}
|
||||
|
||||
void B2BUA::run() {
|
||||
taskManager->start();
|
||||
}
|
||||
|
||||
void B2BUA::logStats() {
|
||||
callManager->logStats();
|
||||
}
|
||||
|
||||
void B2BUA::stop() {
|
||||
//B2BUA_LOG_CRIT("B2BUA::stop not implemented!");
|
||||
//assert(0);
|
||||
B2BUA_LOG_NOTICE("B2BUA beginning shutdown process");
|
||||
taskManager->stop();
|
||||
}
|
||||
|
||||
/* ====================================================================
|
||||
*
|
||||
* Copyright 2012 Daniel Pocock. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. Neither the name of the author(s) nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -1,102 +0,0 @@
|
|||
|
||||
#ifndef __B2BUA_h
|
||||
#define __B2BUA_h
|
||||
|
||||
#include "resip/stack/SipStack.hxx"
|
||||
#include "resip/dum/DialogUsageManager.hxx"
|
||||
|
||||
#include "B2BCallManager.hxx"
|
||||
#include "CDRHandler.hxx"
|
||||
#include "DefaultAuthorizationManager.hxx"
|
||||
#include "TaskManager.hxx"
|
||||
|
||||
namespace b2bua
|
||||
{
|
||||
|
||||
/**
|
||||
* Provides the framework for a B2BUA and implements the core activities
|
||||
*
|
||||
* Derived classes might extend the way some activities are performed, and
|
||||
* must define ways to initialise the managers required by the application
|
||||
*/
|
||||
class B2BUA {
|
||||
|
||||
protected:
|
||||
|
||||
TaskManager *taskManager;
|
||||
|
||||
B2BCallManager *callManager;
|
||||
|
||||
AuthorizationManager *authorizationManager;
|
||||
// AuthorizationManager *authorizationManager;
|
||||
// AccountingManager *accountingManager;
|
||||
|
||||
// std::list<B2BUACall *> calls;
|
||||
|
||||
// MediaManager *mediaManager;
|
||||
|
||||
// resip::ServerAuthManager *serverAuthManager;
|
||||
// resip::InviteSessionHandler *inviteSessionHandler;
|
||||
resip::SharedPtr<resip::MasterProfile> uasMasterProfile;
|
||||
resip::DialogUsageManager *dialogUsageManager;
|
||||
resip::SipStack *sipStack;
|
||||
|
||||
B2BUA(AuthorizationManager *authorizationManager, CDRHandler& cdrHandler);
|
||||
virtual ~B2BUA();
|
||||
void setAuthorizationManager(AuthorizationManager *authorizationManager);
|
||||
|
||||
public:
|
||||
// Run the B2BUA
|
||||
// only returns when B2BUA stops
|
||||
virtual void run();
|
||||
|
||||
// Send some stats about the system to syslog
|
||||
virtual void logStats();
|
||||
|
||||
// Indicate to the B2BUA that it should shutdown cleanly
|
||||
// (stop all calls, wait for all managers to stop)
|
||||
virtual void stop();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* ====================================================================
|
||||
*
|
||||
* Copyright 2012 Daniel Pocock. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. Neither the name of the author(s) nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
|
||||
#ifndef __CDRHandler_h
|
||||
#define __CDRHandler_h
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <time.h>
|
||||
|
||||
namespace b2bua
|
||||
{
|
||||
|
||||
class CDRHandler {
|
||||
|
||||
public:
|
||||
|
||||
|
||||
virtual ~CDRHandler() {};
|
||||
|
||||
virtual void handleRecord(const std::string& record) = 0;
|
||||
|
||||
};
|
||||
|
||||
class DailyCDRHandler : public CDRHandler {
|
||||
|
||||
protected:
|
||||
std::string mBasename;
|
||||
int last_write;
|
||||
std::ofstream cdrStream;
|
||||
|
||||
int day_number(struct tm* tm);
|
||||
void updateTime();
|
||||
void initFile(struct tm* tm);
|
||||
|
||||
public:
|
||||
DailyCDRHandler(const char* basename);
|
||||
~DailyCDRHandler();
|
||||
void handleRecord(const std::string& record);
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* ====================================================================
|
||||
*
|
||||
* Copyright 2012 Daniel Pocock. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. Neither the name of the author(s) nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
|
||||
#include "CallHandle.hxx"
|
||||
|
||||
using namespace b2bua;
|
||||
|
||||
CallRoute::~CallRoute() {
|
||||
}
|
||||
|
||||
CallHandle::~CallHandle() {
|
||||
}
|
||||
|
||||
/* ====================================================================
|
||||
*
|
||||
* Copyright 2012 Daniel Pocock. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. Neither the name of the author(s) nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -1,101 +0,0 @@
|
|||
|
||||
#ifndef __CallHandle_h
|
||||
#define __CallHandle_h
|
||||
|
||||
#include <iostream>
|
||||
#include <list>
|
||||
|
||||
#include "resip/stack/NameAddr.hxx"
|
||||
#include "resip/stack/Uri.hxx"
|
||||
#include "rutil/Data.hxx"
|
||||
#include "rutil/SharedPtr.hxx"
|
||||
|
||||
namespace b2bua
|
||||
{
|
||||
|
||||
#define CC_PERMITTED 0 // Call is permitted
|
||||
#define CC_AUTH_REQUIRED 1 // Auth is required
|
||||
#define CC_PAYMENT_REQUIRED 2 // Payment is required
|
||||
#define CC_IP_DENIED 3 // IP is blocked/unrecognised
|
||||
#define CC_ERROR 4 // Server error
|
||||
#define CC_INVALID 5 // Request is invalid
|
||||
#define CC_PENDING 6 // Waiting for server
|
||||
#define CC_DESTINATION_INCOMPLETE 7 // Destination number too short
|
||||
#define CC_DESTINATION_INVALID 8 // Destination invalid
|
||||
#define CC_TIMEOUT 9 // Timeout waiting for server
|
||||
#define CC_USER_UNKNOWN 10 // User unknown
|
||||
#define CC_REALM_UNKNOWN 11 // Realm unknown
|
||||
#define CC_REQUEST_DENIED 12 // Request denied for
|
||||
// administrative reason
|
||||
|
||||
class CallRoute {
|
||||
public:
|
||||
virtual ~CallRoute();
|
||||
virtual const resip::Data& getAppRef1() = 0;
|
||||
virtual const resip::Data& getAppRef2() = 0;
|
||||
virtual const resip::Data& getAuthRealm() = 0;
|
||||
virtual const resip::Data& getAuthUser() = 0;
|
||||
virtual const resip::Data& getAuthPass() = 0;
|
||||
virtual const resip::NameAddr& getSourceAddr() = 0;
|
||||
virtual const resip::NameAddr& getDestinationAddr() = 0;
|
||||
virtual const resip::Uri& getOutboundProxy() = 0;
|
||||
virtual const bool isSrvQuery() = 0;
|
||||
};
|
||||
|
||||
class CallHandle {
|
||||
public:
|
||||
virtual ~CallHandle();
|
||||
virtual int getAuthResult() = 0;
|
||||
virtual const resip::Data& getRealm() = 0; // Realm for client auth,
|
||||
// if we require further auth
|
||||
virtual time_t getHangupTime() = 0; // The time to hangup,
|
||||
// 0 for no limit
|
||||
virtual bool mustHangup() = 0;
|
||||
virtual void connect(time_t *connectTime) = 0; // The call connected
|
||||
virtual void fail(time_t *finishTime) = 0; // The attempt failed, or
|
||||
// the caller gave up
|
||||
virtual void finish(time_t *finishTime) = 0; // The call hungup
|
||||
virtual std::list<CallRoute *>& getRoutes() = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* ====================================================================
|
||||
*
|
||||
* Copyright 2012 Daniel Pocock. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. Neither the name of the author(s) nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -1,93 +0,0 @@
|
|||
|
||||
#include "CDRHandler.hxx"
|
||||
#include "Logging.hxx"
|
||||
|
||||
using namespace b2bua;
|
||||
|
||||
DailyCDRHandler::DailyCDRHandler(const char* basename) :
|
||||
mBasename(basename),
|
||||
last_write(0) {
|
||||
|
||||
}
|
||||
|
||||
DailyCDRHandler::~DailyCDRHandler() {
|
||||
if(cdrStream.is_open())
|
||||
cdrStream.close();
|
||||
}
|
||||
|
||||
void DailyCDRHandler::handleRecord(const std::string& record) {
|
||||
|
||||
// First check the time
|
||||
updateTime();
|
||||
|
||||
// Now write to file
|
||||
cdrStream << record << std::endl;
|
||||
cdrStream.flush();
|
||||
}
|
||||
|
||||
int DailyCDRHandler::day_number(struct tm* tm) {
|
||||
return (tm->tm_year + 1900) * 10000 + ((tm->tm_mon + 1) * 100) + tm->tm_mday;
|
||||
}
|
||||
|
||||
void DailyCDRHandler::updateTime() {
|
||||
time_t now;
|
||||
time(&now);
|
||||
struct tm* tm = gmtime(&now);
|
||||
int x = day_number(tm);
|
||||
if(x > last_write) {
|
||||
last_write = x;
|
||||
initFile(tm);
|
||||
}
|
||||
}
|
||||
|
||||
void DailyCDRHandler::initFile(struct tm* tm) {
|
||||
if(cdrStream.is_open()) {
|
||||
cdrStream.close();
|
||||
}
|
||||
char buf[200];
|
||||
sprintf(buf, "%s-%04d-%02d-%02d.csv", mBasename.c_str(), tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday);
|
||||
cdrStream.open(buf, std::ios::out | std::ios::app);
|
||||
if(!cdrStream.is_open()) {
|
||||
B2BUA_LOG_ERR("Failed to open CDR file");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* ====================================================================
|
||||
*
|
||||
* Copyright 2012 Daniel Pocock. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. Neither the name of the author(s) nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
|
||||
|
||||
|
||||
#include "DefaultAuthorizationManager.hxx"
|
||||
#include "Logging.hxx"
|
||||
|
||||
using namespace b2bua;
|
||||
|
||||
DefaultAuthorizationManager::DefaultAuthorizationManager() {
|
||||
}
|
||||
|
||||
|
||||
void DefaultAuthorizationManager::getAuthorization() {
|
||||
B2BUA_LOG_CRIT("DefaultAuthorizationManager::getAuthorization not implemented");
|
||||
assert(0);
|
||||
}
|
||||
|
||||
CallHandle *DefaultAuthorizationManager::authorizeCall(const resip::NameAddr& sourceAddr, const resip::Uri& destinationAddr, const resip::Data& authRealm, const resip::Data& authUser, const resip::Data& authPass, const resip::Data& srcIp, const resip::Data& contextId, const resip::Data& accountId, const resip::Data& baseIp, const resip::Data& controlId, time_t startTime) {
|
||||
B2BUA_LOG_CRIT("DefaultAuthorizationManager::authorizeCall not implemented");
|
||||
assert(0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* ====================================================================
|
||||
*
|
||||
* Copyright 2012 Daniel Pocock. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. Neither the name of the author(s) nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
|
||||
#ifndef __DefaultAuthorizationManager_h
|
||||
#define __DefaultAuthorizationManager_h
|
||||
|
||||
|
||||
#include "AuthorizationManager.hxx"
|
||||
#include "CallHandle.hxx"
|
||||
|
||||
namespace b2bua
|
||||
{
|
||||
|
||||
class DefaultAuthorizationManager : public AuthorizationManager {
|
||||
|
||||
public:
|
||||
DefaultAuthorizationManager();
|
||||
void getAuthorization();
|
||||
CallHandle *authorizeCall(const resip::NameAddr& sourceAddr, const resip::Uri& destinationAddr, const resip::Data& authRealm, const resip::Data& authUser, const resip::Data& authPass, const resip::Data& srcIp, const resip::Data& contextId, const resip::Data& accountId, const resip::Data& baseIp, const resip::Data& controlId, time_t startTime);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* ====================================================================
|
||||
*
|
||||
* Copyright 2012 Daniel Pocock. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. Neither the name of the author(s) nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -1,91 +0,0 @@
|
|||
|
||||
|
||||
#include "resip/dum/DialogUsageManager.hxx"
|
||||
|
||||
#include "DialogUsageManagerRecurringTask.hxx"
|
||||
#include "Logging.hxx"
|
||||
#include "TaskManager.hxx"
|
||||
|
||||
using namespace b2bua;
|
||||
using namespace resip;
|
||||
using namespace std;
|
||||
|
||||
DialogUsageManagerRecurringTask::DialogUsageManagerRecurringTask(resip::SipStack& sipStack, resip::DialogUsageManager& dum) : sipStack(sipStack), dum(dum) {
|
||||
stopping = false;
|
||||
}
|
||||
|
||||
TaskManager::TaskResult DialogUsageManagerRecurringTask::doTaskProcessing() {
|
||||
FdSet fdset;
|
||||
sipStack.buildFdSet(fdset);
|
||||
// FIXME - allow time for other tasks
|
||||
int err = fdset.selectMilliSeconds(resipMin((int)sipStack.getTimeTillNextProcessMS(), 50));
|
||||
if(err == -1) {
|
||||
if(errno != EINTR) {
|
||||
B2BUA_LOG_ERR("fdset.select returned error code %d", err);
|
||||
assert(0); // FIXME
|
||||
}
|
||||
}
|
||||
// Process all SIP stack activity
|
||||
sipStack.process(fdset);
|
||||
// Process all DUM activity
|
||||
//try {
|
||||
while(dum.process());
|
||||
//} catch(...) {
|
||||
// B2BUA_LOG_ERR("Exception in dum.process(), continuing anyway");
|
||||
//}
|
||||
|
||||
// FIXME If sipStack and dum are finished, then we should return TaskDone
|
||||
if(!stopping)
|
||||
return TaskManager::TaskNotComplete;
|
||||
|
||||
time_t t;
|
||||
time(&t);
|
||||
if(t > stopTime)
|
||||
return TaskManager::TaskIndefinite;
|
||||
else
|
||||
return TaskManager::TaskNotComplete;
|
||||
}
|
||||
|
||||
void DialogUsageManagerRecurringTask::stop() {
|
||||
stopping = true;
|
||||
time(&stopTime);
|
||||
stopTime += STOP_TIMEOUT;
|
||||
}
|
||||
|
||||
/* ====================================================================
|
||||
*
|
||||
* Copyright 2012 Daniel Pocock. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. Neither the name of the author(s) nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
|
||||
#ifndef __DialogUsageManagerRecurringTask_h
|
||||
#define __DialogUsageManagerRecurringTask_h
|
||||
|
||||
#include "resip/stack/SipStack.hxx"
|
||||
#include "resip/dum/DialogUsageManager.hxx"
|
||||
|
||||
#include "TaskManager.hxx"
|
||||
|
||||
namespace b2bua
|
||||
{
|
||||
|
||||
#define STOP_TIMEOUT 3 // how many seconds to wait before shutdown
|
||||
|
||||
class DialogUsageManagerRecurringTask : public TaskManager::RecurringTask {
|
||||
|
||||
protected:
|
||||
resip::SipStack& sipStack;
|
||||
resip::DialogUsageManager& dum;
|
||||
bool stopping;
|
||||
time_t stopTime;
|
||||
|
||||
public:
|
||||
DialogUsageManagerRecurringTask(resip::SipStack& sipStack, resip::DialogUsageManager& dum);
|
||||
TaskManager::TaskResult doTaskProcessing();
|
||||
|
||||
// let's the task know the application would like to stop soon
|
||||
void stop();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* ====================================================================
|
||||
*
|
||||
* Copyright 2012 Daniel Pocock. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. Neither the name of the author(s) nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -1,75 +0,0 @@
|
|||
|
||||
|
||||
#include "DummyRegistrationPersistenceManager.hxx"
|
||||
|
||||
using namespace b2bua;
|
||||
|
||||
void DummyRegistrationPersistenceManager::addAor(const resip::Uri& aor, const resip::ContactList contacts = resip::ContactList()) {
|
||||
}
|
||||
|
||||
void DummyRegistrationPersistenceManager::removeAor(const resip::Uri& aor) {
|
||||
}
|
||||
|
||||
bool DummyRegistrationPersistenceManager::aorIsRegistered(const resip::Uri& aor) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void DummyRegistrationPersistenceManager::lockRecord(const resip::Uri& aor) {
|
||||
}
|
||||
|
||||
void DummyRegistrationPersistenceManager::unlockRecord(const resip::Uri& aor) {
|
||||
}
|
||||
|
||||
resip::RegistrationPersistenceManager::UriList DummyRegistrationPersistenceManager::getAors() {
|
||||
return resip::RegistrationPersistenceManager::UriList();
|
||||
}
|
||||
|
||||
resip::RegistrationPersistenceManager::update_status_t DummyRegistrationPersistenceManager::updateContact(const resip::Uri& aor, const resip::Uri& contact, time_t expires, float q) {
|
||||
return CONTACT_CREATED;
|
||||
}
|
||||
|
||||
void DummyRegistrationPersistenceManager::removeContact(const resip::Uri& aor, const resip::Uri& contact) {
|
||||
}
|
||||
|
||||
resip::ContactList DummyRegistrationPersistenceManager::getContacts(const resip::Uri& aor) {
|
||||
return resip::ContactList();
|
||||
}
|
||||
|
||||
|
||||
/* ====================================================================
|
||||
*
|
||||
* Copyright 2012 Daniel Pocock. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. Neither the name of the author(s) nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
|
||||
#ifndef __DummyRegistrationPersistenceManager_h
|
||||
#define __DummyRegistrationPersistenceManager_h
|
||||
|
||||
#include "resip/dum/ContactInstanceRecord.hxx"
|
||||
#include "resip/dum/RegistrationPersistenceManager.hxx"
|
||||
|
||||
namespace b2bua
|
||||
{
|
||||
|
||||
class DummyRegistrationPersistenceManager : public resip::RegistrationPersistenceManager {
|
||||
public:
|
||||
|
||||
void addAor(const resip::Uri& aor, const resip::ContactList contacts);
|
||||
void removeAor(const resip::Uri& aor);
|
||||
bool aorIsRegistered(const resip::Uri& aor);
|
||||
void lockRecord(const resip::Uri& aor);
|
||||
void unlockRecord(const resip::Uri& aor);
|
||||
UriList getAors();
|
||||
update_status_t updateContact(const resip::Uri& aor, const resip::Uri& contact, time_t expires, float q = -1);
|
||||
void removeContact(const resip::Uri& aor, const resip::Uri& contact);
|
||||
resip::ContactList getContacts(const resip::Uri& aor);
|
||||
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* ====================================================================
|
||||
*
|
||||
* Copyright 2012 Daniel Pocock. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. Neither the name of the author(s) nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
|
||||
|
||||
#include "resip/stack/SipMessage.hxx"
|
||||
|
||||
#include "resip/dum/ServerRegistration.hxx"
|
||||
|
||||
#include "DummyServerRegistrationHandler.hxx"
|
||||
#include "Logging.hxx"
|
||||
|
||||
using namespace b2bua;
|
||||
using namespace resip;
|
||||
using namespace std;
|
||||
|
||||
void DummyServerRegistrationHandler::onRefresh(ServerRegistrationHandle sr, const SipMessage& reg) {
|
||||
sr->accept(200);
|
||||
}
|
||||
|
||||
void DummyServerRegistrationHandler::onRemove(ServerRegistrationHandle sr, const SipMessage& reg) {
|
||||
sr->accept(200);
|
||||
}
|
||||
|
||||
void DummyServerRegistrationHandler::onRemoveAll(ServerRegistrationHandle sr, const SipMessage& reg) {
|
||||
sr->accept(200);
|
||||
}
|
||||
|
||||
void DummyServerRegistrationHandler::onAdd(ServerRegistrationHandle sr, const SipMessage& reg) {
|
||||
B2BUA_LOG_INFO("client trying to register, username=%s", reg.header(h_From).uri().user().c_str());
|
||||
sr->accept(200);
|
||||
}
|
||||
|
||||
void DummyServerRegistrationHandler::onQuery(ServerRegistrationHandle sr, const SipMessage& reg) {
|
||||
sr->accept(200);
|
||||
}
|
||||
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
|
||||
#ifndef __DummyServerRegistrationHandler_h
|
||||
#define __DummyServerRegistrationHandler_h
|
||||
|
||||
#include "resip/dum/RegistrationHandler.hxx"
|
||||
|
||||
namespace b2bua
|
||||
{
|
||||
|
||||
class DummyServerRegistrationHandler : public resip::ServerRegistrationHandler {
|
||||
|
||||
public:
|
||||
// virtual ~ServerRegistrationHandler();
|
||||
void onRefresh(resip::ServerRegistrationHandle, const resip::SipMessage& reg);
|
||||
void onRemove(resip::ServerRegistrationHandle, const resip::SipMessage& reg);
|
||||
void onRemoveAll(resip::ServerRegistrationHandle, const resip::SipMessage& reg);
|
||||
void onAdd(resip::ServerRegistrationHandle, const resip::SipMessage& reg);
|
||||
void onQuery(resip::ServerRegistrationHandle, const resip::SipMessage& reg);
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* ====================================================================
|
||||
*
|
||||
* Copyright 2012 Daniel Pocock. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. Neither the name of the author(s) nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
|
||||
/*
|
||||
|
||||
Logging.h provides definitions for logging.
|
||||
|
||||
Possible implementations of these definitions are:
|
||||
- no logging - empty definitions for production use
|
||||
- syslog - pass all messages to syslog
|
||||
- file or stream - log all messages to a file or stream
|
||||
- resip - log all messages to the underlying resiprocate logging method
|
||||
- Log4C - pass all logging to Log4c
|
||||
*/
|
||||
|
||||
#ifndef __Logging_h
|
||||
#define __Logging_h
|
||||
|
||||
|
||||
// syslog implementation
|
||||
|
||||
#include <syslog.h>
|
||||
|
||||
#define B2BUA_LOG_INIT(n) openlog(n, LOG_ODELAY | LOG_PID, LOG_LOCAL0)
|
||||
|
||||
#define B2BUA_LOG_DEBUG(fmt, ...) syslog(LOG_DEBUG, "b2bua:%s:%d: " #fmt, __FILE__, __LINE__, ## __VA_ARGS__)
|
||||
#define B2BUA_LOG_INFO(fmt, ...) syslog(LOG_INFO, "b2bua:%s:%d: " #fmt, __FILE__, __LINE__, ## __VA_ARGS__)
|
||||
#define B2BUA_LOG_NOTICE(fmt, ...) syslog(LOG_NOTICE, "b2bua:%s:%d: " #fmt, __FILE__, __LINE__, ## __VA_ARGS__)
|
||||
#define B2BUA_LOG_WARNING(fmt, ...) syslog(LOG_WARNING, "b2bua:%s:%d: " #fmt, __FILE__, __LINE__, ## __VA_ARGS__)
|
||||
#define B2BUA_LOG_ERR(fmt, ...) syslog(LOG_ERR, "b2bua:%s:%d: " #fmt, __FILE__, __LINE__, ## __VA_ARGS__)
|
||||
#define B2BUA_LOG_CRIT(fmt, ...) syslog(LOG_CRIT, "b2bua:%s:%d: " #fmt, __FILE__, __LINE__, ## __VA_ARGS__)
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* ====================================================================
|
||||
*
|
||||
* Copyright 2012 Daniel Pocock. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. Neither the name of the author(s) nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
# $Id: Makefile,v 1.144 2004/05/18 01:40:48 jason Exp $
|
||||
|
||||
BUILD = ../build
|
||||
include $(BUILD)/Makefile.pre
|
||||
|
||||
PACKAGES += DUM RESIP RUTIL OPENSSL ARES PTHREAD
|
||||
|
||||
CXXFLAGS += -I..
|
||||
CODE_SUBDIRS =
|
||||
TARGET_LIBRARY = libb2bua
|
||||
TESTPROGRAMS =
|
||||
|
||||
SRC = \
|
||||
AuthenticationManager.cxx \
|
||||
B2BCall.cxx \
|
||||
B2BCallManager.cxx \
|
||||
B2BUA.cxx \
|
||||
CallHandle.cxx \
|
||||
DailyCDRHandler.cxx \
|
||||
DefaultAuthorizationManager.cxx \
|
||||
DialogUsageManagerRecurringTask.cxx \
|
||||
DummyRegistrationPersistenceManager.cxx \
|
||||
DummyServerRegistrationHandler.cxx \
|
||||
MediaManager.cxx \
|
||||
MediaProxy.cxx \
|
||||
MyAppDialog.cxx \
|
||||
MyDialogSetHandler.cxx \
|
||||
MyInviteSessionHandler.cxx \
|
||||
RtpProxyRecurringTask.cxx \
|
||||
RtpProxyUtil.cxx \
|
||||
TaskManager.cxx
|
||||
|
||||
include $(BUILD)/Makefile.post
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# The Vovida Software License, Version 1.0
|
||||
# Copyright (c) 2000-2007 Vovida Networks, Inc. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
#
|
||||
# 3. The names "VOCAL", "Vovida Open Communication Application Library",
|
||||
# and "Vovida Open Communication Application Library (VOCAL)" must
|
||||
# not be used to endorse or promote products derived from this
|
||||
# software without prior written permission. For written
|
||||
# permission, please contact vocal@vovida.org.
|
||||
#
|
||||
# 4. Products derived from this software may not be called "VOCAL", nor
|
||||
# may "VOCAL" appear in their name, without prior written
|
||||
# permission of Vovida Networks, Inc.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
|
||||
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
|
||||
# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
|
||||
# NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
|
||||
# IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||
# DAMAGE.
|
||||
#
|
||||
# ====================================================================
|
||||
#
|
||||
# This software consists of voluntary contributions made by Vovida
|
||||
# Networks, Inc. and many individuals on behalf of Vovida Networks,
|
||||
# Inc. For more information on Vovida Networks, Inc., please see
|
||||
# <http://www.vovida.org/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
|
@ -1,112 +0,0 @@
|
|||
|
||||
#include "rutil/Data.hxx"
|
||||
|
||||
#include "MediaManager.hxx"
|
||||
|
||||
using namespace b2bua;
|
||||
using namespace resip;
|
||||
using namespace std;
|
||||
|
||||
Data MediaManager::proxyAddress;
|
||||
|
||||
void MediaManager::setProxyAddress(const Data& proxyAddress) {
|
||||
MediaManager::proxyAddress = proxyAddress;
|
||||
};
|
||||
|
||||
MediaManager::MediaManager(B2BCall& b2BCall) : b2BCall(b2BCall) {
|
||||
aLegProxy = NULL;
|
||||
bLegProxy = NULL;
|
||||
rtpProxyUtil = NULL;
|
||||
};
|
||||
|
||||
MediaManager::MediaManager(B2BCall& b2BCall, const Data& callId, const Data& fromTag, const Data& toTag) : b2BCall(b2BCall), callId(callId), fromTag(fromTag), toTag(toTag) {
|
||||
aLegProxy = NULL;
|
||||
bLegProxy = NULL;
|
||||
rtpProxyUtil = NULL;
|
||||
};
|
||||
|
||||
MediaManager::~MediaManager() {
|
||||
if(aLegProxy != NULL)
|
||||
delete aLegProxy;
|
||||
if(bLegProxy != NULL)
|
||||
delete bLegProxy;
|
||||
if(rtpProxyUtil != NULL)
|
||||
delete rtpProxyUtil;
|
||||
};
|
||||
|
||||
void MediaManager::setFromTag(const Data& fromTag) {
|
||||
this->fromTag = fromTag;
|
||||
};
|
||||
|
||||
void MediaManager::setToTag(const Data& toTag) {
|
||||
this->toTag = toTag;
|
||||
};
|
||||
|
||||
int MediaManager::setALegSdp(const SdpContents& sdp, const in_addr_t& msgSourceAddress) {
|
||||
aLegSdp = sdp;
|
||||
if(aLegProxy == NULL)
|
||||
aLegProxy = new MediaProxy(*this);
|
||||
return aLegProxy->updateSdp(aLegSdp, msgSourceAddress);
|
||||
};
|
||||
|
||||
SdpContents& MediaManager::getALegSdp() {
|
||||
if(aLegProxy == NULL) {
|
||||
throw new exception;
|
||||
}
|
||||
return aLegProxy->getSdp();
|
||||
};
|
||||
|
||||
int MediaManager::setBLegSdp(const SdpContents& sdp, const in_addr_t& msgSourceAddress) {
|
||||
bLegSdp = sdp;
|
||||
if(bLegProxy == NULL)
|
||||
bLegProxy = new MediaProxy(*this);
|
||||
return bLegProxy->updateSdp(bLegSdp, msgSourceAddress);
|
||||
};
|
||||
|
||||
SdpContents& MediaManager::getBLegSdp() {
|
||||
if(bLegProxy == NULL)
|
||||
throw new exception;
|
||||
return bLegProxy->getSdp();
|
||||
};
|
||||
|
||||
void MediaManager::onMediaTimeout() {
|
||||
b2BCall.onMediaTimeout();
|
||||
};
|
||||
|
||||
/* ====================================================================
|
||||
*
|
||||
* Copyright 2012 Daniel Pocock. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. Neither the name of the author(s) nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -1,130 +0,0 @@
|
|||
|
||||
#ifndef __MediaManager_h
|
||||
#define __MediaManager_h
|
||||
|
||||
#include "resip/stack/SdpContents.hxx"
|
||||
#include "rutil/Data.hxx"
|
||||
|
||||
namespace b2bua
|
||||
{
|
||||
|
||||
class MediaManager;
|
||||
|
||||
}
|
||||
|
||||
#include "B2BCall.hxx"
|
||||
#include "MediaProxy.hxx"
|
||||
#include "RtpProxyUtil.hxx"
|
||||
|
||||
namespace b2bua
|
||||
{
|
||||
|
||||
/*
|
||||
Each B2BCall requires a MediaManager to handle the SDP and media
|
||||
(typically RTP/AVP).
|
||||
|
||||
MediaManager is responsible for:
|
||||
- validating the content of the SDP (IP4 only, UDP only, etc)
|
||||
- creating and destroying pairs of MediaProxy instances as needed
|
||||
- rewriting the SDP connection addresses and port numbers
|
||||
- hiding information about the remote party (e.g. phone, web, fax)
|
||||
*/
|
||||
|
||||
// FIXME - use enum types
|
||||
#define MM_SDP_OK 0 // The SDP was acceptable
|
||||
#define MM_SDP_BAD 1 // The SDP was not acceptable
|
||||
|
||||
class B2BCall;
|
||||
|
||||
class MediaManager : public RtpProxyUtil::TimeoutListener {
|
||||
|
||||
private:
|
||||
|
||||
static resip::Data proxyAddress;
|
||||
|
||||
B2BCall& b2BCall;
|
||||
|
||||
resip::Data callId; // from A Leg
|
||||
resip::Data fromTag; // `from' tag for A leg party
|
||||
resip::Data toTag; // `to' tag for B leg party
|
||||
resip::SdpContents aLegSdp;
|
||||
resip::SdpContents newALegSdp;
|
||||
resip::SdpContents bLegSdp;
|
||||
resip::SdpContents newBLegSdp;
|
||||
|
||||
RtpProxyUtil *rtpProxyUtil; // Access to rtpproxy
|
||||
|
||||
MediaProxy *aLegProxy; // Proxies on behalf of A leg
|
||||
MediaProxy *bLegProxy; // Proxies on behalf of B leg
|
||||
|
||||
public:
|
||||
friend class MediaProxy;
|
||||
|
||||
// Set the proxyAddress
|
||||
static void setProxyAddress(const resip::Data& proxyAddress);
|
||||
|
||||
// Instantiate a MediaManager
|
||||
MediaManager(B2BCall& b2BCall);
|
||||
MediaManager(B2BCall& b2BCall, const resip::Data& callId, const resip::Data& fromTag, const resip::Data& toTag);
|
||||
virtual ~MediaManager();
|
||||
|
||||
// Set the From tag
|
||||
void setFromTag(const resip::Data& fromTag);
|
||||
// Set the To tag
|
||||
void setToTag(const resip::Data& toTag);
|
||||
|
||||
// inspect and save an offer (A leg)
|
||||
int setALegSdp(const resip::SdpContents& sdp, const in_addr_t& msgSourceAddress);
|
||||
// generate an offer (to send to B leg)
|
||||
resip::SdpContents& getALegSdp();
|
||||
|
||||
// inspect and save an answer (B leg)
|
||||
int setBLegSdp(const resip::SdpContents& sdp, const in_addr_t& msgSourceAddress);
|
||||
// generate an answer (to send to A leg)
|
||||
resip::SdpContents& getBLegSdp();
|
||||
|
||||
void onMediaTimeout();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* ====================================================================
|
||||
*
|
||||
* Copyright 2012 Daniel Pocock. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. Neither the name of the author(s) nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -1,218 +0,0 @@
|
|||
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
|
||||
#include "Logging.hxx"
|
||||
#include "MediaProxy.hxx"
|
||||
|
||||
using namespace b2bua;
|
||||
using namespace resip;
|
||||
using namespace std;
|
||||
|
||||
bool MediaProxy::mNatHelper = false;
|
||||
|
||||
void MediaProxy::setNatHelper(bool natHelper) {
|
||||
mNatHelper = natHelper;
|
||||
}
|
||||
|
||||
MediaProxy::MediaProxy(MediaManager& mediaManager) : mediaManager(mediaManager) {
|
||||
originalSdp = NULL;
|
||||
newSdp = NULL;
|
||||
}
|
||||
|
||||
MediaProxy::~MediaProxy() {
|
||||
if(originalSdp != NULL)
|
||||
delete originalSdp;
|
||||
if(newSdp != NULL)
|
||||
delete newSdp;
|
||||
}
|
||||
|
||||
int MediaProxy::updateSdp(const resip::SdpContents& sdp, const in_addr_t& msgSourceAddress) {
|
||||
bool callerAsymmetric = true;
|
||||
bool calleeAsymmetric = true;
|
||||
if(originalSdp != NULL)
|
||||
delete originalSdp;
|
||||
originalSdp = (SdpContents *)sdp.clone();
|
||||
if(newSdp != NULL)
|
||||
delete newSdp;
|
||||
newSdp = (SdpContents *)sdp.clone();
|
||||
|
||||
// Process the Origin
|
||||
if(originalSdp->session().origin().getAddressType() != SdpContents::IP4) {
|
||||
// FIXME - implement IPv6
|
||||
B2BUA_LOG_WARNING("processing SDP origin, only IP4 is supported");
|
||||
return MM_SDP_BAD;
|
||||
}
|
||||
// FIXME - set username also
|
||||
newSdp->session().origin().setAddress(MediaManager::proxyAddress);
|
||||
|
||||
// Process the default connection
|
||||
if(originalSdp->session().connection().getAddressType() != SdpContents::IP4) {
|
||||
// FIXME - implement IPv6
|
||||
B2BUA_LOG_WARNING("processing SDP connection, only IP4 is supported");
|
||||
return MM_SDP_BAD;
|
||||
}
|
||||
newSdp->session().connection().setAddress(MediaManager::proxyAddress);
|
||||
|
||||
newSdp->session().clearMedium();
|
||||
list<SdpContents::Session::Medium>::iterator i = originalSdp->session().media().begin();
|
||||
while(i != originalSdp->session().media().end()) {
|
||||
if(allowProtocol((*i).protocol())) {
|
||||
if(newSdp->session().media().size() > 0) {
|
||||
// FIXME
|
||||
B2BUA_LOG_WARNING("only one medium definition supported");
|
||||
return MM_SDP_BAD;
|
||||
}
|
||||
struct MediaProxy::EndPoint endpoint;
|
||||
endpoint.address = originalSdp->session().connection().getAddress();
|
||||
// Should we adjust the address because of NAT?
|
||||
if(mNatHelper) {
|
||||
in_addr_t sdpConnectionAddr = inet_addr(originalSdp->session().connection().getAddress().c_str());
|
||||
// Is the endpoint a private address?
|
||||
bool addressIsPrivate = isAddressPrivate(sdpConnectionAddr);
|
||||
if(addressIsPrivate)
|
||||
B2BUA_LOG_WARNING("IP address in SDP is private: %s", originalSdp->session().connection().getAddress().c_str());
|
||||
|
||||
// Does the endpoint address not match the msg source address?
|
||||
bool matchesMsgSource = false;
|
||||
if(sdpConnectionAddr == msgSourceAddress)
|
||||
matchesMsgSource = true;
|
||||
|
||||
if(addressIsPrivate && !matchesMsgSource) {
|
||||
// use the msg source address instead of the address in the SDP
|
||||
struct in_addr sa;
|
||||
sa.s_addr = msgSourceAddress;
|
||||
endpoint.address = Data(inet_ntoa(sa));
|
||||
callerAsymmetric = false;
|
||||
B2BUA_LOG_WARNING("rewriting NAT address, was %s, using %s", originalSdp->session().connection().getAddress().c_str(), endpoint.address.c_str());
|
||||
}
|
||||
}
|
||||
// Check for a connection spec
|
||||
if((*i).getMediumConnections().size() > 1) {
|
||||
// FIXME - connection for each medium
|
||||
B2BUA_LOG_WARNING("multiple medium specific connections not supported");
|
||||
return MM_SDP_BAD;
|
||||
}
|
||||
if((*i).getMediumConnections().size() == 1) {
|
||||
const SdpContents::Session::Connection& mc = (*i).getMediumConnections().front();
|
||||
// FIXME - check address type, etc, or implement operator==
|
||||
if(!(mc.getAddress() == originalSdp->session().connection().getAddress())) {
|
||||
B2BUA_LOG_WARNING("medium specific connection doesn't match global connection");
|
||||
return MM_SDP_BAD;
|
||||
}
|
||||
|
||||
}
|
||||
// Get the old port, insert new port
|
||||
endpoint.originalPort = (*i).port();
|
||||
SdpContents::Session::Medium m(*i);
|
||||
// FIXME - only needed until more detailed handling of medium specific
|
||||
// connections is implemented:
|
||||
//m.getMediumConnections().clear();
|
||||
m.setConnection(newSdp->session().connection());
|
||||
if(mediaManager.aLegProxy == this) {
|
||||
// this must be A leg
|
||||
if(mediaManager.rtpProxyUtil == NULL) {
|
||||
mediaManager.rtpProxyUtil = new RtpProxyUtil();
|
||||
mediaManager.rtpProxyUtil->setTimeoutListener(&mediaManager);
|
||||
}
|
||||
endpoint.proxyPort = mediaManager.rtpProxyUtil->setupCaller(mediaManager.callId.c_str(), endpoint.address.c_str(), endpoint.originalPort, mediaManager.fromTag.c_str(), callerAsymmetric);
|
||||
if(endpoint.proxyPort == 0)
|
||||
throw new exception;
|
||||
} else {
|
||||
// this must be B leg
|
||||
endpoint.proxyPort = mediaManager.rtpProxyUtil->setupCallee(endpoint.address.c_str(), endpoint.originalPort, mediaManager.toTag.c_str(), calleeAsymmetric);
|
||||
if(endpoint.proxyPort == 0)
|
||||
throw new exception;
|
||||
}
|
||||
m.setPort(endpoint.proxyPort);
|
||||
//newMedia.push_back(m);
|
||||
newSdp->session().addMedium(m);
|
||||
endpoints.push_back(endpoint);
|
||||
} else {
|
||||
B2BUA_LOG_WARNING("media protocol %s not recognised, removed from SDP", (*i).protocol().c_str());
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if(endpoints.size() == 0) {
|
||||
B2BUA_LOG_WARNING("no acceptable media protocol found, try RTP/AVP or UDP");
|
||||
return MM_SDP_BAD;
|
||||
}
|
||||
|
||||
return MM_SDP_OK;
|
||||
|
||||
}
|
||||
|
||||
resip::SdpContents& MediaProxy::getSdp() {
|
||||
return *newSdp;
|
||||
}
|
||||
|
||||
bool MediaProxy::allowProtocol(const resip::Data& protocol) {
|
||||
if(protocol == Data("RTP/AVP") || protocol == Data("UDP") || protocol == Data("udp") || protocol == Data("udptl")) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// 10.0.0.0/8 - 10.255.255.255
|
||||
// 172.16.0.0/12 - 172.31.255.255
|
||||
// 192.168.0.0/16 - 192.168.255.255
|
||||
bool MediaProxy::isAddressPrivate(const in_addr_t& subj_addr) {
|
||||
//in_addr_t subj_addr = inet_addr(address.c_str());
|
||||
if(subj_addr == INADDR_NONE) {
|
||||
B2BUA_LOG_WARNING("subject address is invalid: INADDR_NONE");
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t subj_addr1 = ntohl(subj_addr);
|
||||
uint32_t priv1 = (10 << 24);
|
||||
uint32_t nm1 = 0xff000000;
|
||||
uint32_t priv2 = (172 << 24) + (16 << 16);
|
||||
uint32_t nm2 = 0xfff00000;
|
||||
uint32_t priv3 = (192 << 24) + (168 << 16);
|
||||
uint32_t nm3 = 0xffff0000;
|
||||
|
||||
if(((subj_addr1 & nm1) == priv1) ||
|
||||
((subj_addr1 & nm2) == priv2) ||
|
||||
((subj_addr1 & nm3) == priv3))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/* ====================================================================
|
||||
*
|
||||
* Copyright 2012 Daniel Pocock. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. Neither the name of the author(s) nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -1,111 +0,0 @@
|
|||
|
||||
#ifndef __MediaProxy_h
|
||||
#define __MediaProxy_h
|
||||
|
||||
#include "resip/stack/SdpContents.hxx"
|
||||
|
||||
namespace b2bua
|
||||
{
|
||||
|
||||
class MediaProxy;
|
||||
|
||||
}
|
||||
|
||||
#include "MediaManager.hxx"
|
||||
|
||||
namespace b2bua
|
||||
{
|
||||
|
||||
/*
|
||||
A generic MediaProxy is based on the SDP from a single endpoint.
|
||||
|
||||
Two MediaProxys must work together to provide a symmetric RTP service
|
||||
that will get through NAT. The two MediaProxy instances are
|
||||
synchronised by the MediaManager.
|
||||
|
||||
For an implementation based on rtpproxy, we must also use SIP callID,
|
||||
from-tag and to-tag, as these are the values rtpproxy expects to use
|
||||
for uniquely identifying each call.
|
||||
|
||||
Alternatively, we could use our own unique identifier system.
|
||||
*/
|
||||
|
||||
class MediaProxy {
|
||||
|
||||
protected:
|
||||
struct EndPoint {
|
||||
resip::Data address; // the address we should forward to
|
||||
unsigned int originalPort; // the port on the dest address
|
||||
unsigned int proxyPort; // the port we listen with
|
||||
};
|
||||
|
||||
static bool mNatHelper;
|
||||
|
||||
private:
|
||||
MediaManager& mediaManager; // the MediaManager who controls us
|
||||
std::list<EndPoint> endpoints; // the endpoints for each media
|
||||
// offer in the SDP
|
||||
resip::SdpContents *originalSdp; // the original SDP
|
||||
resip::SdpContents *newSdp; // the modified SDP
|
||||
|
||||
public:
|
||||
static void setNatHelper(bool natHelper);
|
||||
MediaProxy(MediaManager& mediaManager);
|
||||
virtual ~MediaProxy();
|
||||
int updateSdp(const resip::SdpContents& sdp, const in_addr_t& msgSourceAddress); // update the SDP,
|
||||
// as a result of a
|
||||
// new offer
|
||||
resip::SdpContents& getSdp(); // get the SDP
|
||||
// that should be sent
|
||||
// to the other party
|
||||
// we correspond with
|
||||
bool allowProtocol(const resip::Data& protocol); // discover if protocol
|
||||
// is permitted/handled
|
||||
// by this proxy
|
||||
// implementation
|
||||
|
||||
bool isAddressPrivate(const in_addr_t& subj_addr);
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* ====================================================================
|
||||
*
|
||||
* Copyright 2012 Daniel Pocock. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. Neither the name of the author(s) nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -1,100 +0,0 @@
|
|||
|
||||
#include "MyAppDialog.hxx"
|
||||
|
||||
using namespace b2bua;
|
||||
using namespace resip;
|
||||
using namespace std;
|
||||
|
||||
MyAppDialog::MyAppDialog(HandleManager& ham) : AppDialog(ham) {
|
||||
setB2BCall(NULL);
|
||||
}
|
||||
|
||||
MyAppDialog::MyAppDialog(HandleManager& ham, B2BCall *b2BCall) : AppDialog(ham) {
|
||||
setB2BCall(b2BCall);
|
||||
// FIXME - is this the B Leg?
|
||||
if(b2BCall != NULL)
|
||||
b2BCall->setBLegAppDialog(this);
|
||||
}
|
||||
|
||||
MyAppDialog::~MyAppDialog() {
|
||||
if(b2BCall != NULL)
|
||||
b2BCall->releaseAppDialog(this);
|
||||
}
|
||||
|
||||
B2BCall *MyAppDialog::getB2BCall() {
|
||||
return b2BCall;
|
||||
}
|
||||
|
||||
void MyAppDialog::setB2BCall(B2BCall *b2BCall) {
|
||||
this->b2BCall = b2BCall;
|
||||
}
|
||||
|
||||
MyAppDialogSet::MyAppDialogSet(DialogUsageManager& dum) : AppDialogSet(dum) {
|
||||
this->b2BCall = NULL;
|
||||
//userProfile = NULL;
|
||||
}
|
||||
|
||||
MyAppDialogSet::MyAppDialogSet(DialogUsageManager& dum, B2BCall *b2BCall, SharedPtr<UserProfile>& userProfile) : AppDialogSet(dum) {
|
||||
this->b2BCall = b2BCall;
|
||||
this->userProfile = userProfile;
|
||||
}
|
||||
|
||||
MyAppDialogSet::~MyAppDialogSet() {
|
||||
if(b2BCall != NULL)
|
||||
b2BCall->releaseAppDialogSet(this);
|
||||
}
|
||||
|
||||
AppDialog* MyAppDialogSet::createAppDialog(const SipMessage& msg) {
|
||||
return new MyAppDialog(mDum, b2BCall);
|
||||
}
|
||||
|
||||
/* SharedPtr<UserProfile> MyAppDialogSet::getUserProfile() {
|
||||
return userProfile;
|
||||
} */
|
||||
|
||||
SharedPtr<UserProfile> MyAppDialogSet::selectUASUserProfile(const SipMessage& msg) {
|
||||
//return getUserProfile();
|
||||
return mDum.getMasterUserProfile();
|
||||
}
|
||||
|
||||
AppDialogSet* MyAppDialogSetFactory::createAppDialogSet(DialogUsageManager& dum, const SipMessage& msg) {
|
||||
return new MyAppDialogSet(dum);
|
||||
}
|
||||
|
||||
/* ====================================================================
|
||||
*
|
||||
* Copyright 2012 Daniel Pocock. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. Neither the name of the author(s) nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -1,107 +0,0 @@
|
|||
|
||||
#ifndef __MyAppDialog_h
|
||||
#define __MyAppDialog_h
|
||||
|
||||
#include "resip/stack/SipMessage.hxx"
|
||||
|
||||
#include "resip/dum/AppDialog.hxx"
|
||||
#include "resip/dum/AppDialogSet.hxx"
|
||||
#include "resip/dum/AppDialogSetFactory.hxx"
|
||||
#include "resip/dum/DialogUsageManager.hxx"
|
||||
|
||||
namespace b2bua
|
||||
{
|
||||
|
||||
class MyAppDialog;
|
||||
class MyAppDialogSet;
|
||||
class MyDialogSetHandler;
|
||||
|
||||
}
|
||||
|
||||
#include "B2BCall.hxx"
|
||||
|
||||
namespace b2bua
|
||||
{
|
||||
|
||||
class MyAppDialog : public resip::AppDialog {
|
||||
|
||||
protected:
|
||||
B2BCall *b2BCall;
|
||||
|
||||
public:
|
||||
|
||||
MyAppDialog(resip::HandleManager& ham);
|
||||
MyAppDialog(resip::HandleManager& ham, B2BCall *b2BCall);
|
||||
virtual ~MyAppDialog();
|
||||
B2BCall *getB2BCall();
|
||||
void setB2BCall(B2BCall *b2BCall);
|
||||
|
||||
};
|
||||
|
||||
class MyAppDialogSet : public resip::AppDialogSet {
|
||||
|
||||
protected:
|
||||
B2BCall *b2BCall;
|
||||
resip::SharedPtr<resip::UserProfile> userProfile;
|
||||
|
||||
public:
|
||||
MyAppDialogSet(resip::DialogUsageManager& dum);
|
||||
MyAppDialogSet(resip::DialogUsageManager& dum, B2BCall *b2BCall, resip::SharedPtr<resip::UserProfile>& userProfile);
|
||||
virtual ~MyAppDialogSet();
|
||||
virtual resip::AppDialog* createAppDialog(const resip::SipMessage& msg);
|
||||
// virtual resip::SharedPtr<resip::UserProfile> getUserProfile();
|
||||
virtual resip::SharedPtr<resip::UserProfile> selectUASUserProfile(const resip::SipMessage& msg);
|
||||
void setB2BCall(B2BCall *b2BCall)
|
||||
{ this->b2BCall = b2BCall; };
|
||||
|
||||
friend class MyDialogSetHandler;
|
||||
};
|
||||
|
||||
class MyAppDialogSetFactory : public resip::AppDialogSetFactory {
|
||||
|
||||
public:
|
||||
virtual resip::AppDialogSet* createAppDialogSet(resip::DialogUsageManager& dum, const resip::SipMessage& msg);
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* ====================================================================
|
||||
*
|
||||
* Copyright 2012 Daniel Pocock. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. Neither the name of the author(s) nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
|
||||
|
||||
#include "B2BCall.hxx"
|
||||
#include "Logging.hxx"
|
||||
#include "MyAppDialog.hxx"
|
||||
#include "MyDialogSetHandler.hxx"
|
||||
|
||||
using namespace b2bua;
|
||||
using namespace resip;
|
||||
using namespace std;
|
||||
|
||||
MyDialogSetHandler::~MyDialogSetHandler() {
|
||||
}
|
||||
|
||||
void MyDialogSetHandler::onTrying(resip::AppDialogSetHandle ah, const resip::SipMessage& msg) {
|
||||
}
|
||||
|
||||
void MyDialogSetHandler::onNonDialogCreatingProvisional(resip::AppDialogSetHandle ah, const resip::SipMessage& msg) {
|
||||
B2BUA_LOG_DEBUG("received 180 without contact header");
|
||||
MyAppDialogSet *ads = dynamic_cast<MyAppDialogSet *>(ah.get());
|
||||
if(ads) {
|
||||
B2BUA_LOG_DEBUG("dialog found");
|
||||
if(ads->b2BCall)
|
||||
ads->b2BCall->doDialReceived180();
|
||||
}
|
||||
}
|
||||
|
||||
/* ====================================================================
|
||||
*
|
||||
* Copyright 2012 Daniel Pocock. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. Neither the name of the author(s) nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
|
||||
#ifndef __MyDialogSetHandler_h
|
||||
#define __MyDialogSetHandler_h
|
||||
|
||||
#include "resip/dum/DialogSetHandler.hxx"
|
||||
|
||||
namespace b2bua
|
||||
{
|
||||
|
||||
class MyDialogSetHandler : public resip::DialogSetHandler {
|
||||
|
||||
public:
|
||||
~MyDialogSetHandler();
|
||||
|
||||
virtual void onTrying(resip::AppDialogSetHandle ah, const resip::SipMessage& msg);
|
||||
|
||||
virtual void onNonDialogCreatingProvisional(resip::AppDialogSetHandle ah, const resip::SipMessage& msg);
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* ====================================================================
|
||||
*
|
||||
* Copyright 2012 Daniel Pocock. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. Neither the name of the author(s) nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -1,334 +0,0 @@
|
|||
|
||||
|
||||
|
||||
#include "resip/stack/ExtensionHeader.hxx"
|
||||
#include "resip/stack/SipMessage.hxx"
|
||||
#include "resip/stack/Tuple.hxx"
|
||||
#include "rutil/Data.hxx"
|
||||
|
||||
#include "B2BCall.hxx"
|
||||
#include "B2BCallManager.hxx"
|
||||
#include "Logging.hxx"
|
||||
#include "MyInviteSessionHandler.hxx"
|
||||
|
||||
using namespace b2bua;
|
||||
using namespace resip;
|
||||
using namespace std;
|
||||
|
||||
MyInviteSessionHandler::MyInviteSessionHandler(DialogUsageManager& dum, B2BCallManager& callManager) : dum(dum), callManager(callManager) {
|
||||
}
|
||||
|
||||
void MyInviteSessionHandler::onSuccess(ClientRegistrationHandle h, const SipMessage& response) {
|
||||
}
|
||||
|
||||
void MyInviteSessionHandler::onFailure(ClientRegistrationHandle, const SipMessage& msg) {
|
||||
}
|
||||
|
||||
void MyInviteSessionHandler::onMessage(resip::Handle<resip::InviteSession>, const resip::SipMessage& msg) {
|
||||
}
|
||||
|
||||
void MyInviteSessionHandler::onMessageSuccess(resip::Handle<resip::InviteSession>, const resip::SipMessage&) {
|
||||
}
|
||||
|
||||
void MyInviteSessionHandler::onMessageFailure(resip::Handle<resip::InviteSession>, const resip::SipMessage&) {
|
||||
}
|
||||
|
||||
void MyInviteSessionHandler::onFailure(ClientInviteSessionHandle cis, const SipMessage& msg) {
|
||||
B2BUA_LOG_DEBUG("onFailure: %d, %s", msg.header(h_StatusLine).statusCode(), msg.header(h_StatusLine).reason().c_str());
|
||||
B2BCall *call = getB2BCall(cis.get());
|
||||
if(call == NULL) {
|
||||
B2BUA_LOG_WARNING("onFailure: unrecognised dialog");
|
||||
return;
|
||||
}
|
||||
call->onRejected(msg.header(h_StatusLine).statusCode(), msg.header(h_StatusLine).reason());
|
||||
}
|
||||
|
||||
void MyInviteSessionHandler::onForkDestroyed(ClientInviteSessionHandle) {
|
||||
}
|
||||
|
||||
void MyInviteSessionHandler::onInfoSuccess(InviteSessionHandle, const SipMessage& msg) {
|
||||
}
|
||||
|
||||
void MyInviteSessionHandler::onInfoFailure(InviteSessionHandle, const SipMessage& msg) {
|
||||
}
|
||||
|
||||
void MyInviteSessionHandler::onProvisional(ClientInviteSessionHandle cis, const SipMessage& msg) {
|
||||
B2BCall *call = getB2BCall(cis.get());
|
||||
if(call == NULL) {
|
||||
B2BUA_LOG_WARNING("onProvisional: unrecognised dialog");
|
||||
return;
|
||||
}
|
||||
int code = msg.header(h_StatusLine).statusCode();
|
||||
switch(code) {
|
||||
case 100:
|
||||
//call->onTrying();
|
||||
break;
|
||||
case 180:
|
||||
call->onRinging();
|
||||
break;
|
||||
case 183:
|
||||
//call->onSessionProgress();
|
||||
break;
|
||||
default:
|
||||
B2BUA_LOG_DEBUG("onProvisional: unknown provisional code (%d)", code);
|
||||
}
|
||||
}
|
||||
|
||||
void MyInviteSessionHandler::onConnected(ClientInviteSessionHandle, const SipMessage& msg) {
|
||||
// FIXME - start charging here instead of waiting for onAnswer
|
||||
}
|
||||
|
||||
void MyInviteSessionHandler::onStaleCallTimeout(ClientInviteSessionHandle) {
|
||||
}
|
||||
|
||||
void MyInviteSessionHandler::onConnected(InviteSessionHandle, const SipMessage& msg) {
|
||||
// FIXME
|
||||
}
|
||||
|
||||
void MyInviteSessionHandler::onRedirected(ClientInviteSessionHandle, const SipMessage& msg) {
|
||||
}
|
||||
|
||||
void MyInviteSessionHandler::onAnswer(InviteSessionHandle is, const SipMessage& msg, const SdpContents& sdp) {
|
||||
MyAppDialog *myAppDialog = (MyAppDialog *)is->getAppDialog().get();
|
||||
B2BCall *call = getB2BCall(is.get());
|
||||
if(call == NULL) {
|
||||
B2BUA_LOG_WARNING("onAnswer: unrecognised dialog");
|
||||
return;
|
||||
}
|
||||
Tuple sourceTuple = msg.getSource();
|
||||
in_addr_t msgSourceAddress = sourceTuple.toGenericIPAddress().v4Address.sin_addr.s_addr;
|
||||
call->onAnswer(myAppDialog, sdp, msgSourceAddress);
|
||||
}
|
||||
|
||||
void MyInviteSessionHandler::onEarlyMedia(ClientInviteSessionHandle cis, const SipMessage& msg, const SdpContents& sdp) {
|
||||
B2BCall *call = getB2BCall(cis.get());
|
||||
if(call == NULL) {
|
||||
B2BUA_LOG_WARNING("onEarlyMedia: unrecognised dialog");
|
||||
return;
|
||||
}
|
||||
Tuple sourceTuple = msg.getSource();
|
||||
in_addr_t msgSourceAddress = sourceTuple.toGenericIPAddress().v4Address.sin_addr.s_addr;
|
||||
call->onEarlyMedia(sdp, msgSourceAddress);
|
||||
}
|
||||
|
||||
void MyInviteSessionHandler::onOfferRequired(InviteSessionHandle, const SipMessage& msg) {
|
||||
// FIXME
|
||||
}
|
||||
|
||||
void MyInviteSessionHandler::onOfferRejected(Handle<InviteSession>, const SipMessage *msg) {
|
||||
// FIXME
|
||||
B2BUA_LOG_DEBUG("onOfferRejected: %d, %s", msg->header(h_StatusLine).statusCode(), msg->header(h_StatusLine).reason().c_str());
|
||||
}
|
||||
|
||||
void MyInviteSessionHandler::onInfo(InviteSessionHandle, const SipMessage& msg) {
|
||||
}
|
||||
|
||||
void MyInviteSessionHandler::onRefer(InviteSessionHandle, ServerSubscriptionHandle, const SipMessage& msg) {
|
||||
}
|
||||
|
||||
void MyInviteSessionHandler::onReferAccepted(InviteSessionHandle, ClientSubscriptionHandle, const SipMessage& msg) {
|
||||
}
|
||||
|
||||
void MyInviteSessionHandler::onReferRejected(InviteSessionHandle, const SipMessage& msg) {
|
||||
}
|
||||
|
||||
void MyInviteSessionHandler::onReferNoSub(resip::Handle<resip::InviteSession> is, const resip::SipMessage& msg) {
|
||||
}
|
||||
|
||||
void MyInviteSessionHandler::onRemoved(ClientRegistrationHandle) {
|
||||
}
|
||||
|
||||
int MyInviteSessionHandler::onRequestRetry(ClientRegistrationHandle, int retrySeconds, const SipMessage& response) {
|
||||
// cerr << "onRequestRetry not implemented" << endl;
|
||||
//FIXME
|
||||
B2BUA_LOG_DEBUG("onRequestRetry not implemented");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// New inbound connection
|
||||
// We must create a B2BCall and insert the B2BCall into the linked list
|
||||
void MyInviteSessionHandler::onNewSession(ServerInviteSessionHandle sis, InviteSession::OfferAnswerType oat, const SipMessage& msg) {
|
||||
//cerr << "onNewSession sis" << endl;
|
||||
|
||||
// Are we shutting down? If so, reject the call with SIP code 503
|
||||
if(callManager.isStopping()) {
|
||||
B2BUA_LOG_DEBUG("rejecting inbound call as we are stopping");
|
||||
sis->reject(503);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check the headers
|
||||
if(!msg.exists(h_From)) {
|
||||
B2BUA_LOG_WARNING("inbound connection missing from header, rejecting dialog");
|
||||
sis->reject(603);
|
||||
return;
|
||||
}
|
||||
// FIXME - do above for all headers
|
||||
if(msg.getReceivedTransport() == 0) {
|
||||
// msg not received from the wire
|
||||
// FIXME
|
||||
B2BUA_LOG_WARNING("request not received from the wire");
|
||||
sis->reject(603);
|
||||
}
|
||||
Tuple sourceTuple = msg.getSource();
|
||||
Data sourceIp = Data(inet_ntoa(sourceTuple.toGenericIPAddress().v4Address.sin_addr));
|
||||
Data contextId;
|
||||
Data accountId;
|
||||
Data baseIp;
|
||||
Data controlId;
|
||||
ExtensionHeader xContextId("X-MyB2BUA-Context-ID");
|
||||
if(msg.exists(xContextId)) {
|
||||
const StringCategories& contextIds = msg.header(xContextId);
|
||||
contextId = Data((contextIds.begin())->value());
|
||||
}
|
||||
ExtensionHeader xAccountId("X-MyB2BUA-Account-ID");
|
||||
if(msg.exists(xAccountId)) {
|
||||
const StringCategories& accountIds = msg.header(xAccountId);
|
||||
accountId = Data((accountIds.begin())->value());
|
||||
}
|
||||
ExtensionHeader xBaseIp("X-MyB2BUA-Base-IP");
|
||||
if(msg.exists(xBaseIp)) {
|
||||
const StringCategories& baseIps = msg.header(xBaseIp);
|
||||
baseIp = Data((baseIps.begin())->value());
|
||||
}
|
||||
ExtensionHeader xControlId("X-MyB2BUA-Control-ID");
|
||||
if(msg.exists(xControlId)) {
|
||||
const StringCategories& controlIds = msg.header(xControlId);
|
||||
controlId = Data((controlIds.begin())->value());
|
||||
}
|
||||
// Now inspect the authentication info
|
||||
Data authRealm("");
|
||||
Data authUser("");
|
||||
Data authPassword("");
|
||||
if(msg.exists(h_ProxyAuthorizations)) {
|
||||
for(Auths::const_iterator it = msg.header(h_ProxyAuthorizations).begin(); it != msg.header(h_ProxyAuthorizations).end(); it++) {
|
||||
if(dum.isMyDomain(it->param(p_realm))) {
|
||||
authRealm = it->param(p_realm);
|
||||
authUser = it->param(p_username);
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
callManager.onNewCall((MyAppDialog *)sis->getAppDialog().get(), msg.header(h_From), msg.header(h_RequestLine).uri(), authRealm, authUser, Data(""), sourceIp, contextId, accountId, baseIp, controlId);
|
||||
} catch (...) {
|
||||
B2BUA_LOG_ERR("failed to instantiate B2BCall");
|
||||
sis->reject(500); // Indicate temporary error condition
|
||||
}
|
||||
}
|
||||
|
||||
void MyInviteSessionHandler::onNewSession(ClientInviteSessionHandle cis, InviteSession::OfferAnswerType oat, const SipMessage& msg) {
|
||||
}
|
||||
|
||||
void MyInviteSessionHandler::onTerminated(InviteSessionHandle is, InviteSessionHandler::TerminatedReason reason, const SipMessage* msg) {
|
||||
B2BUA_LOG_DEBUG("onTerminated, reason = %d", reason);
|
||||
B2BCall *call = getB2BCall(is.get());
|
||||
if(call == NULL) {
|
||||
B2BUA_LOG_WARNING("onTerminated: unrecognised dialog");
|
||||
return;
|
||||
}
|
||||
MyAppDialog *myAppDialog = (MyAppDialog *)is->getAppDialog().get();
|
||||
switch(reason) {
|
||||
|
||||
// received a BYE or CANCEL from peer
|
||||
case RemoteCancel:
|
||||
B2BUA_LOG_DEBUG("onTerminated: RemoteCancel");
|
||||
call->onCancel();
|
||||
break;
|
||||
|
||||
case RemoteBye:
|
||||
B2BUA_LOG_DEBUG("onTerminated: RemoteBye");
|
||||
// MyAppDialog *myAppDialog = (MyAppDialog *)is->getAppDialog().get();
|
||||
call->onHangup(myAppDialog);
|
||||
break;
|
||||
|
||||
// ended by the application
|
||||
case LocalBye:
|
||||
B2BUA_LOG_DEBUG("onTerminated: LocalBye");
|
||||
//call->onFailure(myAppDialog);
|
||||
break;
|
||||
|
||||
case Referred:
|
||||
B2BUA_LOG_DEBUG("onTerminated: Referred");
|
||||
//call->onFailure(myAppDialog);
|
||||
break;
|
||||
|
||||
// ended due to a failure
|
||||
case Error:
|
||||
B2BUA_LOG_DEBUG("onTerminated: Error");
|
||||
call->onFailure(myAppDialog);
|
||||
break;
|
||||
|
||||
case Timeout:
|
||||
B2BUA_LOG_DEBUG("onTerminated: Timeout");
|
||||
call->onFailure(myAppDialog);
|
||||
break;
|
||||
|
||||
case LocalCancel: // ended by the application via Cancel
|
||||
B2BUA_LOG_DEBUG("onTerminated: LocalCancel");
|
||||
// no need to do anything, because we have initiated this cancel
|
||||
break;
|
||||
|
||||
default:
|
||||
B2BUA_LOG_WARNING("onTerminated: unhandled case %d", reason);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void MyInviteSessionHandler::onOffer(InviteSessionHandle is, const SipMessage& msg, const SdpContents& sdp) {
|
||||
B2BCall *call = getB2BCall(is.get());
|
||||
if(call == NULL) {
|
||||
B2BUA_LOG_WARNING("onOffer: unrecognised dialog");
|
||||
return;
|
||||
}
|
||||
B2BUA_LOG_DEBUG("onOffer received");
|
||||
MyAppDialog *myAppDialog = (MyAppDialog *)is->getAppDialog().get();
|
||||
Tuple sourceTuple = msg.getSource();
|
||||
in_addr_t msgSourceAddress = sourceTuple.toGenericIPAddress().v4Address.sin_addr.s_addr;
|
||||
call->onOffer(myAppDialog, sdp, msgSourceAddress);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handy utility functions
|
||||
*/
|
||||
B2BCall *MyInviteSessionHandler::getB2BCall(InviteSession *is) {
|
||||
MyAppDialog *myAppDialog = (MyAppDialog *)is->getAppDialog().get();
|
||||
return (B2BCall *)myAppDialog->getB2BCall();
|
||||
}
|
||||
|
||||
/* ====================================================================
|
||||
*
|
||||
* Copyright 2012 Daniel Pocock. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. Neither the name of the author(s) nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -1,97 +0,0 @@
|
|||
|
||||
|
||||
#ifndef __MyInviteSessionHandler_h
|
||||
#define __MyInviteSessionHandler_h
|
||||
|
||||
#include "resip/stack/SipMessage.hxx"
|
||||
#include "resip/dum/ClientInviteSession.hxx"
|
||||
#include "resip/dum/InviteSessionHandler.hxx"
|
||||
#include "resip/dum/ServerInviteSession.hxx"
|
||||
|
||||
namespace b2bua
|
||||
{
|
||||
|
||||
class MyInviteSessionHandler : public resip::InviteSessionHandler {
|
||||
|
||||
protected:
|
||||
resip::DialogUsageManager& dum;
|
||||
B2BCallManager& callManager;
|
||||
|
||||
public:
|
||||
MyInviteSessionHandler(resip::DialogUsageManager& dum, B2BCallManager& callManager);
|
||||
virtual void onSuccess(resip::ClientRegistrationHandle h, const resip::SipMessage& response);
|
||||
virtual void onFailure(resip::ClientRegistrationHandle, const resip::SipMessage& msg);
|
||||
virtual void onMessage(resip::Handle<resip::InviteSession>, const resip::SipMessage& msg);
|
||||
virtual void onMessageSuccess(resip::Handle<resip::InviteSession>, const resip::SipMessage&);
|
||||
virtual void onMessageFailure(resip::Handle<resip::InviteSession>, const resip::SipMessage&);
|
||||
virtual void onFailure(resip::ClientInviteSessionHandle cis, const resip::SipMessage& msg);
|
||||
virtual void onForkDestroyed(resip::ClientInviteSessionHandle);
|
||||
virtual void onInfoSuccess(resip::InviteSessionHandle, const resip::SipMessage& msg);
|
||||
virtual void onInfoFailure(resip::InviteSessionHandle, const resip::SipMessage& msg);
|
||||
virtual void onProvisional(resip::ClientInviteSessionHandle cis, const resip::SipMessage& msg);
|
||||
virtual void onConnected(resip::ClientInviteSessionHandle, const resip::SipMessage& msg);
|
||||
virtual void onConnected(resip::InviteSessionHandle, const resip::SipMessage& msg);
|
||||
virtual void onStaleCallTimeout(resip::ClientInviteSessionHandle);
|
||||
virtual void onRedirected(resip::ClientInviteSessionHandle, const resip::SipMessage& msg);
|
||||
virtual void onAnswer(resip::InviteSessionHandle is, const resip::SipMessage& msg, const resip::SdpContents& sdp);
|
||||
virtual void onEarlyMedia(resip::ClientInviteSessionHandle, const resip::SipMessage& msg, const resip::SdpContents& sdp);
|
||||
virtual void onOfferRequired(resip::InviteSessionHandle, const resip::SipMessage& msg);
|
||||
virtual void onOfferRejected(resip::Handle<resip::InviteSession>, const resip::SipMessage *msg);
|
||||
virtual void onInfo(resip::InviteSessionHandle, const resip::SipMessage& msg);
|
||||
virtual void onRefer(resip::InviteSessionHandle, resip::ServerSubscriptionHandle, const resip::SipMessage& msg);
|
||||
virtual void onReferAccepted(resip::InviteSessionHandle, resip::ClientSubscriptionHandle, const resip::SipMessage& msg);
|
||||
virtual void onReferRejected(resip::InviteSessionHandle, const resip::SipMessage& msg);
|
||||
virtual void onReferNoSub(resip::Handle<resip::InviteSession>, const resip::SipMessage&);
|
||||
virtual void onRemoved(resip::ClientRegistrationHandle);
|
||||
virtual int onRequestRetry(resip::ClientRegistrationHandle, int retrySeconds, const resip::SipMessage& response);
|
||||
virtual void onNewSession(resip::ServerInviteSessionHandle sis, resip::InviteSession::OfferAnswerType oat, const resip::SipMessage& msg);
|
||||
virtual void onNewSession(resip::ClientInviteSessionHandle cis, resip::InviteSession::OfferAnswerType oat, const resip::SipMessage& msg);
|
||||
virtual void onTerminated(resip::InviteSessionHandle is, resip::InviteSessionHandler::TerminatedReason reason, const resip::SipMessage* msg);
|
||||
virtual void onOffer(resip::InviteSessionHandle is, const resip::SipMessage& msg, const resip::SdpContents& sdp);
|
||||
|
||||
// Utility functions
|
||||
B2BCall *getB2BCall(resip::InviteSession *is);
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* ====================================================================
|
||||
*
|
||||
* Copyright 2012 Daniel Pocock. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. Neither the name of the author(s) nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -1,94 +0,0 @@
|
|||
|
||||
Introduction
|
||||
============
|
||||
|
||||
This is a reSIProcate based B2BUA library.
|
||||
|
||||
The library is libb2bua.so
|
||||
|
||||
It is built on top of reSIProcate's dialog usage manager (DUM)
|
||||
|
||||
Building
|
||||
========
|
||||
|
||||
In the main reSIProcate directory, when you run configure, you
|
||||
must explicitly request that the library is built:
|
||||
|
||||
./configure --with-b2bua
|
||||
|
||||
NOTE: configure does NOT include the B2BUA by default.
|
||||
|
||||
Background and technical notes
|
||||
==============================
|
||||
|
||||
The code has been adapted from a previous project. Consequently,
|
||||
the initial import to the reSIProcate repository doesn't fully adhere to
|
||||
reSIProcate coding standards. Nonetheless, it is working code,
|
||||
so a decision was taken to commit the code as-is, without
|
||||
modification, and then gradually overhaul it in subsequent commits.
|
||||
|
||||
Some key points about this code:
|
||||
|
||||
- It produces a shared object - to produce an executable,
|
||||
the B2BUA class must be instantiated and put to work.
|
||||
Such an example exists in the apps/basicB2BUA directory. A typical
|
||||
implementation of a B2BUA must implement the following
|
||||
classes:
|
||||
- b2bua::CallRoute
|
||||
- b2bua::CallHandle
|
||||
- b2bua::AuthorizationManager
|
||||
- b2bua::B2BUA
|
||||
|
||||
- It relies on rtpproxy from http://www.rtpproxy.org to relay
|
||||
the media streams. There are also various patches for
|
||||
rtpproxy 0.2:
|
||||
- rtpproxy sends notification to the B2BUA on media timeout
|
||||
- fix a file descriptor bug
|
||||
- timeout on either direction
|
||||
The rtpproxy patches have been posted on the rtpproxy mailing
|
||||
list:
|
||||
|
||||
http://lists.rtpproxy.org/pipermail/users/2008-May/000016.html
|
||||
|
||||
Daniel Pocock
|
||||
daniel@pocock.com.au
|
||||
|
||||
|
||||
|
||||
/* ====================================================================
|
||||
*
|
||||
* Copyright 2012 Daniel Pocock. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. Neither the name of the author(s) nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
|
||||
#include "RtpProxyRecurringTask.hxx"
|
||||
#include "RtpProxyUtil.hxx"
|
||||
|
||||
using namespace b2bua;
|
||||
|
||||
RtpProxyRecurringTask::RtpProxyRecurringTask() {
|
||||
}
|
||||
|
||||
TaskManager::TaskResult RtpProxyRecurringTask::doTaskProcessing() {
|
||||
RtpProxyUtil::do_timeouts();
|
||||
return TaskManager::TaskIndefinite;
|
||||
}
|
||||
|
||||
void RtpProxyRecurringTask::stop() {
|
||||
}
|
||||
|
||||
/* ====================================================================
|
||||
*
|
||||
* Copyright 2012 Daniel Pocock. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. Neither the name of the author(s) nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
|
||||
#ifndef __RtpProxyRecurringTask_h
|
||||
#define __RtpProxyRecurringTask_h
|
||||
|
||||
|
||||
#include "TaskManager.hxx"
|
||||
|
||||
namespace b2bua
|
||||
{
|
||||
|
||||
#define STOP_TIMEOUT 3 // how many seconds to wait before shutdown
|
||||
|
||||
class RtpProxyRecurringTask : public TaskManager::RecurringTask {
|
||||
|
||||
protected:
|
||||
bool stopping;
|
||||
time_t stopTime;
|
||||
|
||||
public:
|
||||
RtpProxyRecurringTask();
|
||||
TaskManager::TaskResult doTaskProcessing();
|
||||
|
||||
// let's the task know the application would like to stop soon
|
||||
void stop();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* ====================================================================
|
||||
*
|
||||
* Copyright 2012 Daniel Pocock. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. Neither the name of the author(s) nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -1,488 +0,0 @@
|
|||
|
||||
/* Todo:
|
||||
- handle re-INVITE
|
||||
- share a socket?
|
||||
- test socket when app starts
|
||||
- release ports when object destroyed
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/un.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <netdb.h>
|
||||
#include <poll.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
|
||||
#include "Logging.hxx"
|
||||
#include "RtpProxyUtil.hxx"
|
||||
|
||||
#define STR2IOVEC(sx, ix) {(ix).iov_base = (sx); (ix).iov_len = strlen((sx));}
|
||||
|
||||
#define RTPPROXY_RETRY_COUNT 3
|
||||
|
||||
using namespace b2bua;
|
||||
using namespace std;
|
||||
|
||||
int RtpProxyUtil::umode = 0;
|
||||
char *RtpProxyUtil::rtpproxy_sock = (char *)DEFAULT_RTPPROXY_SOCK;
|
||||
int RtpProxyUtil::controlfd = 0;
|
||||
char *RtpProxyUtil::timeout_sock = (char *)DEFAULT_RTPPROXY_TIMEOUT_SOCK;
|
||||
int RtpProxyUtil::timeoutfd = 0;
|
||||
int RtpProxyUtil::timeout_clientfd = -1;
|
||||
int RtpProxyUtil::rtpproxy_retr = DEFAULT_RTPPROXY_RETR;
|
||||
int RtpProxyUtil::rtpproxy_tout = DEFAULT_RTPPROXY_TOUT;
|
||||
|
||||
map<int, RtpProxyUtil *> RtpProxyUtil::proxies;
|
||||
|
||||
void RtpProxyUtil::setSocket(const char *socket) {
|
||||
if((rtpproxy_sock = (char *)malloc(strlen(socket) + 1)) == NULL) {
|
||||
B2BUA_LOG_ERR("setSocket: malloc failed");
|
||||
throw;
|
||||
}
|
||||
strcpy(rtpproxy_sock, socket);
|
||||
}
|
||||
|
||||
void RtpProxyUtil::setTimeoutSocket(const char *socket) {
|
||||
if((timeout_sock = (char *)malloc(strlen(socket) + 1)) == NULL) {
|
||||
B2BUA_LOG_ERR("setSocket: malloc failed");
|
||||
throw;
|
||||
}
|
||||
strcpy(timeout_sock, socket);
|
||||
}
|
||||
|
||||
void RtpProxyUtil::init() {
|
||||
umode = 0;
|
||||
// rtpproxy_sock = DEFAULT_RTPPROXY_SOCK;
|
||||
// timeout_sock = DEFAULT_RTPPROXY_TIMEOUT_SOCK;
|
||||
rtpproxy_retr = DEFAULT_RTPPROXY_RETR;
|
||||
rtpproxy_tout = DEFAULT_RTPPROXY_TOUT;
|
||||
|
||||
int len;
|
||||
struct sockaddr_un local;
|
||||
|
||||
int flags;
|
||||
|
||||
if ((timeoutfd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
|
||||
B2BUA_LOG_ERR("socket: %m");
|
||||
exit(1); // FIXME
|
||||
}
|
||||
|
||||
local.sun_family = AF_UNIX;
|
||||
strcpy(local.sun_path, timeout_sock);
|
||||
unlink(local.sun_path);
|
||||
len = strlen(local.sun_path) + sizeof(local.sun_family);
|
||||
if (bind(timeoutfd, (struct sockaddr *)&local, len) == -1) {
|
||||
B2BUA_LOG_ERR("bind: %m");
|
||||
exit(1); // FIXME
|
||||
}
|
||||
|
||||
if (listen(timeoutfd, 5) == -1) {
|
||||
B2BUA_LOG_ERR("listen: %m");
|
||||
exit(1); // FIXME
|
||||
}
|
||||
|
||||
flags = fcntl(timeoutfd, F_GETFL);
|
||||
flags |= O_NONBLOCK;
|
||||
fcntl(timeoutfd, F_SETFL, flags);
|
||||
|
||||
timeout_clientfd = -1;
|
||||
|
||||
B2BUA_LOG_NOTICE("telling rtpproxy to flush calls");
|
||||
// Check the version
|
||||
struct iovec v[2] = {{NULL, 0}, {(char *)"x", 1}};
|
||||
char *cp = sendCommandRetry(RTPPROXY_RETRY_COUNT, v, 2, "");
|
||||
if(cp == NULL)
|
||||
throw new exception;
|
||||
}
|
||||
|
||||
void RtpProxyUtil::do_timeouts() {
|
||||
// check for new connections with accept
|
||||
// read any data with read
|
||||
socklen_t t;
|
||||
struct sockaddr_un remote;
|
||||
int flags;
|
||||
int n;
|
||||
char buf[100];
|
||||
int p1, p2;
|
||||
|
||||
if(timeout_clientfd == -1) {
|
||||
t = sizeof(remote);
|
||||
if((timeout_clientfd = accept(timeoutfd, (struct sockaddr *)&remote, &t)) == -1) {
|
||||
if(errno == EAGAIN) {
|
||||
// no connections coming in from rtpproxy
|
||||
return;
|
||||
}
|
||||
B2BUA_LOG_ERR("accept: %m");
|
||||
exit(1);
|
||||
}
|
||||
B2BUA_LOG_DEBUG("accepted a new connection from rtpproxy");
|
||||
flags = fcntl(timeout_clientfd, F_GETFL);
|
||||
flags |= O_NONBLOCK;
|
||||
fcntl(timeout_clientfd, F_SETFL, flags);
|
||||
}
|
||||
|
||||
n = recv(timeout_clientfd, buf, 100, 0);
|
||||
if (n == -1) {
|
||||
if (errno != EAGAIN) {
|
||||
// FIXME
|
||||
B2BUA_LOG_ERR("recv: %m");
|
||||
close(timeout_clientfd);
|
||||
timeout_clientfd = -1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(n== 0) {
|
||||
// n = 0 means that socket closed remotely
|
||||
timeout_clientfd = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
buf[n] = 0;
|
||||
if((n = sscanf(buf, "%d %d\n", &p1, &p2)) != 2) {
|
||||
B2BUA_LOG_WARNING("invalid number of arguments from rtpproxy_timeout client [%s]", buf);
|
||||
} else {
|
||||
B2BUA_LOG_DEBUG("timeout on ports %d %d", p1, p2);
|
||||
if(proxies.count(p1) == 1) {
|
||||
RtpProxyUtil *proxy = proxies.find(p1)->second;
|
||||
proxy->mediaTimeout();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
RtpProxyUtil::RtpProxyUtil() {
|
||||
timeoutListener = NULL;
|
||||
valid = true;
|
||||
mypid = getpid();
|
||||
myseqn = 0;
|
||||
callID = NULL;
|
||||
callerAddr = NULL;
|
||||
callerPort = 0;
|
||||
calleeAddr = NULL;
|
||||
calleePort = 0;
|
||||
fromTag = NULL;
|
||||
toTag = NULL;
|
||||
|
||||
callerProxyPort = 0;
|
||||
calleeProxyPort = 0;
|
||||
|
||||
// Check the version
|
||||
struct iovec v[2] = {{NULL, 0}, {(char *)"V", 1}};
|
||||
char *cp = sendCommandRetry(RTPPROXY_RETRY_COUNT, v, 2, gencookie());
|
||||
if(cp == NULL)
|
||||
throw new exception;
|
||||
|
||||
}
|
||||
|
||||
RtpProxyUtil::~RtpProxyUtil() {
|
||||
|
||||
if(callerProxyPort != 0)
|
||||
proxies.erase(callerProxyPort);
|
||||
if(calleeProxyPort != 0)
|
||||
proxies.erase(calleeProxyPort);
|
||||
|
||||
struct iovec v[1 + 4 + 3] = {{NULL, 0}, {(char *)"D", 1}, {(char *)" ", 1}, {NULL, 0}, {(char *)" ", 1}, {NULL, 0}, {(char *)" ", 1}, {NULL, 0}};
|
||||
STR2IOVEC(callID, v[3]);
|
||||
STR2IOVEC(fromTag, v[5]);
|
||||
if(toTag != NULL)
|
||||
STR2IOVEC(toTag, v[7]);
|
||||
// ignore return value
|
||||
sendCommandRetry(RTPPROXY_RETRY_COUNT, v, (toTag != NULL) ? 8 : 6, gencookie());
|
||||
|
||||
if(callID != NULL)
|
||||
free(callID);
|
||||
if(callerAddr != NULL)
|
||||
free(callerAddr);
|
||||
if(calleeAddr != NULL)
|
||||
free(calleeAddr);
|
||||
if(fromTag != NULL)
|
||||
free(fromTag);
|
||||
if(toTag != NULL)
|
||||
free(toTag);
|
||||
|
||||
}
|
||||
|
||||
void RtpProxyUtil::setTimeoutListener(TimeoutListener *timeoutListener) {
|
||||
this->timeoutListener = timeoutListener;
|
||||
}
|
||||
|
||||
void RtpProxyUtil::mediaTimeout() {
|
||||
valid = false;
|
||||
if(timeoutListener != NULL)
|
||||
timeoutListener->onMediaTimeout();
|
||||
}
|
||||
|
||||
unsigned int RtpProxyUtil::setupCaller(const char *callID, const char *callerAddr, int callerPort, const char *fromTag, bool callerAsymmetric) {
|
||||
if(this->callID != NULL)
|
||||
free(this->callID);
|
||||
if((this->callID=(char *)malloc(strlen(callID) + 1))==NULL) {
|
||||
return 0;
|
||||
}
|
||||
if(this->callerAddr != NULL)
|
||||
free(this->callerAddr);
|
||||
if((this->callerAddr=(char *)malloc(strlen(callerAddr) + 1))==NULL) {
|
||||
return 0;
|
||||
}
|
||||
if(this->fromTag != NULL)
|
||||
free(this->fromTag);
|
||||
if((this->fromTag=(char *)malloc(strlen(fromTag) + 1))==NULL) {
|
||||
return 0;
|
||||
}
|
||||
strcpy(this->callID, callID);
|
||||
strcpy(this->callerAddr, callerAddr);
|
||||
this->callerPort = callerPort;
|
||||
strcpy(this->fromTag, fromTag);
|
||||
|
||||
char buf[BUF_SIZE];
|
||||
struct iovec v[1 + 6 + 5] = {{NULL, 0}, {NULL, 0}, {(char *)" ", 1}, {NULL, 0},
|
||||
{(char *)" ", 1}, {NULL, 7}, {(char *)" ", 1}, {NULL, 1}, {(char *)" ", 1}, {NULL, 0},
|
||||
{(char *)" ", 1}, {NULL, 0}};
|
||||
if(callerAsymmetric == true)
|
||||
v[1].iov_base = (char *)"Ua";
|
||||
else
|
||||
v[1].iov_base = (char *)"Us";
|
||||
v[1].iov_len = 2;
|
||||
STR2IOVEC((char *)callID, v[3]);
|
||||
STR2IOVEC((char *)callerAddr, v[5]);
|
||||
sprintf(buf, "%d", callerPort);
|
||||
STR2IOVEC(buf, v[7]);
|
||||
STR2IOVEC((char *)fromTag, v[9]);
|
||||
// STR2IOVEC(toTag, v[11]);
|
||||
char *cp = sendCommandRetry(RTPPROXY_RETRY_COUNT, v, 10, gencookie());
|
||||
if(cp == NULL)
|
||||
throw new exception;
|
||||
callerProxyPort = atoi(cp);
|
||||
proxies[callerProxyPort] = this;
|
||||
return callerProxyPort;
|
||||
}
|
||||
|
||||
void RtpProxyUtil::ammendCaller(const char *callerAddr, int callerPort) {
|
||||
}
|
||||
|
||||
unsigned int RtpProxyUtil::setupCallee(const char *calleeAddr, int calleePort, const char *toTag, bool calleeAsymmetric) {
|
||||
if(this->calleeAddr != NULL)
|
||||
free(this->calleeAddr);
|
||||
if((this->calleeAddr=(char *)malloc(strlen(calleeAddr) + 1))==NULL) {
|
||||
return 0;
|
||||
}
|
||||
if(this->toTag != NULL)
|
||||
free(this->toTag);
|
||||
if((this->toTag=(char *)malloc(strlen(toTag) + 1))==NULL) {
|
||||
return 0;
|
||||
}
|
||||
strcpy(this->calleeAddr, calleeAddr);
|
||||
this->calleePort = calleePort;
|
||||
strcpy(this->toTag, toTag);
|
||||
|
||||
char buf[BUF_SIZE];
|
||||
struct iovec v[1 + 6 + 5] = {{NULL, 0}, {NULL, 0}, {(char *)" ", 1}, {NULL, 0},
|
||||
{(char *)" ", 1}, {NULL, 7}, {(char *)" ", 1}, {NULL, 1}, {(char *)" ", 1},
|
||||
{NULL, 0},
|
||||
{(char *)" ", 1}, {NULL, 0}};
|
||||
if(calleeAsymmetric == true)
|
||||
v[1].iov_base = (char *)"La";
|
||||
else
|
||||
v[1].iov_base = (char *)"Ls";
|
||||
v[1].iov_len = 2;
|
||||
STR2IOVEC(callID, v[3]);
|
||||
STR2IOVEC((char *)calleeAddr, v[5]);
|
||||
sprintf(buf, "%d", calleePort);
|
||||
STR2IOVEC(buf, v[7]);
|
||||
STR2IOVEC(fromTag, v[9]);
|
||||
STR2IOVEC((char *)toTag, v[11]);
|
||||
char *cp = sendCommandRetry(RTPPROXY_RETRY_COUNT, v, 12, gencookie());
|
||||
if(cp == NULL)
|
||||
throw new exception;
|
||||
calleeProxyPort = atoi(cp);
|
||||
proxies[calleeProxyPort] = this;
|
||||
return calleeProxyPort;
|
||||
}
|
||||
|
||||
void RtpProxyUtil::ammendCallee(const char *calleeAddr, int calleePort) {
|
||||
}
|
||||
|
||||
unsigned int RtpProxyUtil::getCallerProxyPort() {
|
||||
return callerProxyPort;
|
||||
}
|
||||
|
||||
unsigned int RtpProxyUtil::getCalleeProxyPort() {
|
||||
return calleeProxyPort;
|
||||
}
|
||||
|
||||
char *RtpProxyUtil::sendCommandRetry(int retries, struct iovec *v, int vcnt, char *my_cookie) {
|
||||
int c = 0;
|
||||
char *result;
|
||||
while(c++ < retries) {
|
||||
result = sendCommand(v, vcnt, my_cookie);
|
||||
if(result != NULL)
|
||||
return result;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *RtpProxyUtil::sendCommand(struct iovec *v, int vcnt, char *my_cookie) {
|
||||
|
||||
struct sockaddr_un addr;
|
||||
int fd, i, len;
|
||||
char *cp;
|
||||
static char buf[256];
|
||||
struct pollfd fds[1];
|
||||
|
||||
len = 0;
|
||||
cp = buf;
|
||||
if (umode == 0) {
|
||||
memset(&addr, 0, sizeof(addr));
|
||||
addr.sun_family = AF_LOCAL;
|
||||
strncpy(addr.sun_path, rtpproxy_sock,
|
||||
sizeof(addr.sun_path) - 1);
|
||||
#ifdef HAVE_SOCKADDR_SA_LEN
|
||||
addr.sun_len = strlen(addr.sun_path);
|
||||
#endif
|
||||
|
||||
fd = socket(AF_LOCAL, SOCK_STREAM, 0);
|
||||
if (fd < 0) {
|
||||
B2BUA_LOG_ERR("send_rtpp_command: can't create socket");
|
||||
return NULL;
|
||||
}
|
||||
if (connect(fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
|
||||
close(fd);
|
||||
B2BUA_LOG_ERR("ERROR: send_rtpp_command: can't connect to RTP proxy: %s", addr.sun_path);
|
||||
//perror("RtpProxyUtil");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
do {
|
||||
len = writev(fd, v + 1, vcnt - 1);
|
||||
} while (len == -1 && errno == EINTR);
|
||||
if (len <= 0) {
|
||||
close(fd);
|
||||
B2BUA_LOG_ERR("ERROR: send_rtpp_command: can't send command to a RTP proxy");
|
||||
return NULL;
|
||||
}
|
||||
do {
|
||||
len = read(fd, buf, sizeof(buf) - 1);
|
||||
} while (len == -1 && errno == EINTR);
|
||||
close(fd);
|
||||
if (len <= 0) {
|
||||
B2BUA_LOG_ERR("ERROR: send_rtpp_command: can't read reply from the RTP proxy, errno = %d", errno);
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
fds[0].fd = controlfd;
|
||||
fds[0].events = POLLIN;
|
||||
fds[0].revents = 0;
|
||||
/* Drain input buffer */
|
||||
while ((poll(fds, 1, 0) == 1) &&
|
||||
((fds[0].revents & POLLIN) != 0)) {
|
||||
recv(controlfd, buf, sizeof(buf) - 1, 0);
|
||||
fds[0].revents = 0;
|
||||
}
|
||||
v[0].iov_base = my_cookie;
|
||||
v[0].iov_len = strlen((const char *)v[0].iov_base);
|
||||
for (i = 0; i < rtpproxy_retr; i++) {
|
||||
do {
|
||||
len = writev(controlfd, v, vcnt);
|
||||
} while (len == -1 && (errno == EINTR || errno == ENOBUFS));
|
||||
if (len <= 0) {
|
||||
/* LOG(L_ERR, "ERROR: send_rtpp_command: "
|
||||
"can't send command to a RTP proxy\n"); */
|
||||
B2BUA_LOG_ERR("ERROR: send_rtpp_command: can't send command to a RTP proxy");
|
||||
return NULL;
|
||||
}
|
||||
while ((poll(fds, 1, rtpproxy_tout * 1000) == 1) &&
|
||||
(fds[0].revents & POLLIN) != 0) {
|
||||
do {
|
||||
len = recv(controlfd, buf, sizeof(buf) - 1, 0);
|
||||
} while (len == -1 && errno == EINTR);
|
||||
if (len <= 0) {
|
||||
/* LOG(L_ERR, "ERROR: send_rtpp_command: "
|
||||
"can't read reply from a RTP proxy\n"); */
|
||||
B2BUA_LOG_ERR("ERROR: send_rtpp_command:can't read reply from a RTP proxy");
|
||||
return NULL;
|
||||
}
|
||||
if (len >= (v[0].iov_len - 1) &&
|
||||
memcmp(buf, v[0].iov_base, (v[0].iov_len - 1)) == 0) {
|
||||
len -= (v[0].iov_len - 1);
|
||||
cp += (v[0].iov_len - 1);
|
||||
if (len != 0) {
|
||||
len--;
|
||||
cp++;
|
||||
}
|
||||
goto out;
|
||||
}
|
||||
fds[0].revents = 0;
|
||||
}
|
||||
}
|
||||
if (i == rtpproxy_retr) {
|
||||
/* LOG(L_ERR, "ERROR: send_rtpp_command: "
|
||||
"timeout waiting reply from a RTP proxy\n"); */
|
||||
B2BUA_LOG_ERR("ERROR: send_rtpp_command: timeout waiting reply from a RTP proxy");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
cp[len] = '\0';
|
||||
return cp;
|
||||
|
||||
}
|
||||
|
||||
|
||||
char *RtpProxyUtil::gencookie() {
|
||||
static char cook[34];
|
||||
|
||||
sprintf(cook, "%d_%u ", (int)mypid, myseqn);
|
||||
myseqn++;
|
||||
return cook;
|
||||
}
|
||||
|
||||
/* ====================================================================
|
||||
*
|
||||
* Copyright 2012 Daniel Pocock. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. Neither the name of the author(s) nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -1,137 +0,0 @@
|
|||
|
||||
#ifndef __RtpProxyUtil_h
|
||||
#define __RtpProxyUtil_h
|
||||
|
||||
#include <map>
|
||||
|
||||
namespace b2bua
|
||||
{
|
||||
|
||||
#define DEFAULT_RTPPROXY_SOCK "/var/run/rtpproxy.sock"
|
||||
#define DEFAULT_RTPPROXY_TIMEOUT_SOCK "/var/run/rtpproxy.timeout.sock"
|
||||
#define DEFAULT_RTPPROXY_RETR 5
|
||||
#define DEFAULT_RTPPROXY_TOUT 1
|
||||
|
||||
#define BUF_SIZE 250
|
||||
|
||||
class RtpProxyUtil {
|
||||
|
||||
public:
|
||||
|
||||
class TimeoutListener {
|
||||
public:
|
||||
virtual ~TimeoutListener() {};
|
||||
virtual void onMediaTimeout() = 0;
|
||||
};
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
// Static variables for system wide settings
|
||||
static int umode;
|
||||
static char *rtpproxy_sock;
|
||||
static int controlfd;
|
||||
static char *timeout_sock;
|
||||
static int timeoutfd;
|
||||
static int timeout_clientfd;
|
||||
static int rtpproxy_retr;
|
||||
static int rtpproxy_tout;
|
||||
static std::map<int, RtpProxyUtil *> proxies;
|
||||
|
||||
// Instance variables for per-instance data
|
||||
pid_t mypid;
|
||||
int myseqn;
|
||||
|
||||
|
||||
TimeoutListener *timeoutListener;
|
||||
|
||||
bool valid;
|
||||
|
||||
char *callID;
|
||||
char *callerAddr;
|
||||
unsigned int callerPort;
|
||||
char *calleeAddr;
|
||||
unsigned int calleePort;
|
||||
char *fromTag;
|
||||
char *toTag;
|
||||
|
||||
unsigned int callerProxyPort;
|
||||
unsigned int calleeProxyPort;
|
||||
|
||||
protected:
|
||||
static char *sendCommandRetry(int retries, struct iovec *v, int vcnt, char *my_cookie);
|
||||
static char *sendCommand(struct iovec *v, int vcnt, char *my_cookie);
|
||||
char *gencookie();
|
||||
|
||||
// called when a media timeout occurs
|
||||
void mediaTimeout();
|
||||
|
||||
public:
|
||||
|
||||
static void setSocket(const char *socket);
|
||||
static void setTimeoutSocket(const char *socket);
|
||||
static void init();
|
||||
// check for timeout data from socket
|
||||
static void do_timeouts();
|
||||
|
||||
RtpProxyUtil();
|
||||
~RtpProxyUtil();
|
||||
|
||||
void setTimeoutListener(TimeoutListener *timeoutListener);
|
||||
|
||||
// Inform rtpproxy of the caller's details
|
||||
unsigned int setupCaller(const char *callID, const char *callerAddr, int callerPort, const char *fromTag, bool callerAsymmetric);
|
||||
// ammend the caller's details (after the caller sends re-INVITE)
|
||||
void ammendCaller(const char *callerAddr, int callerPort);
|
||||
// Inform rtpproxy of the callee's details
|
||||
unsigned int setupCallee(const char *calleeAddr, int calleePort, const char *toTag, bool calleeAsymmetric);
|
||||
// ammend the callee's details
|
||||
void ammendCallee(const char *calleeAddr, int calleePort);
|
||||
|
||||
unsigned int getCallerProxyPort();
|
||||
unsigned int getCalleeProxyPort();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* ====================================================================
|
||||
*
|
||||
* Copyright 2012 Daniel Pocock. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. Neither the name of the author(s) nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -1,99 +0,0 @@
|
|||
|
||||
#include <cassert>
|
||||
#include <list>
|
||||
|
||||
#include "Logging.hxx"
|
||||
#include "TaskManager.hxx"
|
||||
|
||||
using namespace b2bua;
|
||||
using namespace std;
|
||||
|
||||
TaskManager::TaskManager() {
|
||||
}
|
||||
|
||||
void TaskManager::start() {
|
||||
while(true) {
|
||||
int incompleteCount = 0;
|
||||
list<RecurringTask *>::iterator iterator = recurringTasks.begin();
|
||||
while(iterator != recurringTasks.end()) {
|
||||
// FIXME - read return value, remove completed tasks
|
||||
RecurringTask *t = *iterator;
|
||||
iterator++;
|
||||
TaskResult r = t->doTaskProcessing();
|
||||
switch(r) {
|
||||
case TaskComplete:
|
||||
recurringTasks.remove(t);
|
||||
break;
|
||||
case TaskNotComplete:
|
||||
incompleteCount++;
|
||||
break;
|
||||
default:
|
||||
// ignore any other return value
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(incompleteCount == 0) {
|
||||
// All tasks are done
|
||||
B2BUA_LOG_NOTICE("all tasks complete");
|
||||
return;
|
||||
}
|
||||
// FIXME - do scheduled tasks (not yet implemented)
|
||||
}
|
||||
}
|
||||
|
||||
void TaskManager::addRecurringTask(RecurringTask *t) {
|
||||
recurringTasks.push_back(t);
|
||||
}
|
||||
|
||||
void TaskManager::scheduleTask(ScheduledTask *t, time_t& executionTime) {
|
||||
// FIXME - not yet implemented
|
||||
B2BUA_LOG_CRIT("scheduleTask not implemented");
|
||||
assert(0);
|
||||
}
|
||||
|
||||
void TaskManager::stop() {
|
||||
list<RecurringTask *>::iterator iterator = recurringTasks.begin();
|
||||
while(iterator != recurringTasks.end()) {
|
||||
RecurringTask *t = *iterator;
|
||||
iterator++;
|
||||
t->stop();
|
||||
}
|
||||
}
|
||||
|
||||
/* ====================================================================
|
||||
*
|
||||
* Copyright 2012 Daniel Pocock. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. Neither the name of the author(s) nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -1,102 +0,0 @@
|
|||
|
||||
#ifndef __TaskManager_h
|
||||
#define __TaskManager_h
|
||||
|
||||
#include <ctime>
|
||||
#include <list>
|
||||
|
||||
namespace b2bua
|
||||
{
|
||||
|
||||
/**
|
||||
* The TaskManager keeps a record of all recurring tasks, and
|
||||
* also tasks scheduled to take place at a specified time.
|
||||
* It provides an efficient way of giving CPU time to each task.
|
||||
* TaskManager is expected to be used with tasks that do not block
|
||||
* or run for extended periods of time.
|
||||
* TaskManager runs all tasks in a single thread.
|
||||
*/
|
||||
|
||||
class TaskManager {
|
||||
|
||||
public:
|
||||
|
||||
typedef enum TaskResult {
|
||||
TaskComplete, // the task doesn't need to run again
|
||||
TaskNotComplete, // the task would like to run again shortly
|
||||
TaskIndefinite // the task can be run again, but doesn't
|
||||
// object if the TaskManager stops
|
||||
};
|
||||
|
||||
class RecurringTask {
|
||||
public:
|
||||
virtual ~RecurringTask() {};
|
||||
virtual TaskResult doTaskProcessing() = 0;
|
||||
virtual void stop() = 0;
|
||||
};
|
||||
|
||||
class ScheduledTask {
|
||||
public:
|
||||
virtual ~ScheduledTask() {};
|
||||
virtual void doTaskSchedule() = 0;
|
||||
};
|
||||
|
||||
TaskManager();
|
||||
|
||||
/**
|
||||
* Start the task manager - blocks until complete.
|
||||
* Exits when all recurring tasks exit and no scheduled tasks remain.
|
||||
*/
|
||||
void start();
|
||||
void addRecurringTask(RecurringTask *t);
|
||||
void scheduleTask(ScheduledTask *t, time_t& executionTime);
|
||||
|
||||
void stop();
|
||||
|
||||
protected:
|
||||
std::list<RecurringTask *> recurringTasks;
|
||||
std::list<ScheduledTask *> scheduleTasks;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* ====================================================================
|
||||
*
|
||||
* Copyright 2012 Daniel Pocock. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. Neither the name of the author(s) nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
$uname = `uname -a`;
|
||||
|
||||
§ion ("uname -a");
|
||||
print "$uname \n";
|
||||
|
||||
$cc = `make show.CC`;
|
||||
chop $cc;
|
||||
$cc =~ s/.*=//g;
|
||||
|
||||
&exec("$cc --version");
|
||||
|
||||
$conf = `grep := build/Makefile.conf`;
|
||||
§ion("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;
|
||||
§ion($cmd);
|
||||
print `$cmd`."\n";
|
||||
}
|
||||
|
||||
sub section
|
||||
{
|
||||
my ($title) = shift;
|
||||
my ($center) = int(36 - length($title)/2);
|
||||
print (('='x$center)." $title ".('='x$center)."\n");
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1 +0,0 @@
|
|||
.DS_Store
|
||||
|
|
@ -1 +0,0 @@
|
|||
T.J. Mather <tjmather@maxmind.com>
|
||||
|
|
@ -1,509 +0,0 @@
|
|||
[ Note that while the core GeoIP library is licensed under the
|
||||
LGPL, the libGeoIPUpdate library depends on md5.c and types.h
|
||||
which are licensed under the GPL. ]
|
||||
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
|
||||
|
|
@ -1,628 +0,0 @@
|
|||
1.4.8
|
||||
* Fix GEOIP_DOMAIN_EDITION_V6 ( Boris Zentner )
|
||||
* Add new Datatypes GEOIP_NETSPEED_EDITION_REV1_V6 and
|
||||
GEOIP_NETSPEED_EDITION_REV1 ( Boris Zentner )
|
||||
* Fix possible directory traversal weakness in geoipupdate-pureperl.pl with
|
||||
malicious update server ( Boris Zentner )
|
||||
* Fix GEOIP_ORG_EDITION_V6 and GEOIP_ISP_EDITION_V6 ( Boris Zentner )
|
||||
1.4.7
|
||||
* Upd timezone.c Add SX, BQ and CW remove AN and FX ( Boris Zentner )
|
||||
* Add support for the new types in geoiplookup6 ( Boris Zentner )
|
||||
* Add new database types GEOIP_CITY_EDITION_REV0_V6,
|
||||
GEOIP_CITY_EDITION_REV1_V6, GEOIP_DOMAIN_EDITION_V6,
|
||||
GEOIP_ORG_EDITION_V6 and GEOIP_ISP_EDITION_V6 ( Boris Zentner )
|
||||
* Remove AN and FX. Add SX, BQ and CW ( Boris Zentner )
|
||||
* Fix possible segfault in geoipupdate if the connection disappear
|
||||
unexpected. ( Boris Zentner )
|
||||
* Add sanity check for geoipupdate-pureperl.pl ( Boris Zentner )
|
||||
* Add GEOIP_USERTYPE_EDITION and GEOIP_USERTYPE_EDITION_V6
|
||||
datatypes ( Boris Zentner )
|
||||
* Add new functions GeoIP_is_private_ipnum_v4 and GeoIP_is_private_v4
|
||||
( Boris Zentner )
|
||||
* Add new functions GeoIP_teredo and GeoIP_enable_teredo.
|
||||
teredo is enabled by default ( Boris Zentner )
|
||||
* Fix output of geoiplookup for unknown or private regions.
|
||||
( Boris Zentner )
|
||||
* Fix geoipupdate-pureperl.pl to accept more product codes.
|
||||
( Boris Zentner )
|
||||
* Fix minor output issue in geoipupdate -v ( Boris Zentner )
|
||||
* Add support for various databases. ( Boris Zentner )
|
||||
* Add experimental teredo support ( Boris Zentner )
|
||||
* Fix possible buffer overflow in conjunction with
|
||||
http_proxies ( Elso Andras )
|
||||
* Remove memcpy/bcopy macro for BSD ( Boris Zentner )
|
||||
* Add GeoIP_lib_version and GeoIP_cleanup ( Ladar Levison )
|
||||
* Upd Makefile.vc ( Thomas Winzig )
|
||||
* Fix typo in DK,18,Midtjylland ( Boris Zentner )
|
||||
* Update libGeoIP/regionName.c with FIPS codes 20100810 ( Boris Zentner )
|
||||
* Fix continent codes ( Boris Zentner )
|
||||
* Fix 3letter country codes for ATA, BVT, IOT, CXR, CCK, ATF, HMD,
|
||||
MYT, SGS and UMI ( Boris Zentner )
|
||||
* Fix typo/segfault in GeoIP_id_by_name_v6 ( Boris Zentner )
|
||||
* Update libGeoIP/regionName.c with FIPS codes 20100529 ( Boris Zentner )
|
||||
* Remove buffered IO functions, to fix issues with dup'ed file
|
||||
descriptors ( Boris Zentner )
|
||||
* Fix very minor memleak in geoipupdate ( Boris Zentner )
|
||||
* Add GEOIP_CITYCONFIDENCEDIST_EDITION, GEOIP_LARGE_COUNTRY_EDITION
|
||||
and GEOIP_LARGE_COUNTRY_EDITION_V6 database types ( Boris Zentner )
|
||||
* Update libGeoIP/regionName.c with FIPS codes 20100422 ( Boris Zentner )
|
||||
* Update libGeoIP/regionName.c with FIPS codes 20100420 ( Boris Zentner )
|
||||
* Update libGeoIP/regionName.c with FIPS codes 20100221 ( Boris Zentner )
|
||||
* Add missing timezones ( Boris Zentner )
|
||||
* Add missing include for Windows 2000 ( Jaap Keute )
|
||||
* 'GeoIP Database up to date' and 'Updated database' prints to stdout
|
||||
instead of stderr ( Boris Zentner )
|
||||
* Add missing GeoIPRecord_delete to geoiplookup.c ( Piotr Kaczuba )
|
||||
* Add some IPv4 helper functions
|
||||
unsigned long GeoIP_addr_to_num(const char *addr);
|
||||
char * GeoIP_num_to_addr(unsigned long ipnum); ( Boris Zentner )
|
||||
* Fix default name for the accuracy radius database to GeoIPDistance.dat ( Boris Zentner )
|
||||
* Add GEOIP_CITYCONFIDENCE_EDITION database type. ( Boris Zentner )
|
||||
* geoiplookup use GeoIPDistance.dat files if avail ( Boris Zentner )
|
||||
* Fix geoiplookup/geoiplookup6 output, when the databaseinfo string is
|
||||
not avail. ( Boris Zentner )
|
||||
* Change continent code for RU from AS to EU ( Boris Zentner )
|
||||
* Add GEOIP_ACCURACYRADIUS_EDITION database type. ( Boris Zentner )
|
||||
* Add GEOIP_LOCATIONA_EDITION the database to map back from binary to
|
||||
the csv database ( Boris Zentner )
|
||||
* Change Turkey's continent code from Asia to Europe ( Boris Zentner )
|
||||
* Rename _iso_8859_1__utf8 to _GeoIP_iso_8859_1__utf8 ( Boris Zentner )
|
||||
* GEOIP_ORG_EDITION, GEOIP_ISP_EDITION, GEOIP_DOMAIN_EDITION and
|
||||
GEOIP_ASNUM_EDITION databases return UTF8 results, if gi->charset is set
|
||||
to GEOIP_CHARSET_UTF8 ( Boris Zentner )
|
||||
* Avoid unnecesary call to gettimeofday when GEOIP_CHECK_CACHE is not set ( John Douglass )
|
||||
* Delayed loading of changed database files for 60 seconds. To avoid
|
||||
reading halve written databases ( Boris Zentner )
|
||||
* Update README.OSX for Leopard and Snow Leopard ( Boris Zentner )
|
||||
* Add more IPv6 functions ( Boris Zentner )
|
||||
const char *GeoIP_country_code_by_addr_v6 (GeoIP* gi, const char *addr);
|
||||
const char *GeoIP_country_code_by_name_v6 (GeoIP* gi, const char *host);
|
||||
const char *GeoIP_country_code3_by_addr_v6 (GeoIP* gi, const char *addr);
|
||||
const char *GeoIP_country_code3_by_name_v6 (GeoIP* gi, const char *host);
|
||||
const char *GeoIP_country_name_by_addr_v6 (GeoIP* gi, const char *addr);
|
||||
const char *GeoIP_country_name_by_name_v6 (GeoIP* gi, const char *host);
|
||||
* Make sure that GeoIP_*_v6 functions refuse GEOIP_PROXY_EDITION and
|
||||
GEOIP_NETSPEED_EDITION databases ( Boris Zentner )
|
||||
* Update libGeoIP/regionName.c with FIPS codes from 20090723 ( Boris Zentner )
|
||||
* Fix geoipupdate's -v option to not change the license filename ( Thom May )
|
||||
* Fix geoipupdate's exit code ( Thom May )
|
||||
* Add support for ASNUM_EDITION ( Boris Zentner )
|
||||
* Fix -i output for larger values, sign issue ( Boris Zentner )
|
||||
* Add -i flag for more information on netmask, range_by_ip and the current network range ( Boris Zentner )
|
||||
* Add support for DOMAIN_EDITION database type ( Boris Zentner )
|
||||
* Fix apps/geoipupdate-pureperl.pl output layer on W32 ( Boris Zentner )
|
||||
1.4.6 2009-02-25
|
||||
* Fix geoipupdate's my_printf function ( Boris Zentner )
|
||||
* Fix typo in apps/geoipupdate-pureperl.pl replace PerlIO::Gzip with PerlIO::gzip ( Boris Zentner )
|
||||
* Update region codes in libGeoIP/regionName.c ( Boris Zentner )
|
||||
* Fix regioncode/generate_regionName.pl to handle regioncodes with ',' correct ( Boris Zentner )
|
||||
* Update fips codes 20090201 ( Boris Zentner )
|
||||
* Fix unicode builds on WIN32 and eliminate some warnings ( Stu Redman )
|
||||
* Fix sign error in _iso_8859_1__utf8 for PPC64 ( Boris Zentner )
|
||||
* Change WIN32 to _WIN32, since _WIN32 is defined by default. _WIN32 is also defined for WIN64 machines ( Boris Zentner )
|
||||
! Remove the WSAStartup call from GeoIP_open. All Applications need to call WSAStartup and WSACleanup to initialize the Windows Socket library. Before they use any of the GeoIP_*_by_name functions. ( Boris Zentner )
|
||||
* geoiplookup and test-geoip-* output N/A instead of (null) ( Boris Zentner )
|
||||
* Silence various warnings. ( Boris Zentner )
|
||||
* Add more timezone region's for Australia
|
||||
* Fix possible segfault in apps/geoiplookup with null pointers in non gnu printf implementations for example solaris ( Boris Zentner )
|
||||
* Add README.OSX to build fat binaries easy ( Boris Zentner )
|
||||
* Silence vasprintf warning via AC_GNU_SOURCE ( Boris Zentner )
|
||||
* Add several Makefiles to build a static GeoIP.lib for w32 ( Stanislaw Pusep and Randy Kobes )
|
||||
* Silence signedness warnings ( Peter Volkov )
|
||||
* Remove --with-city configure option. ( Boris Zentner )
|
||||
* Remove configure's --with-dbdir option. Use the similar --datadir instead ( Peter Volkov )
|
||||
* Various autotools improvements and cleanups. Including parallel
|
||||
build fix ( Peter Volkov )
|
||||
* Fix libGeoIP/timeZone.c ( Martin Haller )
|
||||
* Fix timezone/generate_timeZone.pl ( Boris Zenter )
|
||||
* Sync FIPS codes again Jan 14th, 2009 ( Boris Zentner )
|
||||
* Fix CA,NL regioncode. ( Boris Zentner )
|
||||
* Change logic in generate_regionName.pl and GeoIP_region_name_by_code to handle any mixture of two letter fips codes matching [A-Z0-9]{2} the change allow GZ and WE region codes ( Boris Zentner )
|
||||
* Sync regionName.c with http://www.maxmind.com/app/fips10_4 from Dec 17th, 2008 ( Boris Zentner )
|
||||
* Fix _GeoIP_lookupaddress for 64bit big endian systems like ppc64 ( Peter Volkov )
|
||||
* Add proper WIN32/64 support ( Gerald Combs )
|
||||
* Escape - in all manpages ( Patrick Matthaei )
|
||||
* Add manpage for geoiplookup6 ( Boris Zentner )
|
||||
* Fix -d command line option ( Klaus Heinz )
|
||||
* GeoIPUpdate.c use vasprintf if avail, otherwise try vsnprintf and sprintf ( Boris Zentner )
|
||||
* avoid pre/postincrement and assignment on the same variable ( Boris Zentner )
|
||||
1.4.5 2008-09-16
|
||||
* metro_code replace the depreciated dma_code field ( Boris Zentner )
|
||||
* Add new function GeoIP_range_by_ip_delete
|
||||
r = GeoIP_range_by_ip(gi, '24.24.24.24');
|
||||
...
|
||||
GeoIP_range_by_ip_delete(r); ( Boris Zentner )
|
||||
* Fix small memoryleak and wrap around in GeoIP_range_by_ip ( Boris Zentner )
|
||||
* CHECK_CACHE stat the database file not faster than once a second anymore ( Patrick McManus )
|
||||
* Fixed a typo in the geoipupdate(1) manpage and also an non-existent path on Debian (Patrick Matthäi)
|
||||
* Fixes two little format errors (hyphen used as minus sign) in both manpages (Patrick Matthäi)
|
||||
* Sync regionName.c with a recent fips code list ( Boris Zentner )
|
||||
* Fix segfault when open failed for a custom file (-f) ( Boris Zentner )
|
||||
* Fix sync geoiplookup's man page with the code ( Klaus Heinz )
|
||||
* remove unused code from GeoIP_country_name_by_addr and GeoIP_country_code3_by_addr ( Boris Zentner )
|
||||
* Fix geoiplookup and geoiplookup6 to distinguish between failed namelookups and unknown ips ( Boris Zentner )
|
||||
* add geoiplookup6 that can handle the new database type GEOIP_COUNTRY_EDITION_V6 ( Boris Zentner )
|
||||
* add new functions to handle ipv6
|
||||
|
||||
GEOIP_API const char *GeoIP_country_name_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum);
|
||||
GEOIP_API const char *GeoIP_country_code_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum);
|
||||
GEOIP_API const char *GeoIP_country_code3_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum);
|
||||
GEOIP_API char *GeoIP_org_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum);
|
||||
GEOIP_API char *GeoIP_org_by_addr_v6 (GeoIP* gi, const char *addr);
|
||||
GEOIP_API char *GeoIP_org_by_name_v6 (GeoIP* gi, const char *name);
|
||||
GEOIP_API int GeoIP_id_by_addr_v6 (GeoIP* gi, const char *addr);
|
||||
GEOIP_API int GeoIP_id_by_name_v6 (GeoIP* gi, const char *host);
|
||||
GEOIP_API int GeoIP_id_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum);
|
||||
GEOIP_API GeoIPRegion * GeoIP_region_by_addr_v6 (GeoIP* gi, const char *addr);
|
||||
GEOIP_API GeoIPRegion * GeoIP_region_by_name_v6 (GeoIP* gi, const char *host);
|
||||
GEOIP_API GeoIPRegion * GeoIP_region_by_ipnum_v6 (GeoIP *gi, geoipv6_t ipnum);
|
||||
GEOIP_API void GeoIP_assign_region_by_inetaddr_v6(GeoIP* gi, geoipv6_t inetaddr, GeoIPRegion *gir);
|
||||
GEOIP_API char *GeoIP_name_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum);
|
||||
GEOIP_API char *GeoIP_name_by_addr_v6 (GeoIP* gi, const char *addr);
|
||||
GEOIP_API char *GeoIP_name_by_name_v6 (GeoIP* gi, const char *name);
|
||||
|
||||
# allowed input for addr
|
||||
2001:4860:0:1001::68
|
||||
::85.8.93.71
|
||||
::1
|
||||
::5508::5d47
|
||||
::ffff:5508::5d47
|
||||
|
||||
# allowed input for host
|
||||
ipv6.google.com
|
||||
2001:4860:0:1001::68
|
||||
::85.8.93.71
|
||||
::1
|
||||
::5508::5d47
|
||||
::ffff:5508::5d47
|
||||
( Boris Zentner )
|
||||
* Fix geoiplookup usage string ( add -d -f ) ( Boris Zentner )
|
||||
* Added GeoIP_range_by_ip, returns the start and end IP address for the range containing the IP address.
|
||||
This range has a constant value in the GeoIP database.
|
||||
* Add geoipupdate-pureperl.pl a alternative geoipupdate version. with Proxy Server support via via the "http_proxy" environment variable. Easy to customize. ( Boris Zentner )
|
||||
* Add WIN64 since WIN32 is not defined on WIN64 Systems ( Boris Zentner )
|
||||
* Fix WIN32 compilation by encircle all MMAP functions with #ifdef WIN32 #endif pairs. MMAP is not avail in W32 ( Boris Zentner )
|
||||
* Update timezone/generate_timeZone.pl ( Boris Zentner )
|
||||
* Update libGeoIP/timeZone.c ( Boris Zentner )
|
||||
* Added GeoIP_printf and GeoIP_fprintf as a experimental feature to
|
||||
libGeoIPUpdate. ( Boris Zentner, Andrew Droffner )
|
||||
* Added cast in _iso_8859_1__utf8 function to fix NetWare/Win32 compilation issue (Guenter Knauf)
|
||||
* Add HTTP Proxy Server support for geoipupdate via the "http_proxy"
|
||||
environment variable.
|
||||
ie: export http_proxy="http://proxy-hostname:port"
|
||||
( Andrew Droffner, Derek Nicol )
|
||||
* Notice, that __YOU__ need to free the results of
|
||||
|
||||
GeoIP_database_info
|
||||
GeoIP_name_by_ipnum
|
||||
GeoIP_name_by_addr
|
||||
GeoIP_name_by_name
|
||||
GeoIP_org_by_ipnum
|
||||
GeoIP_org_by_addr
|
||||
GeoIP_org_by_name
|
||||
|
||||
not libgeoip
|
||||
( Boris Zentner, Andrew Cheung )
|
||||
* Fixed segfault with geoiplookup, if used with a custom_file database, that
|
||||
could not be opened. ( Boris Zentner )
|
||||
* Add Usage info for options -f and -d in geoipupdate ( Boris Zentner )
|
||||
* Fixed segfault with geoipupdate when called with a illformed license file
|
||||
( Boris Zentner )
|
||||
* Update add more timezones to GeoIP_time_zone_by_country_and_region
|
||||
( Boris Zentner )
|
||||
* Add array access functions so programs can avoid accessing the
|
||||
arrays directly which whould break binary compatability (Ludwig Nussel at SUSE)
|
||||
* Updated README to state API is only thread-safe if GEOIP_CHECK_CACHE is not used
|
||||
|
||||
1.4.4 2008-1-21
|
||||
* Updated original geoipupdate to return "Invalid product ID or subscription expired"
|
||||
* Added BL/Saint Barthelemy, MF/Saint Martin (ISO-3166-1 additions)
|
||||
* Check for illegal IP strings, return 0 if IP is not well formed IPv4 e.g. 1.2.3.4.5 and 1.2.3
|
||||
* Clarified that while core GeoIP library is LGPL, libGeoIPUpdate depends on md5.c and types.h which are GPL.
|
||||
* speedup the conversion from ipstring to ipnum in _GeoIP_addr_to_num. Doubles the speed of GEOIP_MEMORY_CACHE and GEOIP_MMAP_CACHE
|
||||
* Added new mmap shared memory caching option, GEOIP_MMAP_CACHE (Peter Shipley, LookSmart)
|
||||
- mmaps: our maps are shared, but we need only private readonly pages
|
||||
|
||||
1.4.3 2007-8-30
|
||||
! CHANGE with geoiplookup facility: -v flag now returns database info for all databases, not just GeoIP Country
|
||||
* Added ability to get netmask of network block from last lookup using GeoIP_last_netmask
|
||||
* Fixed GeoIP_database_info bug with GeoLite City
|
||||
* Replaced 4 with sizeof(char*) to fix issues with geoipupdate on 64 Bit machines
|
||||
* Added GeoIP_set_charset function - enables UTF8 output of city name if GEOIP_CHARSET_UTF8 flag is passed
|
||||
to GeoIP_set_charset
|
||||
* Fixed segfault issue if calling GeoIP_db_avail before opening a database
|
||||
* Added continent_code to GeoIP City's record struct (Frank Mather)
|
||||
|
||||
1.4.2 2007-2-8
|
||||
* Added -d flag to enable custom path for geoipupdate utility program (Frank Mather)
|
||||
* Replaced _WIN32 with WIN32 since WIN32 is already set by compilers
|
||||
* Moved var definitions to top of code, defined size_t (Guenter Knauf)
|
||||
* Added Makefile.win32, Makefile.netware, get_ver.awk, geoip.ico to EXTRA_DIST in Makefile.am (Guenter Knauf)
|
||||
|
||||
1.4.1 2007-1-2
|
||||
* Replaced CS/Serbia and Montenegro with RS/Serbia, removed ZR/Zaire, added ME/Montenegro
|
||||
* Added AX/Aland Islands, GG/Guernsey, IM/Isle of Man, JE/Jersey (ISO-3166-1 changes)
|
||||
* Added GeoIP_time_zone_by_country_and_region, to lookup zoneinfo timezone by country and region (Frank Mather)
|
||||
* Added GeoIP_region_name_by_code, to lookup region name from region code (Frank Mather)
|
||||
* added -f and -d flags to enable custom paths for geoiplookup utility program (Frank Mather)
|
||||
* Added benchmarks for GeoIP Region and City in test/benchmark.c (Frank Mather)
|
||||
* Fixed build issue when using --as-needed flag (Diego 'Flameeyes' Pettenò)
|
||||
* Add sanity checking for filename returned by MaxMind.com server for geoipupdate filename
|
||||
(Dean Gaudet, arctic.org)
|
||||
* Fixed memory leaks under error conditions, buffer overflow using sprintf,
|
||||
and issue where a corrupted cache file could core dump the file
|
||||
(Nick Galbreath, Right Media Inc)
|
||||
|
||||
1.4.0 2006-8-7
|
||||
* Changed license from GPL to LGPL, so that PHP Extension can be included in PECL (Olivier Hill)
|
||||
* Rewrote GEOIP_CHECK_CACHE code, fixed numerous bugs
|
||||
- CheckCache now works if GeoIP file is overwriten by mv command
|
||||
- Fixed bug where CheckCache kept reloading in GEOIP_STANDARD_MODE
|
||||
- Fixed segfault issue in GEOIP_MEMORY_CACHE mode
|
||||
- Fixed garbage data appearing in GEOIP_INDEX_CACHE mode
|
||||
- Fixed realloc in case realloc returns new memory block (Andre Morozov of Stone Steps)
|
||||
* Updated geoipupdate to print status messages for each database instead of just last database
|
||||
* Check that gi is not null before running code in GeoIP_delete
|
||||
* Fixed alpha-3 codes ordering, replaced TLS,TKM,TUN,TON with TKM,TUN,TON,TLS
|
||||
* TP/East Timor changed to TL/Timor-Leste, reflecting changes in ISO-3166
|
||||
* Added Netware and Windows makefiles (Guenter Knauf)
|
||||
* Fixed NetWare compiler issue with char block[block_size] declaration (Guenter Knauf)
|
||||
* Updated geoipupdate example to run weekly
|
||||
|
||||
1.3.17 2006-5-14
|
||||
* Fixed headers for Windows/Netware compilation (Guenter Knauf)
|
||||
* Fixed Received Error -21 (Sanity check database_info string failed)
|
||||
when running geoipupdate with GeoIP Country when UserId and
|
||||
productIds were not specified. Bug was introduced in 1.3.15.
|
||||
|
||||
1.3.16 2006-4-17
|
||||
* Fixed compliation error in GeoIPUpdate.c
|
||||
|
||||
1.3.15 2006-4-14
|
||||
* Updated README documentation
|
||||
* Updated geoipupdate so that it writes file as it is uncompressed instead
|
||||
of storing entire GeoIP.dat file in memory (Frank Mather)
|
||||
* Updated geoiplookup so that it returns GeoIP Domain Name if available
|
||||
(Frank Mather)
|
||||
* Updated geoipupdate so that it reports whether databases are updated
|
||||
in non-verbose mode (Frank Mather)
|
||||
|
||||
1.3.14 2005-9-7
|
||||
* Check if byte, ushort, ulong, u16, u32 are defined in configure
|
||||
script. Fixes compilation issue on FreeBSD systems.
|
||||
* Check for Big Endian byte order (needed for MD5 code in geoipupdate
|
||||
to work properly on Mac OS X and other Big Endian processors)
|
||||
* Fixed GEOIP_CHECK_CACHE mode when used with GEOIP_STANDARD to
|
||||
only refresh upon file change
|
||||
* Fixed memory leak when refreshing file in GEOIP_CHECK_CACHE mode
|
||||
* Updated ltmain.sh to support Debian GNU/k*BSD bug #315425 (Marek Habersack)
|
||||
* Added lookup functions using IP numeric representation as input (Frank Mather)
|
||||
* Removed geoipexport
|
||||
* Replaced Yugoslavia with Serbia and Montenegro
|
||||
* Updated geoiplookup to only perform country lookup once instead of twice by using GeoIP_id_by_name
|
||||
|
||||
1.3.13 2005-8-1
|
||||
* Fixed autoconf weirdness that resulted in libraries being
|
||||
installed without .so suffix
|
||||
|
||||
1.3.12 2005-7-19
|
||||
* Removed -lGeoIP from libGeoIPUpdate_la_LIBADD - fixes compilation error
|
||||
if GeoIP isn't already installed (Thomas Steudten)
|
||||
|
||||
1.3.11 2005-7-7
|
||||
* Fixed gcc warnings and bug. Use int
|
||||
instead of char for checking the return value of getopt in geoipupdate.c.
|
||||
Moved the internal functions to GeoIP_internal.h to get rid
|
||||
of those 'implicit declaration' warnings. (Ludwig Nussel/SUSE)
|
||||
* Cleaned up name space by prefixing internal functions with
|
||||
_GeoIP* (Ludwig Nussel/SUSE)
|
||||
* Memory Leak fix for GeoIP City if fread error
|
||||
* Added more verbose error messages for geoipupdate (Frank Mather)
|
||||
* Added check for zlib.h to configure.in
|
||||
|
||||
1.3.10 2005-4-17
|
||||
* Added types.h to Makefile.am - fixes compilation error
|
||||
|
||||
1.3.9 2005-4-14
|
||||
* fixed bug with GEOIP_INDEX_CACHE (Frank Mather)
|
||||
* fixed segfault issue if GeoIP.dat not found (Frank Mather)
|
||||
* Updated MD5 checksum code to use GnuPG code which works
|
||||
on 64bit machines (Frank Mather)
|
||||
* Fixed memory leak in test-geoip-isp.c and test-geoip-org.c
|
||||
* Added support for GeoIP Domain Names in geoipupdate
|
||||
|
||||
1.3.8 2004-11-7
|
||||
* Updated geoipupdate to report invalid userID and productID errors
|
||||
* Check if gethostbyname_r is version that returns int or is other version
|
||||
- should fix compile errors on Solaris and FreeBSD
|
||||
* Updated URL to get license key, userId, and product Ids in conf/GeoIP.conf.default
|
||||
* Updated test case, removed www.asahi.com
|
||||
* Added support for GEOIP_INDEX_CACHE - which just caches
|
||||
the most frequently access index portion of the database, resulting
|
||||
in faster lookups than GEOIP_STANDARD, but less memory usage than
|
||||
GEOIP_MEMORY_CACHE (Frank Mather)
|
||||
|
||||
1.3.7 2004-10-5
|
||||
* Updated test case, removed www.bundesregierung.de added www.asahi.com
|
||||
|
||||
1.3.6 2004-8-8
|
||||
* Check for gethostbyname_r support in configure (Mac OS X doesn't support gethostbyname_r)
|
||||
* Made GeoIP City code thread safe
|
||||
* Fixed bug with geoipupdate reading in product ids
|
||||
* Added support for GeoIP Netspeed geoipupdate
|
||||
* Fix memleak in lookupaddress (Ludwig Nussel/SUSE)
|
||||
* Add prototype for _full_path_to to make 64bit clean
|
||||
(Ludwig Nussel/SUSE)
|
||||
* Add return values to test programs (Ludwig Nussel/SUSE)
|
||||
|
||||
1.3.5 2004-7-5
|
||||
* Added more documentation to README file
|
||||
* Made GEOIP_CHECK_CACHE work with GEOIP_STANDARD mode - reloads filehandle
|
||||
in case file changes.
|
||||
* Added GeoIP_country_code_by_ipnum and GeoIP_id_by_ipnum to use
|
||||
existing ulong IP Address in numeric form instead of having to
|
||||
convert it to string (Boris Hajduk)
|
||||
* Made code thread safe by replacing gethostbyname with gethostbyname_r
|
||||
|
||||
1.3.4 2004-6-4
|
||||
* Fixed bug where *.gz file(s) didn't get removed after geoipupdate
|
||||
|
||||
1.3.3 2004-6-2
|
||||
* Added support for NetSpeed lookup to geoiplookup
|
||||
* inet_addr patch for 64 bit systems (Thomas Steudten)
|
||||
* Added Support for automated downloads of GeoIP Region, City, ISP and Organization databases (Frank Mather)
|
||||
* INADDR_NONE Patch for Solaris 9 (John Young)
|
||||
|
||||
1.3.2 2004-4-20
|
||||
* Added support for Maxmind NetSpeed
|
||||
|
||||
MinGW patch from Stanislaw Pusep
|
||||
|
||||
I was re-compiling Geolizer (http://sysd.org/log.php#glzr) on Win32 so I firstly needed to put up-to-date Win32 compatibility of libGeoIP itself. Fortunately MinGW plataform evolved a lot since last time I used it to compile libGeoIP. I'm sending you the patch with changes required for libGeoIP to work on both Win32 and UN*X. UN*X behavior is unaffected. Now, detailed explanation of what I did at all:
|
||||
1) Made correct header imports for both Win32 and UN*X. UN*X imports netdb.h & netinet/in.h and Win32 imports windows.h & winsock.h
|
||||
2) Win32 gethostbyname() is only able to resolve hostnames, it can't convert "127.0.0.1" string to 32-bit IP address. Thus I added lookupaddress() function that safely resolves any string to IP address and replaced all gethostbyname() calls by it.
|
||||
3) Database files were referenced by pre-compiled static strings. I malloc()ed buffers for file names so they can be changed "on fly". Thus, on Win32 version GeoIP.dat & other files are being seeked in the same directory as executable file or library.
|
||||
4) Added README.MinGW file with brief explanation on how to get GeoIP working under MinGW system.
|
||||
|
||||
1.3.1 2003-11-11
|
||||
* Check for stdint.h in autoconf (Sean Chittenden)
|
||||
* prevent the geoipupdate man page from trying to install itself directly in the system directory (Gyepi Sam)
|
||||
|
||||
1.3.0 2003-09-29
|
||||
* Fixed includes to compile on Windows (Fabrice Colin)
|
||||
* Removed the _addr_to_num() calls from GeoIP_*_by_name()
|
||||
* _seek_record() optimizations (Maurice Cinquini)
|
||||
1) Use a single buf ptr inside the loops.
|
||||
Set to the stack buffer or the cached memory the start of the function.
|
||||
2) Unroll the i=0,1 loop to allow constant folding.
|
||||
3) Unroll the j loop for the common case of j = STANDARD_RECORD_LENGTH
|
||||
(I've already done the above changes see attached function.)
|
||||
With gcc -O2 calculating x[0] and x[1] for STANDARD_RECORD_LENGTH now
|
||||
only takes 15 (was > 100) i80x86 instructions with 6 byte accesses of RAM. 4) only calculate x[0], x[1] when needed, may be a bigger win
|
||||
than the above since all the other optimizations above only reduced
|
||||
CPU instructions operating on CPU cached RAM.
|
||||
! IMPORTANT API Change: Changed GeoIPRegion to have region in structure. Saves space and a malloc.
|
||||
Since GeoIPRegion.region is no longer a pointer but an in-structure
|
||||
array so test the first byte of region == 0 rather testing if the region
|
||||
pointer is NULL. (Maurice Cinquini)
|
||||
* Added GeoIP_assign_region_by_inetaddr which doesn't do any mallocs and made all other region APIs go thru it (Maurice Cinquini)
|
||||
* Replaced _h_addr_to_num() with ntohl() and removed _h_addr_to_num() (Maurice Cinquini)
|
||||
* Fixed bug when IP address not found in region rev1 database (Jason Linhart)
|
||||
* Added added extern "C" to GeoIPCity.h fixes problems when included in C++ library
|
||||
|
||||
1.2.2 2003-08-10
|
||||
* Added support for GeoIP ISP Edition identifier
|
||||
* Fixed bug in GeoIP_database_info (Jason Linhart)
|
||||
* Added support for GeoIP AS Number Edition
|
||||
! renamed GeoIP_org_by_* functions to GeoIP_name_by_* to reduce confusion
|
||||
since these functions are used by GeoIP ISP and GeoIP ASNum as well
|
||||
as GeoIP Organization
|
||||
* Added support for GeoIP Proxy Edition
|
||||
! renamed GeoIP_country_id_by_* functions to GeoIP_id_by_*
|
||||
|
||||
1.2.1 2003-07-12
|
||||
* Added GeoIP_record_id_by_addr and GeoIP_next_record functions
|
||||
* Added support for new GeoIP Region format, including Canadian Provinces
|
||||
|
||||
1.2.0 2003-04-26
|
||||
* Added support for GeoIP City format revision 1, including dma code and area code
|
||||
* geoiplookup returns results from GeoIP Region, City, ISP and Organization databases
|
||||
* Standardized location for GeoIP Region, City, ISP and Organization databases
|
||||
* Added GeoIP_open_type to open database from default location for other dbs besides country
|
||||
* Added check to make sure that the appropriate database is loaded for each lookup method
|
||||
* Updated update code to check for first 12 characters of license key
|
||||
* Added GeoIP_country_continent array to lookup continent by country ID
|
||||
|
||||
1.1.9 2003-03-10
|
||||
* merged windows patch into main code base (Kenneth R. Robinette)
|
||||
* Changed const int to #define for windows compatibility
|
||||
|
||||
1.1.8 2003-03-04
|
||||
* Fixed bug with city database introduced in 1.1.6
|
||||
|
||||
1.1.7 2003-03-04
|
||||
* Fixed bug introduced in 1.1.6 when run in GEOIP_STANDARD mode
|
||||
* Added test to test GEOIP_STANDARD
|
||||
|
||||
1.1.6 2003-03-03
|
||||
* Added spec for building RPMs (Ryan Weaver)
|
||||
* Added support for 4byte records for Organization database
|
||||
* Changed Taiwan, Province of China to Taiwan
|
||||
|
||||
1.1.5 2003-02-10
|
||||
* Added support for GeoIP Organization database
|
||||
|
||||
1.1.4 2002-12-30
|
||||
* Cast number to int in _num_to_addr in geoipexport (Ralf S. Engelschall)
|
||||
* Removed printf debug statements from geoipexport
|
||||
* correct library build ordering (Ralf S. Engelschall)
|
||||
* ulong -> unsigned long (Sean Chittenden)
|
||||
|
||||
1.1.3 2002-12-24
|
||||
* Added GeoIPUpdate.h to EXTRA_DISTS
|
||||
* Compile fixes for Solaris, FreeBSD (Michael McClennen, Corris Randall)
|
||||
* Handle NULL in printf in test-geoip-region
|
||||
|
||||
1.1.2 2002-12-16
|
||||
* Added support for postal codes
|
||||
* Added geoipexport, program to export bit binary file to
|
||||
binary tree format and csv format
|
||||
* Split update code into separate library, GeoIPUpdate.la
|
||||
* Allow passing NULL callback to GeoIP_update_database function
|
||||
(Sean Chittenden)
|
||||
* Added geoipexport program, exports to CSV file
|
||||
* Added GeoIP_database_edition method
|
||||
* Changed DATADIR to GEOIPDATADIR
|
||||
|
||||
1.1.1 2002-11-07
|
||||
* Fixed segfault issue with GeoIPRegion_delete
|
||||
* Handle test failures where lookup returns NULL more gracefully
|
||||
|
||||
1.1.0 2002-11-06
|
||||
* Perform sanity checking before installing datebase using geoipupdate
|
||||
* Removed file locking, since we install file by renaming instead of writing to it.
|
||||
* Fixed geoipupdate to check for NULL return value
|
||||
* Added constants for different editions
|
||||
* Added O1 code for "Other country", used in per-country city editions
|
||||
* fixed multi-line string literals warning in test-geoip.c
|
||||
* Use enum constants for GeoIP_update_database values
|
||||
* Added GEOIP_CHECK_CACHE option (not working yet)
|
||||
|
||||
1.0.10 2002-10-28
|
||||
* IMPORTANT API Change - Return NULL instead of '--' and 'N/A'
|
||||
Be sure to check the return value for NULL to avoid segmentation faults!!!!
|
||||
* Added callback to print messages from GeoIP_update_database
|
||||
* Moved GeoIPConfFile to geoipupdate.c
|
||||
* Changed databaseSegments to unsigned int (Chris Gibbs)
|
||||
* Fixed compiler warnings (Chris Gibbs)
|
||||
* API Change - GeoIPRegion region member set to NULL when no region available
|
||||
* Change short int to int (Chris Gibbs)
|
||||
* Added write/read file locking for GeoIPUpdate.c/GeoIP.c
|
||||
|
||||
1.0.9 2002-10-16
|
||||
* removed -ansi from Makefile.am to avoid compile error on Solaris 8
|
||||
* Compile fix for FreeBSD Stable (Kimura Fuyuki)
|
||||
|
||||
1.0.8 2002-10-05
|
||||
* Included header required for *BSD (Akinori Musha)
|
||||
|
||||
1.0.7 2002-10-05
|
||||
* Fixed compilation error with GeoIPUpdate.c
|
||||
|
||||
1.0.6 2002-10-04
|
||||
* Moved update code into separate file
|
||||
* Added md5 checksums to update code
|
||||
* Fixed memory leak when running geoiplookup -v
|
||||
* Moved const RECORD_LENGTH to #define RECORD_LENGTH for Windows compatibility
|
||||
(Randy Kobes)
|
||||
* Cleaned up GeoIP_new code
|
||||
|
||||
1.0.5 2002-09-23
|
||||
* Supports GeoIP Regional Edition
|
||||
* Macau is now "Macao" per ISO 3166-1 change
|
||||
* Romania "ROM" is now "ROU" per ISO 3166-1 change
|
||||
* Added #define for memcpy -> BSD's bcopy (Chris Gibbs)
|
||||
* Removed "private" functions from GeoIP.h
|
||||
|
||||
1.0.4 2002-08-27
|
||||
* rewrote _seek_country to use loop instead of recursion for faster performance
|
||||
* Removed "orphan" nodes from demo database resulting in smaller size (Jason Linhart)
|
||||
* Moved changes for building windows DLL into separate patch
|
||||
* Fixed segfaults when passed malformed IP addresses
|
||||
|
||||
1.0.3 2002-08-26
|
||||
* Added more changes for windows compatibility
|
||||
(Stanislaw Pusep)
|
||||
* Added benchmark program
|
||||
|
||||
1.0.2 2002-08-21
|
||||
* Open database using "rb" for windows compatibility
|
||||
(Stanislaw Pusep)
|
||||
* Removed superfluous inet_ntop command (Stanislaw Pusep)
|
||||
|
||||
1.0.1 2002-08-20
|
||||
* Fixed bug with resolving hostnames
|
||||
* More fixes for compiler warnings (Chris Gibbs)
|
||||
* Changed int to unsigned int in _is_ipaddr (Chris Gibbs)
|
||||
|
||||
1.0.0 2002-08-12
|
||||
* Changed license to GPL
|
||||
* Don't perform Reverse DNS lookups on IP addresses
|
||||
* Only include getopt.h on Linux (OpenPKG patch)
|
||||
* Avoid the_license_key_str warning (OpenPKG patch)
|
||||
* Added license for March 2002 database
|
||||
|
||||
0.3.0 2002-08-04
|
||||
* Added support for 'A2', Satellite Providers
|
||||
|
||||
0.2.8 2002-07-30
|
||||
* Handle malformed input gracefully
|
||||
* Added section to README on Solaris workarounds
|
||||
* Added geoipupdate man page
|
||||
|
||||
0.2.7 2002-07-27
|
||||
* Added section to README on automatic updates
|
||||
* link to socket library on solaris
|
||||
|
||||
0.2.6 2002-07-25
|
||||
* optimized GeoIP_open (Chris Gibbs)
|
||||
* check for partial file read in GeoIP_open (Chris Gibbs)
|
||||
* optimized _addr_to_num() (Chris Gibbs)
|
||||
* changed write and read to send and recv for sockets
|
||||
* Only install GeoIP.conf and GeoIP.dat if not already installed
|
||||
|
||||
0.2.5 2002-07-22
|
||||
* Added verbose option to GeoIP_update_database
|
||||
|
||||
0.2.4 2002-07-22
|
||||
* Fix for GeoIP_update_database
|
||||
|
||||
0.2.3 2002-07-22
|
||||
* Fixes for FreeBSD
|
||||
* All calls to malloc are checked for NULL pointer (Chris Gibbs)
|
||||
* Fixed spelling of "Kazakhstan" (Chris Gibbs)
|
||||
* Initialize cache_buf to NULL (Chris Gibbs)
|
||||
* More memory leak fixes (Chris Gibbs)
|
||||
|
||||
0.2.2 2002-07-18
|
||||
* Added update database function
|
||||
* Fixed memory leak in GeoIP_new (Chris Gibbs)
|
||||
|
||||
0.2.1 2002-07-03
|
||||
* Added support for anonymous proxies
|
||||
|
||||
0.2.0 2002-06-23
|
||||
* Added new memory caching option for improved performance
|
||||
|
||||
0.1.7 2002-05-29
|
||||
* Only add -lnsl for systems that support libnsl
|
||||
* Added decl for 3 letter country code array to GeoIP.h
|
||||
|
||||
0.1.6 2002-05-25
|
||||
* Added 3 letter country code
|
||||
|
||||
0.1.5 2002-05-23
|
||||
* Added -lnsl fixed compile errors
|
||||
|
||||
0.1.4 2002-05-11
|
||||
* Fixed bugs in demo March 2002 database
|
||||
|
||||
0.1.3 2002-04-21
|
||||
* Fixed bug related to signed int (Brian Grossman)
|
||||
* Better error handling when hostname not found
|
||||
* Fixed bug when netmask=32 for netblock
|
||||
|
||||
0.1.2 2002-04-20
|
||||
* Added two new functions, GeoIP_country_id_by_addr
|
||||
and GeoIP_country_id_by_name.
|
||||
* Made GeoIP_country_code and GeoIP_country_name
|
||||
viewable outside of library, to be with with
|
||||
GeoIP_country_id_by_* functions.
|
||||
|
||||
0.1.1 2002-04-07
|
||||
* GeoIP.h is now installed to includedir
|
||||
* constructor and destructor are now provided by
|
||||
GeoIP_new, GeoIP_open, and GeoIP_delete
|
||||
|
||||
0.1.0 2002-04-07
|
||||
* Initial release
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
Name: @PACKAGE@
|
||||
Version: @VERSION@
|
||||
Summary: GeoIP is a C library finds the location of an IP address.
|
||||
Release: 1
|
||||
Group: System Environment/Libraries
|
||||
URL: http://www.maxmind.com/app/c
|
||||
Vendor: MaxMind LLC
|
||||
Source0: http://www.maxmind.com/download/geoip/api/c/GeoIP-%{version}.tar.gz
|
||||
License: GPL
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-root
|
||||
|
||||
%description
|
||||
GeoIP is a C library that enables the user to find geographical and
|
||||
network information of an IP address.
|
||||
Included is a free GeoLite Country database
|
||||
that is updated at the beginning of every month.
|
||||
To download the latest free GeoLite Country database, go to:
|
||||
http://www.maxmind.com/app/geoip_country
|
||||
|
||||
There is also a free city-level geolocation database, GeoLite City,
|
||||
available from:
|
||||
http://www.maxmind.com/app/geolitecity
|
||||
|
||||
%package devel
|
||||
Summary: GeoIP headers, libraries
|
||||
Group: Development/Libraries
|
||||
Requires: %name = %{version}
|
||||
|
||||
%description devel
|
||||
This package contain the devel files for GeoIP.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
|
||||
%build
|
||||
%configure
|
||||
make
|
||||
make check
|
||||
|
||||
%install
|
||||
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
|
||||
%makeinstall
|
||||
# Fixup permissions on shared libraries so that findreqs will work right.
|
||||
chmod 755 $RPM_BUILD_ROOT/%{_libdir}/*
|
||||
|
||||
%clean
|
||||
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%post -p /sbin/ldconfig
|
||||
|
||||
%postun -p /sbin/ldconfig
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%doc AUTHORS COPYING ChangeLog README TODO
|
||||
%attr(0755,root,root) %{_libdir}/*.so.*.*
|
||||
%{_bindir}/*
|
||||
%{_sysconfdir}/*
|
||||
%dir %{_datadir}/GeoIP
|
||||
%{_datadir}/GeoIP/*
|
||||
%{_libdir}/*.so
|
||||
%{_mandir}/*/*
|
||||
|
||||
%files devel
|
||||
%{_includedir}/*
|
||||
%{_libdir}/*.a
|
||||
%{_libdir}/*.la
|
||||
|
||||
%changelog
|
||||
* Fri Apr 14 2006 Thomas Mather <tjmather@maxmind.com>
|
||||
- Updated description to reference free GeoLite City database
|
||||
|
||||
* Thu Jul 7 2005 Thomas Mather <tjmather@maxmind.com>
|
||||
- Updated description to reflect monthly updates for free country database.
|
||||
|
||||
* Mon Sep 8 2003 Dr. Peter Bieringer
|
||||
- Fix for RHL 9, created a new devel package definition.
|
||||
|
||||
* Thu Feb 27 2003 Ryan Weaver <ryanw@falsehope.com>
|
||||
- Initial RPM Build
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
Index: GeoIP.c
|
||||
===================================================================
|
||||
--- GeoIP.c (revision 9431)
|
||||
+++ GeoIP.c (working copy)
|
||||
@@ -26,6 +26,32 @@
|
||||
#include <unistd.h>
|
||||
#include <netdb.h>
|
||||
#include <sys/mman.h>
|
||||
+#else
|
||||
+#define ssize_t SSIZE_T
|
||||
+#include <io.h>
|
||||
+#include <windows.h>
|
||||
+
|
||||
+ssize_t pread (int fd, void *buf, size_t count, off_t offset)
|
||||
+{
|
||||
+ HANDLE handle = (HANDLE)(intptr_t)_get_osfhandle (fd);
|
||||
+
|
||||
+ OVERLAPPED olap = { 0 };
|
||||
+ DWORD written;
|
||||
+
|
||||
+ if (handle == INVALID_HANDLE_VALUE)
|
||||
+ return -1;
|
||||
+
|
||||
+ olap.Offset = offset;
|
||||
+ //olap.OffsetHigh = offset >> 32;
|
||||
+
|
||||
+ /* This braindead API will override the file pointer even if we specify
|
||||
+ * an explicit read offset... So do not expect this to mix well with
|
||||
+ * regular read() calls. */
|
||||
+ if (ReadFile (handle, buf, count, &written, &olap))
|
||||
+ return written;
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
#endif /* !defined(_WIN32) */
|
||||
|
||||
#include <errno.h>
|
||||
Index: GeoIPCity.c
|
||||
===================================================================
|
||||
--- GeoIPCity.c (revision 9431)
|
||||
+++ GeoIPCity.c (working copy)
|
||||
@@ -38,8 +38,8 @@
|
||||
static
|
||||
const int FULL_RECORD_LENGTH = 50;
|
||||
|
||||
-static const int CITYCONFIDENCE_FIXED_RECORD = 4;
|
||||
-static const int CITYCONFIDENCEDIST_FIXED_RECORD = 6;
|
||||
+#define CITYCONFIDENCE_FIXED_RECORD 4
|
||||
+#define CITYCONFIDENCEDIST_FIXED_RECORD 6
|
||||
|
||||
|
||||
static
|
||||
@@ -55,6 +55,7 @@
|
||||
double latitude = 0, longitude = 0;
|
||||
int metroarea_combo = 0;
|
||||
int bytes_read = 0;
|
||||
+ int t = 0;
|
||||
if (seek_record == gi->databaseSegments[0])
|
||||
return NULL;
|
||||
|
||||
@@ -93,11 +94,12 @@
|
||||
record->city_conf = tmp_fixed_record[2];
|
||||
record->postal_conf = tmp_fixed_record[3];
|
||||
|
||||
+ t = fixed_rec_size - gi->record_length;
|
||||
+
|
||||
record->accuracy_radius =
|
||||
gi->databaseType == GEOIP_CITYCONFIDENCEDIST_EDITION
|
||||
? ((tmp_fixed_record[4] + (tmp_fixed_record[5] << 8)) & 0x3ff) : 0x3ff;
|
||||
|
||||
- int t = fixed_rec_size - gi->record_length;
|
||||
|
||||
record_pointer = dseg + tmp_fixed_record[t] +
|
||||
(tmp_fixed_record[t + 1] << 8) + (tmp_fixed_record[t + 2] << 16) ;
|
||||
@@ -129,7 +131,7 @@
|
||||
gi->databaseType == GEOIP_CITYCONFIDENCEDIST_EDITION
|
||||
? ((record_buf[4] + (record_buf[5] << 8)) & 0x3ff) : 0x3ff;
|
||||
|
||||
- int t = fixed_rec_size - gi->record_length;
|
||||
+ t = fixed_rec_size - gi->record_length;
|
||||
|
||||
record_pointer = dseg + record_buf[t] +
|
||||
(record_buf[t + 1] << 8) + (record_buf[t + 2] << 16) ;
|
||||
|
|
@ -1,183 +0,0 @@
|
|||
Index: GeoIP.c
|
||||
===================================================================
|
||||
RCS file: /home/maxmind/geoip/c/libGeoIP/GeoIP.c,v
|
||||
retrieving revision 1.32
|
||||
retrieving revision 1.33
|
||||
diff -u -r1.32 -r1.33
|
||||
--- GeoIP.c 25 Aug 2002 22:42:48 -0000 1.32
|
||||
+++ GeoIP.c 27 Aug 2002 06:50:02 -0000 1.33
|
||||
@@ -23,16 +23,24 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
+#ifndef _WIN32
|
||||
#include <netdb.h>
|
||||
+#endif /* _WIN32 */
|
||||
#include <assert.h>
|
||||
#include <sys/types.h> /* for fstat */
|
||||
#include <sys/stat.h> /* for fstat */
|
||||
#include "zlib.h"
|
||||
#include "time.h"
|
||||
|
||||
+#ifndef _WIN32
|
||||
+#include <unistd.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/socket.h>
|
||||
+#else
|
||||
+#include <io.h>
|
||||
+#include <windows.h>
|
||||
+#endif /* _WIN32 */
|
||||
|
||||
#define COUNTRY_BEGIN 16776960;
|
||||
const int RECORD_LENGTH = 3;
|
||||
@@ -57,9 +65,66 @@
|
||||
const char *GeoIPUpdateHost = "updates.maxmind.com";
|
||||
const char *GeoIPHTTPRequest = "GET /app/update?license_key=%s HTTP/1.0\nHost: updates.maxmind.com\n\n";
|
||||
|
||||
+#ifdef _WIN32
|
||||
+char * _dat_in_module_path () {
|
||||
+ HMODULE GeoIPdll;
|
||||
+ struct _stat st;
|
||||
+ int i;
|
||||
+ char * buf;
|
||||
+
|
||||
+ buf = (char *) malloc(MAX_PATH);
|
||||
+
|
||||
+ GeoIPdll = GetModuleHandle("GeoIP.dll");
|
||||
+ if (!GeoIPdll)
|
||||
+ {
|
||||
+ GeoIPdll = GetModuleHandle(NULL);
|
||||
+ if (!GeoIPdll)
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ GetModuleFileName(GeoIPdll, buf, MAX_PATH);
|
||||
+ for (i = strlen(buf); (i >= 0) && (buf[i] != '\\'); i--);
|
||||
+ if (i)
|
||||
+ {
|
||||
+ buf[i] = '\0';
|
||||
+ strcat(buf, "\\");
|
||||
+ strcat(buf, GeoIPDBFileName);
|
||||
+ if (_stat(buf, &st) == 0)
|
||||
+ return buf;
|
||||
+ }
|
||||
+
|
||||
+ free(buf);
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+char * _dat_path_in_regkey () {
|
||||
+ DWORD lpdwDisposition, type, size = MAX_PATH;
|
||||
+ HKEY hkGeoIP;
|
||||
+ char * buf, * filename;
|
||||
+
|
||||
+ buf = (char *) malloc(MAX_PATH);
|
||||
+ filename = (char *) malloc(MAX_PATH);
|
||||
+
|
||||
+ if (RegCreateKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\MaxMind\\GeoIP", 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hkGeoIP, &lpdwDisposition) != ERROR_SUCCESS)
|
||||
+ return NULL;
|
||||
+ if (RegQueryValueEx(hkGeoIP, "DATADIR", 0, &type, buf, &size) != ERROR_SUCCESS)
|
||||
+ strcpy(buf, "%SystemRoot%\\SYSTEM32");
|
||||
+ if (RegSetValueEx(hkGeoIP, "DATADIR", 0, REG_EXPAND_SZ, buf, strlen(buf)) != ERROR_SUCCESS)
|
||||
+ return NULL;
|
||||
+ ExpandEnvironmentStrings(buf, filename, MAX_PATH);
|
||||
+
|
||||
+ free(buf);
|
||||
+ strcat(filename, "\\");
|
||||
+ strcat(filename, GeoIPDBFileName);
|
||||
+
|
||||
+ return filename;
|
||||
+}
|
||||
+#endif /* _WIN32 */
|
||||
+
|
||||
GeoIP* GeoIP_new (int flags) {
|
||||
char * filename;
|
||||
GeoIP * gi;
|
||||
+
|
||||
+#ifndef _WIN32
|
||||
filename = malloc(sizeof(char) * (strlen(DATADIR)+strlen(GeoIPDBFileName)+2));
|
||||
if (filename == NULL)
|
||||
return NULL;
|
||||
@@ -67,6 +132,17 @@
|
||||
strcat(filename, DATADIR);
|
||||
strcat(filename, "/");
|
||||
strcat(filename, GeoIPDBFileName);
|
||||
+#else
|
||||
+ filename = _dat_in_module_path();
|
||||
+ if (filename == NULL)
|
||||
+ filename = _dat_path_in_regkey();
|
||||
+ if (filename == NULL)
|
||||
+ {
|
||||
+ fprintf(stderr,"Unable to query registry for database location\n");
|
||||
+ return NULL;
|
||||
+ }
|
||||
+#endif /* _WIN32 */
|
||||
+
|
||||
gi = GeoIP_open (filename, flags);
|
||||
free(filename);
|
||||
return gi;
|
||||
@@ -96,7 +172,7 @@
|
||||
}
|
||||
gi->cache = (unsigned char *) malloc(sizeof(unsigned char) * buf.st_size);
|
||||
if (gi->cache != NULL) {
|
||||
- if (fread(gi->cache, sizeof(unsigned char), buf.st_size, gi->GeoIPDatabase) != buf.st_size) {
|
||||
+ if (fread(gi->cache, sizeof(unsigned char), buf.st_size, gi->GeoIPDatabase) != (unsigned) buf.st_size) {
|
||||
fprintf(stderr,"Error reading file %s\n",filename);
|
||||
free(gi->cache);
|
||||
free(gi);
|
||||
Index: GeoIP.h
|
||||
===================================================================
|
||||
RCS file: /home/maxmind/geoip/c/libGeoIP/GeoIP.h,v
|
||||
retrieving revision 1.19
|
||||
retrieving revision 1.20
|
||||
diff -u -r1.19 -r1.20
|
||||
--- GeoIP.h 20 Aug 2002 00:52:00 -0000 1.19
|
||||
+++ GeoIP.h 27 Aug 2002 06:50:02 -0000 1.20
|
||||
@@ -45,25 +45,31 @@
|
||||
extern const char * GeoIP_country_name[246];
|
||||
extern const char * GeoIPConfFile;
|
||||
|
||||
-GeoIP* GeoIP_new(int flags);
|
||||
-GeoIP* GeoIP_open(char * filename, int flags);
|
||||
-void GeoIP_delete(GeoIP* gi);
|
||||
-const char *GeoIP_country_code_by_addr (GeoIP* gi, const char *addr);
|
||||
-const char *GeoIP_country_code_by_name (GeoIP* gi, const char *host);
|
||||
-const char *GeoIP_country_code3_by_addr (GeoIP* gi, const char *addr);
|
||||
-const char *GeoIP_country_code3_by_name (GeoIP* gi, const char *host);
|
||||
-const char *GeoIP_country_name_by_addr (GeoIP* gi, const char *addr);
|
||||
-const char *GeoIP_country_name_by_name (GeoIP* gi, const char *host);
|
||||
-short int GeoIP_country_id_by_addr (GeoIP* gi, const char *addr);
|
||||
-short int GeoIP_country_id_by_name (GeoIP* gi, const char *host);
|
||||
+#ifdef _WIN32
|
||||
+#define GEOIP_API __declspec(dllexport)
|
||||
+#else
|
||||
+#define GEOIP_API
|
||||
+#endif /* _WIN32 */
|
||||
|
||||
-char *GeoIP_database_info (GeoIP* gi);
|
||||
-short int GeoIP_update_database (GeoIP* gi, char * license_key, int verbose);
|
||||
+GEOIP_API GeoIP* GeoIP_new(int flags);
|
||||
+GEOIP_API GeoIP* GeoIP_open(char * filename, int flags);
|
||||
+GEOIP_API void GeoIP_delete(GeoIP* gi);
|
||||
+GEOIP_API const char *GeoIP_country_code_by_addr (GeoIP* gi, const char *addr);
|
||||
+GEOIP_API const char *GeoIP_country_code_by_name (GeoIP* gi, const char *host);
|
||||
+GEOIP_API const char *GeoIP_country_code3_by_addr (GeoIP* gi, const char *addr);
|
||||
+GEOIP_API const char *GeoIP_country_code3_by_name (GeoIP* gi, const char *host);
|
||||
+GEOIP_API const char *GeoIP_country_name_by_addr (GeoIP* gi, const char *addr);
|
||||
+GEOIP_API const char *GeoIP_country_name_by_name (GeoIP* gi, const char *host);
|
||||
+GEOIP_API short int GeoIP_country_id_by_addr (GeoIP* gi, const char *addr);
|
||||
+GEOIP_API short int GeoIP_country_id_by_name (GeoIP* gi, const char *host);
|
||||
|
||||
-int _seek_country (GeoIP* gi, const int offset, unsigned long ipnum, int depth);
|
||||
-unsigned long _addr_to_num (const char *addr);
|
||||
-unsigned long _h_addr_to_num (unsigned char *addr);
|
||||
-short int _is_ipaddr (const char *name);
|
||||
+GEOIP_API char *GeoIP_database_info (GeoIP* gi);
|
||||
+GEOIP_API short int GeoIP_update_database (GeoIP* gi, char * license_key, int verbose);
|
||||
+
|
||||
+GEOIP_API int _seek_country (GeoIP* gi, const int offset, unsigned long ipnum, int depth);
|
||||
+GEOIP_API unsigned long _addr_to_num (const char *addr);
|
||||
+GEOIP_API unsigned long _h_addr_to_num (unsigned char *addr);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
@ -1,200 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectName>GeoIP</ProjectName>
|
||||
<ProjectGuid>{6527D843-EE53-4F1E-B0A9-12ABBA8E75CC}</ProjectGuid>
|
||||
<RootNamespace>GeoIP</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)$(Configuration)\</OutDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)$(Configuration)\</OutDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>libGeoIP\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;GEOIP_EXPORTS;PACKAGE_VERSION="1.4.8";DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>copy "$(TargetPath)" ..\..\repro</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>libGeoIP\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;GEOIP_EXPORTS;PACKAGE_VERSION="1.4.8";DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>copy "$(TargetPath)" ..\..\repro</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>libGeoIP\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;GEOIP_EXPORTS;PACKAGE_VERSION="1.4.8";DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>copy "$(TargetPath)" ..\..\repro</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>libGeoIP\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;GEOIP_EXPORTS;PACKAGE_VERSION="1.4.8";DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>copy "$(TargetPath)" ..\..\repro</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="libGeoIP\GeoIP.c" />
|
||||
<ClCompile Include="libGeoIP\GeoIPCity.c" />
|
||||
<ClCompile Include="libGeoIP\md5.c" />
|
||||
<ClCompile Include="libGeoIP\regionName.c" />
|
||||
<ClCompile Include="libGeoIP\timeZone.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="libGeoIP\GeoIP.h" />
|
||||
<ClInclude Include="libGeoIP\GeoIP_internal.h" />
|
||||
<ClInclude Include="libGeoIP\GeoIPCity.h" />
|
||||
<ClInclude Include="libGeoIP\global.h" />
|
||||
<ClInclude Include="libGeoIP\md5.h" />
|
||||
<ClInclude Include="libGeoIP\types.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="libGeoIP\GeoIP.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="libGeoIP\GeoIPCity.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="libGeoIP\md5.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="libGeoIP\regionName.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="libGeoIP\timeZone.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="libGeoIP\GeoIP.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="libGeoIP\GeoIP_internal.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="libGeoIP\GeoIPCity.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="libGeoIP\global.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="libGeoIP\md5.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="libGeoIP\types.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
@ -1,239 +0,0 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="GeoIP"
|
||||
ProjectGUID="{6527D843-EE53-4F1E-B0A9-12ABBA8E75CC}"
|
||||
RootNamespace="GeoIP"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="196613"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(ProjectDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="libGeoIP\"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;GEOIP_EXPORTS;PACKAGE_VERSION="\"1.4.8\"";DLL"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="ws2_32.lib"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
CommandLine="copy "$(TargetPath)" ..\..\repro"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(ProjectDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
AdditionalIncludeDirectories="libGeoIP\"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;GEOIP_EXPORTS;PACKAGE_VERSION="\"1.4.8\"";DLL"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="ws2_32.lib"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
CommandLine="copy "$(TargetPath)" ..\..\repro"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\libGeoIP\GeoIP.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\libGeoIP\GeoIPCity.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\libGeoIP\md5.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\libGeoIP\regionName.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\libGeoIP\timeZone.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\libGeoIP\GeoIP.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\libGeoIP\GeoIP_internal.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\libGeoIP\GeoIPCity.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\libGeoIP\global.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\libGeoIP\md5.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\libGeoIP\types.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||
>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
|
|
@ -1,365 +0,0 @@
|
|||
Installation Instructions
|
||||
*************************
|
||||
|
||||
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
|
||||
2006, 2007, 2008, 2009 Free Software Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved. This file is offered as-is,
|
||||
without warranty of any kind.
|
||||
|
||||
Basic Installation
|
||||
==================
|
||||
|
||||
Briefly, the shell commands `./configure; make; make install' should
|
||||
configure, build, and install this package. The following
|
||||
more-detailed instructions are generic; see the `README' file for
|
||||
instructions specific to this package. Some packages provide this
|
||||
`INSTALL' file but do not implement all of the features documented
|
||||
below. The lack of an optional feature in a given package is not
|
||||
necessarily a bug. More recommendations for GNU packages can be found
|
||||
in *note Makefile Conventions: (standards)Makefile Conventions.
|
||||
|
||||
The `configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
those values to create a `Makefile' in each directory of the package.
|
||||
It may also create one or more `.h' files containing system-dependent
|
||||
definitions. Finally, it creates a shell script `config.status' that
|
||||
you can run in the future to recreate the current configuration, and a
|
||||
file `config.log' containing compiler output (useful mainly for
|
||||
debugging `configure').
|
||||
|
||||
It can also use an optional file (typically called `config.cache'
|
||||
and enabled with `--cache-file=config.cache' or simply `-C') that saves
|
||||
the results of its tests to speed up reconfiguring. Caching is
|
||||
disabled by default to prevent problems with accidental use of stale
|
||||
cache files.
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how `configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the `README' so they can
|
||||
be considered for the next release. If you are using the cache, and at
|
||||
some point `config.cache' contains results you don't want to keep, you
|
||||
may remove or edit it.
|
||||
|
||||
The file `configure.ac' (or `configure.in') is used to create
|
||||
`configure' by a program called `autoconf'. You need `configure.ac' if
|
||||
you want to change it or regenerate `configure' using a newer version
|
||||
of `autoconf'.
|
||||
|
||||
The simplest way to compile this package is:
|
||||
|
||||
1. `cd' to the directory containing the package's source code and type
|
||||
`./configure' to configure the package for your system.
|
||||
|
||||
Running `configure' might take a while. While running, it prints
|
||||
some messages telling which features it is checking for.
|
||||
|
||||
2. Type `make' to compile the package.
|
||||
|
||||
3. Optionally, type `make check' to run any self-tests that come with
|
||||
the package, generally using the just-built uninstalled binaries.
|
||||
|
||||
4. Type `make install' to install the programs and any data files and
|
||||
documentation. When installing into a prefix owned by root, it is
|
||||
recommended that the package be configured and built as a regular
|
||||
user, and only the `make install' phase executed with root
|
||||
privileges.
|
||||
|
||||
5. Optionally, type `make installcheck' to repeat any self-tests, but
|
||||
this time using the binaries in their final installed location.
|
||||
This target does not install anything. Running this target as a
|
||||
regular user, particularly if the prior `make install' required
|
||||
root privileges, verifies that the installation completed
|
||||
correctly.
|
||||
|
||||
6. You can remove the program binaries and object files from the
|
||||
source code directory by typing `make clean'. To also remove the
|
||||
files that `configure' created (so you can compile the package for
|
||||
a different kind of computer), type `make distclean'. There is
|
||||
also a `make maintainer-clean' target, but that is intended mainly
|
||||
for the package's developers. If you use it, you may have to get
|
||||
all sorts of other programs in order to regenerate files that came
|
||||
with the distribution.
|
||||
|
||||
7. Often, you can also type `make uninstall' to remove the installed
|
||||
files again. In practice, not all packages have tested that
|
||||
uninstallation works correctly, even though it is required by the
|
||||
GNU Coding Standards.
|
||||
|
||||
8. Some packages, particularly those that use Automake, provide `make
|
||||
distcheck', which can by used by developers to test that all other
|
||||
targets like `make install' and `make uninstall' work correctly.
|
||||
This target is generally not run by end users.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the `configure' script does not know about. Run `./configure --help'
|
||||
for details on some of the pertinent environment variables.
|
||||
|
||||
You can give `configure' initial values for configuration parameters
|
||||
by setting variables in the command line or in the environment. Here
|
||||
is an example:
|
||||
|
||||
./configure CC=c99 CFLAGS=-g LIBS=-lposix
|
||||
|
||||
*Note Defining Variables::, for more details.
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you can use GNU `make'. `cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the `configure' script. `configure' automatically checks for the
|
||||
source code in the directory that `configure' is in and in `..'. This
|
||||
is known as a "VPATH" build.
|
||||
|
||||
With a non-GNU `make', it is safer to compile the package for one
|
||||
architecture at a time in the source code directory. After you have
|
||||
installed the package for one architecture, use `make distclean' before
|
||||
reconfiguring for another architecture.
|
||||
|
||||
On MacOS X 10.5 and later systems, you can create libraries and
|
||||
executables that work on multiple system types--known as "fat" or
|
||||
"universal" binaries--by specifying multiple `-arch' options to the
|
||||
compiler but only a single `-arch' option to the preprocessor. Like
|
||||
this:
|
||||
|
||||
./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
|
||||
CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
|
||||
CPP="gcc -E" CXXCPP="g++ -E"
|
||||
|
||||
This is not guaranteed to produce working output in all cases, you
|
||||
may have to build one architecture at a time and combine the results
|
||||
using the `lipo' tool if you have problems.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
By default, `make install' installs the package's commands under
|
||||
`/usr/local/bin', include files under `/usr/local/include', etc. You
|
||||
can specify an installation prefix other than `/usr/local' by giving
|
||||
`configure' the option `--prefix=PREFIX', where PREFIX must be an
|
||||
absolute file name.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
|
||||
PREFIX as the prefix for installing programs and libraries.
|
||||
Documentation and other data files still use the regular prefix.
|
||||
|
||||
In addition, if you use an unusual directory layout you can give
|
||||
options like `--bindir=DIR' to specify different values for particular
|
||||
kinds of files. Run `configure --help' for a list of the directories
|
||||
you can set and what kinds of files go in them. In general, the
|
||||
default for these options is expressed in terms of `${prefix}', so that
|
||||
specifying just `--prefix' will affect all of the other directory
|
||||
specifications that were not explicitly provided.
|
||||
|
||||
The most portable way to affect installation locations is to pass the
|
||||
correct locations to `configure'; however, many packages provide one or
|
||||
both of the following shortcuts of passing variable assignments to the
|
||||
`make install' command line to change installation locations without
|
||||
having to reconfigure or recompile.
|
||||
|
||||
The first method involves providing an override variable for each
|
||||
affected directory. For example, `make install
|
||||
prefix=/alternate/directory' will choose an alternate location for all
|
||||
directory configuration variables that were expressed in terms of
|
||||
`${prefix}'. Any directories that were specified during `configure',
|
||||
but not in terms of `${prefix}', must each be overridden at install
|
||||
time for the entire installation to be relocated. The approach of
|
||||
makefile variable overrides for each directory variable is required by
|
||||
the GNU Coding Standards, and ideally causes no recompilation.
|
||||
However, some platforms have known limitations with the semantics of
|
||||
shared libraries that end up requiring recompilation when using this
|
||||
method, particularly noticeable in packages that use GNU Libtool.
|
||||
|
||||
The second method involves providing the `DESTDIR' variable. For
|
||||
example, `make install DESTDIR=/alternate/directory' will prepend
|
||||
`/alternate/directory' before all installation names. The approach of
|
||||
`DESTDIR' overrides is not required by the GNU Coding Standards, and
|
||||
does not work on platforms that have drive letters. On the other hand,
|
||||
it does better at avoiding recompilation issues, and works well even
|
||||
when some directory options were not specified in terms of `${prefix}'
|
||||
at `configure' time.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving `configure' the
|
||||
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
||||
|
||||
Some packages pay attention to `--enable-FEATURE' options to
|
||||
`configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
||||
is something like `gnu-as' or `x' (for the X Window System). The
|
||||
`README' should mention any `--enable-' and `--with-' options that the
|
||||
package recognizes.
|
||||
|
||||
For packages that use the X Window System, `configure' can usually
|
||||
find the X include and library files automatically, but if it doesn't,
|
||||
you can use the `configure' options `--x-includes=DIR' and
|
||||
`--x-libraries=DIR' to specify their locations.
|
||||
|
||||
Some packages offer the ability to configure how verbose the
|
||||
execution of `make' will be. For these packages, running `./configure
|
||||
--enable-silent-rules' sets the default to minimal output, which can be
|
||||
overridden with `make V=1'; while running `./configure
|
||||
--disable-silent-rules' sets the default to verbose, which can be
|
||||
overridden with `make V=0'.
|
||||
|
||||
Particular systems
|
||||
==================
|
||||
|
||||
On HP-UX, the default C compiler is not ANSI C compatible. If GNU
|
||||
CC is not installed, it is recommended to use the following options in
|
||||
order to use an ANSI C compiler:
|
||||
|
||||
./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
|
||||
|
||||
and if that doesn't work, install pre-built binaries of GCC for HP-UX.
|
||||
|
||||
On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
|
||||
parse its `<wchar.h>' header file. The option `-nodtk' can be used as
|
||||
a workaround. If GNU CC is not installed, it is therefore recommended
|
||||
to try
|
||||
|
||||
./configure CC="cc"
|
||||
|
||||
and if that doesn't work, try
|
||||
|
||||
./configure CC="cc -nodtk"
|
||||
|
||||
On Solaris, don't put `/usr/ucb' early in your `PATH'. This
|
||||
directory contains several dysfunctional programs; working variants of
|
||||
these programs are available in `/usr/bin'. So, if you need `/usr/ucb'
|
||||
in your `PATH', put it _after_ `/usr/bin'.
|
||||
|
||||
On Haiku, software installed for all users goes in `/boot/common',
|
||||
not `/usr/local'. It is recommended to use the following options:
|
||||
|
||||
./configure --prefix=/boot/common
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features `configure' cannot figure out
|
||||
automatically, but needs to determine by the type of machine the package
|
||||
will run on. Usually, assuming the package is built to be run on the
|
||||
_same_ architectures, `configure' can figure that out, but if it prints
|
||||
a message saying it cannot guess the machine type, give it the
|
||||
`--build=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as `sun4', or a canonical name which has the form:
|
||||
|
||||
CPU-COMPANY-SYSTEM
|
||||
|
||||
where SYSTEM can have one of these forms:
|
||||
|
||||
OS
|
||||
KERNEL-OS
|
||||
|
||||
See the file `config.sub' for the possible values of each field. If
|
||||
`config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the machine type.
|
||||
|
||||
If you are _building_ compiler tools for cross-compiling, you should
|
||||
use the option `--target=TYPE' to select the type of system they will
|
||||
produce code for.
|
||||
|
||||
If you want to _use_ a cross compiler, that generates code for a
|
||||
platform different from the build platform, you should specify the
|
||||
"host" platform (i.e., that on which the generated programs will
|
||||
eventually be run) with `--host=TYPE'.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
If you want to set default values for `configure' scripts to share,
|
||||
you can create a site shell script called `config.site' that gives
|
||||
default values for variables like `CC', `cache_file', and `prefix'.
|
||||
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
||||
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
`CONFIG_SITE' environment variable to the location of the site script.
|
||||
A warning: not all `configure' scripts look for a site script.
|
||||
|
||||
Defining Variables
|
||||
==================
|
||||
|
||||
Variables not defined in a site shell script can be set in the
|
||||
environment passed to `configure'. However, some packages may run
|
||||
configure again during the build, and the customized values of these
|
||||
variables may be lost. In order to avoid this problem, you should set
|
||||
them in the `configure' command line, using `VAR=value'. For example:
|
||||
|
||||
./configure CC=/usr/local2/bin/gcc
|
||||
|
||||
causes the specified `gcc' to be used as the C compiler (unless it is
|
||||
overridden in the site shell script).
|
||||
|
||||
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
|
||||
an Autoconf bug. Until the bug is fixed you can use this workaround:
|
||||
|
||||
CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
|
||||
|
||||
`configure' Invocation
|
||||
======================
|
||||
|
||||
`configure' recognizes the following options to control how it
|
||||
operates.
|
||||
|
||||
`--help'
|
||||
`-h'
|
||||
Print a summary of all of the options to `configure', and exit.
|
||||
|
||||
`--help=short'
|
||||
`--help=recursive'
|
||||
Print a summary of the options unique to this package's
|
||||
`configure', and exit. The `short' variant lists options used
|
||||
only in the top level, while the `recursive' variant lists options
|
||||
also present in any nested packages.
|
||||
|
||||
`--version'
|
||||
`-V'
|
||||
Print the version of Autoconf used to generate the `configure'
|
||||
script, and exit.
|
||||
|
||||
`--cache-file=FILE'
|
||||
Enable the cache: use and save the results of the tests in FILE,
|
||||
traditionally `config.cache'. FILE defaults to `/dev/null' to
|
||||
disable caching.
|
||||
|
||||
`--config-cache'
|
||||
`-C'
|
||||
Alias for `--cache-file=config.cache'.
|
||||
|
||||
`--quiet'
|
||||
`--silent'
|
||||
`-q'
|
||||
Do not print messages saying which checks are being made. To
|
||||
suppress all normal output, redirect it to `/dev/null' (any error
|
||||
messages will still be shown).
|
||||
|
||||
`--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
`configure' can determine that directory automatically.
|
||||
|
||||
`--prefix=DIR'
|
||||
Use DIR as the installation prefix. *note Installation Names::
|
||||
for more details, including other options available for fine-tuning
|
||||
the installation locations.
|
||||
|
||||
`--no-create'
|
||||
`-n'
|
||||
Run the configure checks, but stop before creating any output
|
||||
files.
|
||||
|
||||
`configure' also accepts some other, not widely useful, options. Run
|
||||
`configure --help' for more details.
|
||||
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
INCLUDES = -Wall -ansi
|
||||
|
||||
SUBDIRS = \
|
||||
libGeoIP \
|
||||
apps \
|
||||
conf \
|
||||
data \
|
||||
test \
|
||||
man
|
||||
|
||||
EXTRA_DIST = README.OSX READMEwin32static.txt README.MinGW READMEwin32.txt GeoIPWinDLL.patch TODO bootstrap GeoIP.spec GeoIP.spec.in Makefile.netware Makefile.vc Makefile.win32 get_ver.awk geoip.ico
|
||||
|
|
@ -1,707 +0,0 @@
|
|||
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
|
||||
# Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = .
|
||||
DIST_COMMON = README $(am__configure_deps) $(srcdir)/GeoIP.spec.in \
|
||||
$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
|
||||
$(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \
|
||||
TODO config.guess config.sub depcomp install-sh ltmain.sh \
|
||||
missing
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.in
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
|
||||
configure.lineno config.status.lineno
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_CLEAN_FILES = GeoIP.spec
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
|
||||
html-recursive info-recursive install-data-recursive \
|
||||
install-dvi-recursive install-exec-recursive \
|
||||
install-html-recursive install-info-recursive \
|
||||
install-pdf-recursive install-ps-recursive install-recursive \
|
||||
installcheck-recursive installdirs-recursive pdf-recursive \
|
||||
ps-recursive uninstall-recursive
|
||||
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
|
||||
distclean-recursive maintainer-clean-recursive
|
||||
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
|
||||
$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
|
||||
distdir dist dist-all distcheck
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
top_distdir = $(distdir)
|
||||
am__remove_distdir = \
|
||||
{ test ! -d "$(distdir)" \
|
||||
|| { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
|
||||
&& rm -fr "$(distdir)"; }; }
|
||||
am__relativize = \
|
||||
dir0=`pwd`; \
|
||||
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
|
||||
sed_rest='s,^[^/]*/*,,'; \
|
||||
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
|
||||
sed_butlast='s,/*[^/]*$$,,'; \
|
||||
while test -n "$$dir1"; do \
|
||||
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
|
||||
if test "$$first" != "."; then \
|
||||
if test "$$first" = ".."; then \
|
||||
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
|
||||
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
|
||||
else \
|
||||
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
|
||||
if test "$$first2" = "$$first"; then \
|
||||
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
|
||||
else \
|
||||
dir2="../$$dir2"; \
|
||||
fi; \
|
||||
dir0="$$dir0"/"$$first"; \
|
||||
fi; \
|
||||
fi; \
|
||||
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
|
||||
done; \
|
||||
reldir="$$dir2"
|
||||
DIST_ARCHIVES = $(distdir).tar.gz
|
||||
GZIP_ENV = --best
|
||||
distuninstallcheck_listfiles = find . -type f -print
|
||||
distcleancheck_listfiles = find . -type f -print
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GEOIP_VERSION_INFO = @GEOIP_VERSION_INFO@
|
||||
GREP = @GREP@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
lt_ECHO = @lt_ECHO@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
INCLUDES = -Wall -ansi
|
||||
SUBDIRS = \
|
||||
libGeoIP \
|
||||
apps \
|
||||
conf \
|
||||
data \
|
||||
test \
|
||||
man
|
||||
|
||||
EXTRA_DIST = README.OSX READMEwin32static.txt README.MinGW READMEwin32.txt GeoIPWinDLL.patch TODO bootstrap GeoIP.spec GeoIP.spec.in Makefile.netware Makefile.vc Makefile.win32 get_ver.awk geoip.ico
|
||||
all: all-recursive
|
||||
|
||||
.SUFFIXES:
|
||||
am--refresh:
|
||||
@:
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \
|
||||
$(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
echo ' $(SHELL) ./config.status'; \
|
||||
$(SHELL) ./config.status;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
$(SHELL) ./config.status --recheck
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
$(am__cd) $(srcdir) && $(AUTOCONF)
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
|
||||
$(am__aclocal_m4_deps):
|
||||
GeoIP.spec: $(top_builddir)/config.status $(srcdir)/GeoIP.spec.in
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
-rm -f libtool config.lt
|
||||
|
||||
# This directory's subdirectories are mostly independent; you can cd
|
||||
# into them and run `make' without going through this Makefile.
|
||||
# To change the values of `make' variables: instead of editing Makefiles,
|
||||
# (1) if the variable is set in `config.status', edit `config.status'
|
||||
# (which will cause the Makefiles to be regenerated when you run `make');
|
||||
# (2) otherwise, pass the desired values on the `make' command line.
|
||||
$(RECURSIVE_TARGETS):
|
||||
@fail= failcom='exit 1'; \
|
||||
for f in x $$MAKEFLAGS; do \
|
||||
case $$f in \
|
||||
*=* | --[!k]*);; \
|
||||
*k*) failcom='fail=yes';; \
|
||||
esac; \
|
||||
done; \
|
||||
dot_seen=no; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
dot_seen=yes; \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| eval $$failcom; \
|
||||
done; \
|
||||
if test "$$dot_seen" = "no"; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
|
||||
fi; test -z "$$fail"
|
||||
|
||||
$(RECURSIVE_CLEAN_TARGETS):
|
||||
@fail= failcom='exit 1'; \
|
||||
for f in x $$MAKEFLAGS; do \
|
||||
case $$f in \
|
||||
*=* | --[!k]*);; \
|
||||
*k*) failcom='fail=yes';; \
|
||||
esac; \
|
||||
done; \
|
||||
dot_seen=no; \
|
||||
case "$@" in \
|
||||
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
|
||||
*) list='$(SUBDIRS)' ;; \
|
||||
esac; \
|
||||
rev=''; for subdir in $$list; do \
|
||||
if test "$$subdir" = "."; then :; else \
|
||||
rev="$$subdir $$rev"; \
|
||||
fi; \
|
||||
done; \
|
||||
rev="$$rev ."; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
for subdir in $$rev; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| eval $$failcom; \
|
||||
done && test -z "$$fail"
|
||||
tags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
|
||||
done
|
||||
ctags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
|
||||
done
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
|
||||
include_option=--etags-include; \
|
||||
empty_fix=.; \
|
||||
else \
|
||||
include_option=--include; \
|
||||
empty_fix=; \
|
||||
fi; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test ! -f $$subdir/TAGS || \
|
||||
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
|
||||
fi; \
|
||||
done; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
$(am__remove_distdir)
|
||||
test -d "$(distdir)" || mkdir "$(distdir)"
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test -d "$(distdir)/$$subdir" \
|
||||
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
|
||||
$(am__relativize); \
|
||||
new_distdir=$$reldir; \
|
||||
dir1=$$subdir; dir2="$(top_distdir)"; \
|
||||
$(am__relativize); \
|
||||
new_top_distdir=$$reldir; \
|
||||
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
|
||||
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
|
||||
($(am__cd) $$subdir && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) \
|
||||
top_distdir="$$new_top_distdir" \
|
||||
distdir="$$new_distdir" \
|
||||
am__remove_distdir=: \
|
||||
am__skip_length_check=: \
|
||||
am__skip_mode_fix=: \
|
||||
distdir) \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
-test -n "$(am__skip_mode_fix)" \
|
||||
|| find "$(distdir)" -type d ! -perm -755 \
|
||||
-exec chmod u+rwx,go+rx {} \; -o \
|
||||
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|
||||
|| chmod -R a+r "$(distdir)"
|
||||
dist-gzip: distdir
|
||||
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-bzip2: distdir
|
||||
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-lzma: distdir
|
||||
tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-xz: distdir
|
||||
tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-tarZ: distdir
|
||||
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-shar: distdir
|
||||
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-zip: distdir
|
||||
-rm -f $(distdir).zip
|
||||
zip -rq $(distdir).zip $(distdir)
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist dist-all: distdir
|
||||
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||
$(am__remove_distdir)
|
||||
|
||||
# This target untars the dist file and tries a VPATH configuration. Then
|
||||
# it guarantees that the distribution is self-contained by making another
|
||||
# tarfile.
|
||||
distcheck: dist
|
||||
case '$(DIST_ARCHIVES)' in \
|
||||
*.tar.gz*) \
|
||||
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
|
||||
*.tar.bz2*) \
|
||||
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
|
||||
*.tar.lzma*) \
|
||||
lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
|
||||
*.tar.xz*) \
|
||||
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
|
||||
*.tar.Z*) \
|
||||
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
|
||||
*.shar.gz*) \
|
||||
GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
|
||||
*.zip*) \
|
||||
unzip $(distdir).zip ;;\
|
||||
esac
|
||||
chmod -R a-w $(distdir); chmod a+w $(distdir)
|
||||
mkdir $(distdir)/_build
|
||||
mkdir $(distdir)/_inst
|
||||
chmod a-w $(distdir)
|
||||
test -d $(distdir)/_build || exit 0; \
|
||||
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
|
||||
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
|
||||
&& am__cwd=`pwd` \
|
||||
&& $(am__cd) $(distdir)/_build \
|
||||
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
|
||||
$(DISTCHECK_CONFIGURE_FLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) check \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
|
||||
distuninstallcheck \
|
||||
&& chmod -R a-w "$$dc_install_base" \
|
||||
&& ({ \
|
||||
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
|
||||
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
|
||||
} || { rm -rf "$$dc_destdir"; exit 1; }) \
|
||||
&& rm -rf "$$dc_destdir" \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dist \
|
||||
&& rm -rf $(DIST_ARCHIVES) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
|
||||
&& cd "$$am__cwd" \
|
||||
|| exit 1
|
||||
$(am__remove_distdir)
|
||||
@(echo "$(distdir) archives ready for distribution: "; \
|
||||
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
|
||||
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
|
||||
distuninstallcheck:
|
||||
@$(am__cd) '$(distuninstallcheck_dir)' \
|
||||
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|
||||
|| { echo "ERROR: files left after uninstall:" ; \
|
||||
if test -n "$(DESTDIR)"; then \
|
||||
echo " (check DESTDIR support)"; \
|
||||
fi ; \
|
||||
$(distuninstallcheck_listfiles) ; \
|
||||
exit 1; } >&2
|
||||
distcleancheck: distclean
|
||||
@if test '$(srcdir)' = . ; then \
|
||||
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
|
||||
exit 1 ; \
|
||||
fi
|
||||
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|
||||
|| { echo "ERROR: files left in build directory after distclean:" ; \
|
||||
$(distcleancheck_listfiles) ; \
|
||||
exit 1; } >&2
|
||||
check-am: all-am
|
||||
check: check-recursive
|
||||
all-am: Makefile
|
||||
installdirs: installdirs-recursive
|
||||
installdirs-am:
|
||||
install: install-recursive
|
||||
install-exec: install-exec-recursive
|
||||
install-data: install-data-recursive
|
||||
uninstall: uninstall-recursive
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-recursive
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-recursive
|
||||
|
||||
clean-am: clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic distclean-libtool \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-recursive
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-recursive
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-recursive
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-recursive
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-recursive
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-recursive
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-recursive
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-recursive
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -rf $(top_srcdir)/autom4te.cache
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-recursive
|
||||
|
||||
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
|
||||
|
||||
pdf: pdf-recursive
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-recursive
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am:
|
||||
|
||||
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
|
||||
install-am install-strip tags-recursive
|
||||
|
||||
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
|
||||
all all-am am--refresh check check-am clean clean-generic \
|
||||
clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \
|
||||
dist-gzip dist-lzma dist-shar dist-tarZ dist-xz dist-zip \
|
||||
distcheck distclean distclean-generic distclean-libtool \
|
||||
distclean-tags distcleancheck distdir distuninstallcheck dvi \
|
||||
dvi-am html html-am info info-am install install-am \
|
||||
install-data install-data-am install-dvi install-dvi-am \
|
||||
install-exec install-exec-am install-html install-html-am \
|
||||
install-info install-info-am install-man install-pdf \
|
||||
install-pdf-am install-ps install-ps-am install-strip \
|
||||
installcheck installcheck-am installdirs installdirs-am \
|
||||
maintainer-clean maintainer-clean-generic mostlyclean \
|
||||
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
||||
tags tags-recursive uninstall uninstall-am
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
|
|
@ -1,301 +0,0 @@
|
|||
###################################################################
|
||||
#
|
||||
## Makefile for building GeoIP stuff (NetWare version - gnu make)
|
||||
## To build the binaries you need awk, GNU make and gcc / nlmconv
|
||||
## or Metrowerks CodeWarrior CommandlineTools.
|
||||
## Usage: make -f Makefile.netware [all|dist|clean|distclean]
|
||||
##
|
||||
## hacked by: Guenter Knauf
|
||||
#
|
||||
###################################################################
|
||||
|
||||
# Edit the path below to point to the base of your Novell NDK.
|
||||
ifndef NDKBASE
|
||||
NDKBASE = c:/novell
|
||||
endif
|
||||
|
||||
# Edit the path below to point to your zlib sources and libs.
|
||||
ifndef ZLIBSDK
|
||||
ZLIBSDK = d:/projects/cw/zlib-1.2.3
|
||||
endif
|
||||
|
||||
ifndef DISTDIR
|
||||
DISTDIR = GeoIP-$(GEOIP_VERSION_STR)-bin-nw
|
||||
endif
|
||||
ARCHIVE = $(DISTDIR).zip
|
||||
|
||||
# Edit the vars below to change NLM target settings.
|
||||
TARGETS := $(patsubst apps/%.c,%.nlm,$(wildcard apps/*.c))
|
||||
DESCR = $(subst .def,,$(notdir $@)) $(GEOIP_VERSION_STR)
|
||||
COMPANY = MaxMind LLC
|
||||
COPYR = Copyright (C) 2003-2006 MaxMind LLC All Rights Reserved.
|
||||
WWWURL = http://www.maxmind.com/app/c
|
||||
MTSAFE = YES
|
||||
STACK = 64000
|
||||
#SCREEN = none
|
||||
DATADIR = sys:/etc/GeoIP
|
||||
CONFDIR = sys:/etc
|
||||
|
||||
# Comment the line below if you dont want to link with the static libz.lib.
|
||||
LSTATIC = 1
|
||||
|
||||
# Edit the var below to point to your lib architecture.
|
||||
ifndef LIBARCH
|
||||
LIBARCH = LIBC
|
||||
endif
|
||||
|
||||
# must be equal to DEBUG or NDEBUG
|
||||
DB = NDEBUG
|
||||
# DB = DEBUG
|
||||
# Optimization: -O<n> or debugging: -g
|
||||
ifeq ($(DB),NDEBUG)
|
||||
OPT = -O2
|
||||
OBJDIR = release
|
||||
else
|
||||
OPT = -g
|
||||
OBJDIR = debug
|
||||
endif
|
||||
OBJLIB = lib-$(OBJDIR)
|
||||
|
||||
# Include the version info retrieved from header.
|
||||
-include $(OBJDIR)/version.inc
|
||||
|
||||
# Global tools and toolflags used with all compilers.
|
||||
ZIP = zip -qzR9
|
||||
CP = cp -afv
|
||||
MV = mv -fv
|
||||
# RM = rm -f
|
||||
# if you want to mark the target as MTSAFE you will need a tool for
|
||||
# generating the xdc data for the linker; here's a minimal tool:
|
||||
# http://www.gknw.com/development/prgtools/mkxdc.zip
|
||||
MPKXDC = mkxdc
|
||||
|
||||
# The following line defines your compiler.
|
||||
ifdef METROWERKS
|
||||
CC = mwccnlm
|
||||
else
|
||||
CC = gcc
|
||||
endif
|
||||
|
||||
# Global flags for all compilers
|
||||
CFLAGS = $(OPT) -D$(DB) -DNETWARE -nostdinc
|
||||
CFLAGS += -DGEOIPDATADIR=\"$(DATADIR)\"
|
||||
CFLAGS += -DSYSCONFDIR=\"$(CONFDIR)\"
|
||||
|
||||
ifeq ($(CC),mwccnlm)
|
||||
LD = mwldnlm
|
||||
LDFLAGS = -nostdlib $(PRELUDE) $(LDLIBS) $(LIBOBJS) $(OBJDIR)/$(basename $@).o -o $@ -commandfile
|
||||
AR = mwldnlm
|
||||
ARFLAGS = -type library -w nocmdline $(OBJDIR)/*.o -o
|
||||
LIBEXT = lib
|
||||
CFLAGS += -msgstyle gcc -gccinc -opt nointrinsics -proc 586
|
||||
CFLAGS += -relax_pointers
|
||||
#CFLAGS += -w on
|
||||
ifeq ($(LIBARCH),LIBC)
|
||||
PRELUDE = $(SDK_LIBC)/imports/libcpre.o
|
||||
CFLAGS += -align 4
|
||||
else
|
||||
PRELUDE = "$(METROWERKS)/Novell Support/Libraries/runtime/prelude.obj"
|
||||
# CFLAGS += -include "$(METROWERKS)/Novell Support/Headers/nlm_prefix.h"
|
||||
CFLAGS += -align 1
|
||||
endif
|
||||
else
|
||||
LD = nlmconv
|
||||
LDFLAGS = -T
|
||||
AR = ar
|
||||
ARFLAGS = -cq
|
||||
LIBEXT = lib
|
||||
CFLAGS += -fno-builtin -fpack-struct -fpcc-struct-return -fno-strict-aliasing
|
||||
CFLAGS += -Wall -Wno-unused #-Wno-format # -pedantic
|
||||
ifeq ($(LIBARCH),LIBC)
|
||||
PRELUDE = $(SDK_LIBC)/imports/libcpre.gcc.o
|
||||
else
|
||||
PRELUDE = $(SDK_CLIB)/imports/clibpre.gcc.o
|
||||
CFLAGS += -include $(NDKBASE)/nlmconv/genlm.h
|
||||
endif
|
||||
endif
|
||||
DESCR += ($(LIBARCH)) - $(CC) build
|
||||
|
||||
NDK_ROOT = $(NDKBASE)/ndk
|
||||
SDK_CLIB = $(NDK_ROOT)/nwsdk
|
||||
SDK_LIBC = $(NDK_ROOT)/libc
|
||||
|
||||
ifeq ($(LIBARCH),LIBC)
|
||||
INCLUDES += -I$(SDK_LIBC)/include -I$(SDK_LIBC)/include/nks
|
||||
# INCLUDES += -I$(SDK_LIBC)/include/winsock
|
||||
CFLAGS += -D_POSIX_SOURCE
|
||||
# CFLAGS += -D__ANSIC__
|
||||
else
|
||||
INCLUDES += -I$(SDK_CLIB)/include/nlm -I$(SDK_CLIB)/include
|
||||
# INCLUDES += -I$(SDK_CLIB)/include/nlm/obsolete
|
||||
CFLAGS += -DNETDB_USE_INTERNET
|
||||
endif
|
||||
|
||||
INCLUDES += -I./libGeoIP
|
||||
INCLUDES += -I$(ZLIBSDK)
|
||||
CFLAGS += $(INCLUDES)
|
||||
|
||||
ifeq ($(MTSAFE),YES)
|
||||
XDCOPT = -n
|
||||
endif
|
||||
ifeq ($(MTSAFE),NO)
|
||||
XDCOPT = -u
|
||||
endif
|
||||
|
||||
LIBPATH += -L$(ZLIBSDK)/nw/release
|
||||
ifdef LSTATIC
|
||||
LDLIBS += $(ZLIBSDK)/nw/release/libz.$(LIBEXT)
|
||||
else
|
||||
IMPORTS += @$(ZLIBSDK)/nw/release/libz.imp
|
||||
MODULES += libz
|
||||
endif
|
||||
|
||||
ifeq ($(findstring linux,$(OSTYPE)),linux)
|
||||
DL = '
|
||||
#-include $(NDKBASE)/nlmconv/ncpfs.inc
|
||||
endif
|
||||
|
||||
vpath %.c ./apps ./libGeoIP
|
||||
|
||||
LIBOBJS = $(OBJLIB)/GeoIP.o $(OBJLIB)/GeoIPCity.o
|
||||
UPDOBJS = $(OBJLIB)/GeoIPUpdate.o $(OBJLIB)/md5.o
|
||||
LIBOBJS += $(UPDOBJS)
|
||||
|
||||
.PRECIOUS: $(OBJLIB)/%.o $(OBJDIR)/%.o $(OBJDIR)/%.def
|
||||
|
||||
|
||||
all: prebuild $(TARGETS)
|
||||
|
||||
prebuild: $(OBJLIB) $(OBJDIR) $(OBJDIR)/version.inc
|
||||
|
||||
dist: $(DISTDIR) all $(DISTDIR)/readme_bin.txt
|
||||
@$(CP) *.nlm $(DISTDIR)
|
||||
@$(CP) Changelog $(DISTDIR)
|
||||
@$(CP) README $(DISTDIR)
|
||||
@$(CP) conf/GeoIP.conf.default $(DISTDIR)
|
||||
@$(CP) data/GeoIP.dat $(DISTDIR)
|
||||
@echo Creating $(ARCHIVE)
|
||||
@$(ZIP) $(ARCHIVE) $(DISTDIR)/* < $(DISTDIR)/readme_bin.txt
|
||||
|
||||
clean:
|
||||
-$(RM) -r $(OBJDIR) $(OBJLIB)
|
||||
-$(RM) $(TARGETS)
|
||||
|
||||
distclean:
|
||||
-$(RM) -r $(DISTDIR)
|
||||
-$(RM) $(ARCHIVE)
|
||||
|
||||
%.nlm: $(OBJDIR)/%.def $(LIBOBJS) $(OBJDIR)/%.o $(OBJDIR)/%.xdc
|
||||
@echo Linking $@
|
||||
@-$(RM) $@
|
||||
@$(LD) $(LDFLAGS) $<
|
||||
|
||||
$(DISTDIR):
|
||||
@mkdir $@
|
||||
|
||||
$(OBJDIR):
|
||||
@mkdir $@
|
||||
|
||||
$(OBJLIB):
|
||||
@mkdir $@
|
||||
|
||||
$(OBJDIR)/%.o: %.c
|
||||
# @echo Compiling $<
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
$(OBJLIB)/%.o: %.c
|
||||
# @echo Compiling $<
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
$(OBJDIR)/version.inc: configure.in $(OBJDIR)
|
||||
@echo Creating $@
|
||||
@awk -f get_ver.awk $< > $@
|
||||
|
||||
$(OBJDIR)/%.xdc: Makefile.netware
|
||||
@echo Creating $@
|
||||
@$(MPKXDC) $(XDCOPT) $@
|
||||
|
||||
$(OBJDIR)/%.def: Makefile.netware
|
||||
@echo Creating $@
|
||||
@echo $(DL)# DEF file for linking with $(LD)$(DL) > $@
|
||||
@echo $(DL)# Do not edit this file - it is created by make!$(DL) >> $@
|
||||
@echo $(DL)# All your changes will be lost!!$(DL) >> $@
|
||||
@echo $(DL)#$(DL) >> $@
|
||||
@echo $(DL)copyright "$(COPYR)"$(DL) >> $@
|
||||
@echo $(DL)description "$(DESCR)"$(DL) >> $@
|
||||
@echo $(DL)version $(GEOIP_VERSION)$(DL) >> $@
|
||||
ifdef NLMTYPE
|
||||
@echo $(DL)type $(NLMTYPE)$(DL) >> $@
|
||||
endif
|
||||
ifdef STACK
|
||||
@echo $(DL)stack $(STACK)$(DL) >> $@
|
||||
endif
|
||||
ifdef SCREEN
|
||||
@echo $(DL)screenname "$(SCREEN)"$(DL) >> $@
|
||||
else
|
||||
@echo $(DL)screenname "DEFAULT"$(DL) >> $@
|
||||
endif
|
||||
ifeq ($(DB),DEBUG)
|
||||
@echo $(DL)debug$(DL) >> $@
|
||||
endif
|
||||
@echo $(DL)threadname "$(subst .def,,$(notdir $@))"$(DL) >> $@
|
||||
ifdef XDCOPT
|
||||
@echo $(DL)xdcdata $(@:.def=.xdc)$(DL) >> $@
|
||||
endif
|
||||
ifeq ($(LDRING),0)
|
||||
@echo $(DL)flag_on 16$(DL) >> $@
|
||||
endif
|
||||
ifeq ($(LDRING),3)
|
||||
@echo $(DL)flag_on 512$(DL) >> $@
|
||||
endif
|
||||
ifeq ($(LIBARCH),CLIB)
|
||||
@echo $(DL)start _Prelude$(DL) >> $@
|
||||
@echo $(DL)exit _Stop$(DL) >> $@
|
||||
@echo $(DL)import @$(SDK_CLIB)/imports/clib.imp$(DL) >> $@
|
||||
@echo $(DL)import @$(SDK_CLIB)/imports/threads.imp$(DL) >> $@
|
||||
@echo $(DL)import @$(SDK_CLIB)/imports/nlmlib.imp$(DL) >> $@
|
||||
@echo $(DL)module clib$(DL) >> $@
|
||||
else
|
||||
@echo $(DL)flag_on 64$(DL) >> $@
|
||||
@echo $(DL)pseudopreemption$(DL) >> $@
|
||||
@echo $(DL)start _LibCPrelude$(DL) >> $@
|
||||
@echo $(DL)exit _LibCPostlude$(DL) >> $@
|
||||
@echo $(DL)check _LibCCheckUnload$(DL) >> $@
|
||||
@echo $(DL)import @$(SDK_LIBC)/imports/libc.imp$(DL) >> $@
|
||||
@echo $(DL)import @$(SDK_LIBC)/imports/netware.imp$(DL) >> $@
|
||||
@echo $(DL)module libc$(DL) >> $@
|
||||
endif
|
||||
ifdef MODULES
|
||||
@echo $(DL)module $(MODULES)$(DL) >> $@
|
||||
endif
|
||||
ifdef EXPORTS
|
||||
@echo $(DL)export $(EXPORTS)$(DL) >> $@
|
||||
endif
|
||||
ifdef IMPORTS
|
||||
@echo $(DL)import $(IMPORTS)$(DL) >> $@
|
||||
endif
|
||||
ifeq ($(LD),nlmconv)
|
||||
ifdef LDLIBS
|
||||
@echo $(DL)input $(LDLIBS)$(DL) >> $@
|
||||
endif
|
||||
@echo $(DL)input $(PRELUDE)$(DL) >> $@
|
||||
@echo $(DL)input $(LIBOBJS)$(DL) >> $@
|
||||
@echo $(DL)input $(@:.def=.o)$(DL) >> $@
|
||||
@echo $(DL)output $(notdir $(@:.def=.nlm))$(DL) >> $@
|
||||
endif
|
||||
|
||||
$(DISTDIR)/readme_bin.txt: Makefile.netware
|
||||
@echo Creating $@
|
||||
@echo $(DL)This is a binary distribution for NetWare platform.$(DL) > $@
|
||||
@echo $(DL)GeoIP version $(GEOIP_VERSION_STR)$(DL) >> $@
|
||||
ifndef LSTATIC
|
||||
@echo $(DL)These binaries depend on libz.nlm in the search path!$(DL) >> $@
|
||||
endif
|
||||
@echo $(DL)Please download the complete GeoIP package for$(DL) >> $@
|
||||
@echo $(DL)any further documentation:$(DL) >> $@
|
||||
@echo $(DL)$(WWWURL)$(DL) >> $@
|
||||
|
||||
info:
|
||||
@echo Targets to build: $(TARGETS)
|
||||
|
||||
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
#NMAKE makefile for Windows developers.
|
||||
#Produces a static library (GeoIP.lib).
|
||||
|
||||
#################################################################
|
||||
# configuration section
|
||||
################################################################
|
||||
|
||||
# place to put the GeoIP.dat database file
|
||||
# !!! Please keep the 2 \\ as directory separators !!!
|
||||
#
|
||||
GEOIPDATADIR="C:\\Windows\\SYSTEM32"
|
||||
#
|
||||
# System inc, lib, and bin directories
|
||||
!ifndef INSTDIR
|
||||
INSTDIR="C:\GeoIP-1.4.5"
|
||||
!endif
|
||||
|
||||
# Location where GeoIP.lib should be installed my "make install"
|
||||
INSTALL_LIB=$(INSTDIR)\Lib
|
||||
|
||||
#Location where .h files should be installed by "make install".
|
||||
INSTALL_INC=$(INSTDIR)\Include
|
||||
|
||||
#Location where programs should be installed by "make install".
|
||||
INSTALL_BIN=$(INSTDIR)\Bin
|
||||
|
||||
################################################################
|
||||
# end configuration section
|
||||
################################################################
|
||||
|
||||
DATA_DIR=data
|
||||
|
||||
DATA_FILE=GeoIP.dat
|
||||
|
||||
LIB_DIR = libGeoIP
|
||||
|
||||
TEST_DIR=test
|
||||
|
||||
APP_DIR=apps
|
||||
|
||||
GEOIP_LIB = GeoIP.lib
|
||||
|
||||
APP_PROGRAMS = geoiplookup.exe
|
||||
|
||||
TEST_PROGRAMS = benchmark.exe test-geoip.exe
|
||||
|
||||
all: GeoIP.lib test_progs app_progs
|
||||
|
||||
$(GEOIP_LIB):
|
||||
cd $(LIB_DIR)
|
||||
$(MAKE) -nologo -f Makefile.vc GEOIPDATADIR=$(GEOIPDATADIR)
|
||||
cd ..
|
||||
|
||||
test_progs:
|
||||
cd $(TEST_DIR)
|
||||
$(MAKE) -nologo -f Makefile.vc
|
||||
cd ..
|
||||
|
||||
app_progs:
|
||||
cd $(APP_DIR)
|
||||
$(MAKE) -nologo -f Makefile.vc
|
||||
cd ..
|
||||
|
||||
test: $(GEOIP_LIB) test_progs
|
||||
cd $(TEST_DIR)
|
||||
benchmark.exe
|
||||
test-geoip.exe
|
||||
cd ..
|
||||
|
||||
install: $(GEOIP_LIB) app_progs
|
||||
cd $(LIB_DIR)
|
||||
copy $(GEOIP_LIB) $(INSTALL_LIB)
|
||||
copy *.h $(INSTALL_INC)
|
||||
cd ..\$(APP_DIR)
|
||||
copy $(APP_PROGRAMS) $(INSTALL_BIN)
|
||||
cd ..\$(DATA_DIR)
|
||||
copy $(DATA_FILE) $(GEOIPDATADIR)
|
||||
cd ..
|
||||
|
||||
clean:
|
||||
del $(LIB_DIR)\*.obj $(LIB_DIR)\*.lib \
|
||||
$(APP_DIR)\*.obj $(APP_DIR)\*.exe \
|
||||
$(TEST_DIR)\*.obj $(TEST_DIR)\*.exe
|
||||
|
||||
|
|
@ -1,232 +0,0 @@
|
|||
###################################################################
|
||||
#
|
||||
## Makefile for building GeoIP stuff (Win32 version - gnu make)
|
||||
## To build the binaries you need awk, GNU make and MingW32 gcc
|
||||
## or Metrowerks CodeWarrior CommandlineTools.
|
||||
## Usage: make -f Makefile.win32 [all|dist|clean|distclean]
|
||||
##
|
||||
## hacked by: Guenter Knauf
|
||||
#
|
||||
###################################################################
|
||||
|
||||
# Edit the path below to point to your zlib sources and libs.
|
||||
ifndef ZLIBSDK
|
||||
ZLIBSDK = d:/projects/mingw32/zlib-1.2.3
|
||||
endif
|
||||
|
||||
ifndef DISTDIR
|
||||
DISTDIR = GeoIP-$(GEOIP_VERSION_STR)-bin-w32
|
||||
endif
|
||||
ARCHIVE = $(DISTDIR).zip
|
||||
|
||||
# Edit the vars below to change EXE target settings.
|
||||
TARGETS := $(patsubst apps/%.c,%.exe,$(wildcard apps/*.c))
|
||||
DESCR = $(subst .rc,,$(notdir $@)) $(GEOIP_VERSION_STR)
|
||||
COMPANY = MaxMind LLC
|
||||
COPYR = © 2003-2006 MaxMind LLC All Rights Reserved.
|
||||
WWWURL = http://www.maxmind.com/app/c
|
||||
LICENSE = Licensed under LGPL
|
||||
ICON = geoip.ico
|
||||
DATADIR = c:/GeoIP
|
||||
CONFDIR = c:/GeoIP
|
||||
|
||||
# Comment the line below if you dont want to link with the static libz.lib.
|
||||
LSTATIC = 1
|
||||
|
||||
# must be equal to DEBUG or NDEBUG
|
||||
DB = NDEBUG
|
||||
# DB = DEBUG
|
||||
# Optimization: -O<n> or debugging: -g
|
||||
ifeq ($(DB),NDEBUG)
|
||||
OPT = -O2
|
||||
OBJDIR = release
|
||||
else
|
||||
OPT = -g
|
||||
OBJDIR = debug
|
||||
endif
|
||||
OBJLIB = lib-$(OBJDIR)
|
||||
|
||||
# Include the version info retrieved from header.
|
||||
-include $(OBJDIR)/version.inc
|
||||
|
||||
# Global tools and toolflags used with all compilers.
|
||||
ZIP = zip -qzR9
|
||||
CP = cp -afv
|
||||
MV = mv -fv
|
||||
# RM = rm -f
|
||||
RE = reimp -d
|
||||
DLLTOOL = dlltool
|
||||
DTFLAGS = -k
|
||||
|
||||
# The following line defines your compiler.
|
||||
ifdef METROWERKS
|
||||
CC = mwcc
|
||||
else
|
||||
CC = gcc
|
||||
endif
|
||||
|
||||
# Global flags for all compilers
|
||||
CFLAGS = $(OPT) -D$(DB) -D_WIN32
|
||||
# -nostdinc
|
||||
CFLAGS += -DHAVE_STDINT_H
|
||||
CFLAGS += -DGEOIPDATADIR=\"$(DATADIR)\"
|
||||
CFLAGS += -DSYSCONFDIR=\"$(CONFDIR)\"
|
||||
|
||||
ifeq ($(CC),mwcc)
|
||||
LD = mwld
|
||||
LDFLAGS = -nostdlib
|
||||
LIBPATH = -lr "$(METROWERKS)/MSL" -lr "$(METROWERKS)/Win32-x86 Support/Libraries"
|
||||
CWLIBS = -lMSL_Runtime_x86.lib -lMSL_C_x86.lib -lMSL_Extras_x86.lib
|
||||
LDLIBS = -lkernel32.lib -luser32.lib $(CWLIBS)
|
||||
AR = mwld
|
||||
ARFLAGS = -type library -w nocmdline $(OBJDIR)/*.o -o
|
||||
LIBEXT = lib
|
||||
RC = mwwinrc
|
||||
CFLAGS += -nostdinc
|
||||
CFLAGS += -msgstyle gcc -gccinc -opt nointrinsics -proc 586
|
||||
CFLAGS += -relax_pointers
|
||||
#CFLAGS += -w on
|
||||
CFLAGS += -ir "$(METROWERKS)/MSL" -ir "$(METROWERKS)/Win32-x86 Support/Headers"
|
||||
else
|
||||
LD = gcc
|
||||
LDFLAGS = -s
|
||||
AR = ar
|
||||
ARFLAGS = -cq
|
||||
LIBEXT = a
|
||||
RC = windres
|
||||
RCFLAGS = -I rc -O coff -i
|
||||
CFLAGS += -Wall -Wno-unused # -Wno-format #-pedantic
|
||||
endif
|
||||
|
||||
INCLUDES += -I./libGeoIP
|
||||
INCLUDES += -I$(ZLIBSDK)
|
||||
CFLAGS += $(INCLUDES)
|
||||
|
||||
LDLIBS += -lwsock32
|
||||
LIBPATH += -L$(ZLIBSDK)
|
||||
ifdef LSTATIC
|
||||
LDLIBS += -lz
|
||||
else
|
||||
LDLIBS += -lzdll
|
||||
endif
|
||||
|
||||
ifeq ($(findstring linux,$(OSTYPE)),linux)
|
||||
DL = '
|
||||
#-include $(NDKBASE)/nlmconv/ncpfs.inc
|
||||
endif
|
||||
|
||||
vpath %.c ./apps ./libGeoIP
|
||||
|
||||
LIBOBJS = $(OBJLIB)/GeoIP.o $(OBJLIB)/GeoIPCity.o
|
||||
UPDOBJS = $(OBJLIB)/GeoIPUpdate.o $(OBJLIB)/md5.o
|
||||
LIBOBJS += $(UPDOBJS)
|
||||
|
||||
.PRECIOUS: $(OBJLIB)/%.o $(OBJDIR)/%.o $(OBJDIR)/%.rc
|
||||
|
||||
all: prebuild $(TARGETS)
|
||||
|
||||
prebuild: $(OBJLIB) $(OBJDIR) $(OBJDIR)/version.inc
|
||||
|
||||
dist: $(DISTDIR) all $(DISTDIR)/readme_bin.txt
|
||||
@$(CP) *.exe $(DISTDIR)
|
||||
@$(CP) Changelog $(DISTDIR)
|
||||
@$(CP) README $(DISTDIR)
|
||||
@$(CP) conf/GeoIP.conf.default $(DISTDIR)
|
||||
@$(CP) data/GeoIP.dat $(DISTDIR)
|
||||
@echo Creating $(ARCHIVE)
|
||||
@$(ZIP) $(ARCHIVE) $(DISTDIR)/* < $(DISTDIR)/readme_bin.txt
|
||||
|
||||
clean:
|
||||
-$(RM) -r $(OBJDIR) $(OBJLIB)
|
||||
-$(RM) $(TARGETS)
|
||||
|
||||
distclean:
|
||||
-$(RM) -r $(DISTDIR)
|
||||
-$(RM) $(ARCHIVE)
|
||||
|
||||
%.exe: $(OBJDIR)/%.res $(LIBOBJS) $(OBJDIR)/%.o
|
||||
@echo Linking $@
|
||||
@-$(RM) $@
|
||||
$(LD) $(LDFLAGS) -o $@ $^ $(LIBPATH) $(LDLIBS)
|
||||
# $(LD) $(LDFLAGS) $(LIBPATH) $(LIBFILES) -o $@ $^
|
||||
|
||||
$(DISTDIR):
|
||||
@mkdir $@
|
||||
|
||||
$(OBJDIR):
|
||||
@mkdir $@
|
||||
|
||||
$(OBJLIB):
|
||||
@mkdir $@
|
||||
|
||||
$(OBJDIR)/%.o: %.c
|
||||
# @echo Compiling $<
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
$(OBJLIB)/%.o: %.c
|
||||
# @echo Compiling $<
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
$(OBJDIR)/version.inc: configure.in $(OBJDIR)
|
||||
@echo Creating $@
|
||||
@awk -f get_ver.awk $< > $@
|
||||
|
||||
$(OBJDIR)/%.res: $(OBJDIR)/%.rc
|
||||
@echo Creating $@
|
||||
@$(RC) $(RCFLAGS) $< -o $@
|
||||
|
||||
$(OBJDIR)/%.rc: Makefile.win32
|
||||
@echo 1 VERSIONINFO > $@
|
||||
@echo FILEVERSION $(GEOIP_VERSION),0 >> $@
|
||||
@echo PRODUCTVERSION $(GEOIP_VERSION),0 >> $@
|
||||
@echo FILEFLAGSMASK 0x3fL >> $@
|
||||
@echo FILEOS 0x40004L >> $@
|
||||
@echo FILEFLAGS 0x0L >> $@
|
||||
@echo FILETYPE 0x1L >> $@
|
||||
@echo FILESUBTYPE 0x0L >> $@
|
||||
@echo BEGIN >> $@
|
||||
@echo BLOCK "StringFileInfo" >> $@
|
||||
@echo BEGIN >> $@
|
||||
@echo BLOCK "040904E4" >> $@
|
||||
@echo BEGIN >> $@
|
||||
@echo VALUE "LegalCopyright","$(COPYR)\0" >> $@
|
||||
ifdef COMPANY
|
||||
@echo VALUE "CompanyName","$(COMPANY)\0" >> $@
|
||||
endif
|
||||
ifdef LICENSE
|
||||
@echo VALUE "License","$(LICENSE)\0" >> $@
|
||||
endif
|
||||
@echo VALUE "ProductName","$(basename $(notdir $@))\0" >> $@
|
||||
@echo VALUE "ProductVersion","$(GEOIP_VERSION_STR)\0" >> $@
|
||||
@echo VALUE "FileDescription","$(DESCR)\0" >> $@
|
||||
@echo VALUE "FileVersion","$(GEOIP_VERSION_STR)\0" >> $@
|
||||
@echo VALUE "InternalName","$(basename $(notdir $@))\0" >> $@
|
||||
@echo VALUE "OriginalFilename","$(basename $(notdir $@)).exe\0" >> $@
|
||||
@echo VALUE "WWW","$(WWWURL)\0" >> $@
|
||||
@echo END >> $@
|
||||
@echo END >> $@
|
||||
@echo BLOCK "VarFileInfo" >> $@
|
||||
@echo BEGIN >> $@
|
||||
@echo VALUE "Translation", 0x409, 1252 >> $@
|
||||
@echo END >> $@
|
||||
@echo END >> $@
|
||||
ifdef ICON
|
||||
@echo 10 ICON DISCARDABLE "$(ICON)" >> $@
|
||||
endif
|
||||
|
||||
$(DISTDIR)/readme_bin.txt: Makefile.win32
|
||||
@echo Creating $@
|
||||
@echo $(DL)This is a binary distribution for Win32 platform.$(DL) > $@
|
||||
@echo $(DL)GeoIP version $(GEOIP_VERSION_STR)$(DL) >> $@
|
||||
ifndef LSTATIC
|
||||
@echo $(DL)These binaries depend on zlib1.dll in the search path!$(DL) >> $@
|
||||
endif
|
||||
@echo $(DL)Please download the complete GeoIP package for$(DL) >> $@
|
||||
@echo $(DL)any further documentation:$(DL) >> $@
|
||||
@echo $(DL)$(WWWURL)$(DL) >> $@
|
||||
|
||||
info:
|
||||
@echo Targets to build: $(TARGETS)
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,208 +0,0 @@
|
|||
GeoIP 1.4.8
|
||||
-----------
|
||||
|
||||
*** Experimental IPv6 notice ***
|
||||
|
||||
- the experimental IPv6 part of libGeoIP may change in the future.
|
||||
- It is possible, that geoiplookup and geoiplookup6 will merged.
|
||||
|
||||
***
|
||||
|
||||
The new perl script geoipupdate-pureperl.pl is a drop in replacement for
|
||||
geoipupdate. Useful, if you like to customize, pre or postprocess new or
|
||||
old databases. To archive the databases or signal apache whatever.
|
||||
Another advantage is, that geoipupdate-pureperl.pl is able to handle proxy
|
||||
requests even with authentication.
|
||||
|
||||
IMPORTANT API Change for 1.3.x and above users for GeoIP Region database
|
||||
GeoIPRegion.region is no longer a pointer but an in-structure
|
||||
array so test the first byte of region == 0 rather testing if the region
|
||||
pointer is NULL.
|
||||
|
||||
IMPORTANT API Change for 1.1.x and above users - as of GeoIP 1.1.0 the
|
||||
GeoIP_country_xxx_by_xxx functions return NULL if a country can not
|
||||
be found (it used to return '--' or 'N/A'. Be sure to check the
|
||||
return value for NULL, to avoid segmentation faults!
|
||||
|
||||
GeoIP is a C library that enables the user to find geographical and
|
||||
network information of an IP address.
|
||||
Included is a free GeoLite Country database
|
||||
that is updated at the beginning of every month.
|
||||
To download the latest free GeoLite Country database, go to:
|
||||
http://www.maxmind.com/app/geoip_country
|
||||
|
||||
There is also a free city-level geolocation database, GeoLite City,
|
||||
available from:
|
||||
http://www.maxmind.com/app/geolitecity
|
||||
|
||||
We also offer commercial GeoIP databases with greater accuracy and
|
||||
additional network information, for more details, see:
|
||||
http://www.maxmind.com/app/products
|
||||
|
||||
As of version 1.4.5 geoipupdate can handle updates via HTTP Proxy Server.
|
||||
If the environ variable http_proxy="http://proxy-host:port" is set.
|
||||
The username:password (as in FTP URLs) is not supported!
|
||||
Thanks to Andrew Droffner for the patch!
|
||||
|
||||
As of version 1.3.6, the GeoIP C library is thread safe, as long as
|
||||
GEOIP_CHECK_CACHE is not used.
|
||||
|
||||
This module can be used to automatically select the geographically closest
|
||||
mirror, to analyze your web server logs to determine the countries of your
|
||||
visitors, for credit card fraud detection, and for software export controls.
|
||||
|
||||
If you use GeoIP to block access from high risk countries in order
|
||||
to reduce fraud or abuse, you should also block access from known
|
||||
proxy servers. For more details, see:
|
||||
http://www.maxmind.com/app/proxy
|
||||
|
||||
To install, run:
|
||||
|
||||
./configure
|
||||
make
|
||||
make check
|
||||
make install
|
||||
|
||||
The GeoIP C library relies on GNU make, not on BSD make
|
||||
|
||||
MEMORY CACHING AND OTHER OPTIONS
|
||||
|
||||
There are four options available:
|
||||
|
||||
GEOIP_STANDARD - read database from filesystem, uses least memory.
|
||||
|
||||
GEOIP_MEMORY_CACHE - load database into memory, faster performance
|
||||
but uses more memory
|
||||
|
||||
GEOIP_CHECK_CACHE - check for updated database. If database has been updated,
|
||||
reload filehandle and/or memory cache.
|
||||
|
||||
GEOIP_INDEX_CACHE - just cache
|
||||
the most frequently accessed index portion of the database, resulting
|
||||
in faster lookups than GEOIP_STANDARD, but less memory usage than
|
||||
GEOIP_MEMORY_CACHE - useful for larger databases such as
|
||||
GeoIP Organization and GeoIP City. Note, for GeoIP Country, Region
|
||||
and Netspeed databases, GEOIP_INDEX_CACHE is equivalent to GEOIP_MEMORY_CACHE
|
||||
|
||||
GEOIP_MMAP_CACHE - load database into mmap shared memory ( MMAP is not avail for WIN32 )
|
||||
|
||||
The options can be combined using bit operators. For example you can
|
||||
use both GEOIP_MEMORY_CACHE and GEOIP_CHECK_CACHE by calling:
|
||||
|
||||
GeoIP_open("/path/to/GeoIP.dat", GEOIP_MEMORY_CACHE | GEOIP_CHECK_CACHE);
|
||||
|
||||
By default, the city name is returned in iso-8859-1 charset. To obtain the
|
||||
city name in utf8 instead, run:
|
||||
|
||||
GeoIP_set_charset(gi, GEOIP_CHARSET_UTF8);
|
||||
|
||||
To get the netmask of the netblock of the last lookup, use GeoIP_last_netblock(gi).
|
||||
|
||||
EXAMPLES
|
||||
|
||||
See
|
||||
test/
|
||||
test-geoip.c
|
||||
test-geoip-region.c
|
||||
test-geoip-city.c
|
||||
test-geoip-isp.c
|
||||
test-geoip-org.c
|
||||
test-geoip-netspeed.c
|
||||
|
||||
for examples of how to use the API. The test-geoip.c program works with both the GeoLite and
|
||||
GeoIP Country databases. The test-geoip-city.c program works with both the GeoLite and
|
||||
GeoIP City databases. The other example programs require the paid databases available
|
||||
from http://www.maxmind.com/app/products
|
||||
|
||||
AUTOMATIC UPDATES
|
||||
|
||||
MaxMind offers a service where you can have your database updated
|
||||
automically each week. For more details see:
|
||||
|
||||
http://www.maxmind.com/app/license_key
|
||||
|
||||
RESOURCES Mailinglists
|
||||
|
||||
Please join the very low traffic mailinglists you are interested in.
|
||||
|
||||
http://sourceforge.net/mail/?group_id=66844
|
||||
|
||||
Preformance Patches.
|
||||
|
||||
Patrick McManus provide a patch to enhance the lookupspeed in MEMORY_CACHE mode. If you feel, that the current MEMORY_CACHE mode is to slow try the patch:
|
||||
|
||||
http://sourceforge.net/mailarchive/forum.php?forum_name=geoip-c-discuss&max_rows=25&style=nested&viewmonth=200803
|
||||
|
||||
TROUBLESHOOTING
|
||||
|
||||
If you run into trouble building your application with GeoIP support, try adding -fms-extensions to your CFLAGS. If you use Solaris and there C-Compiler use -features=extensions instead. These options enable unnamed union support and fix problems like: 'improper member use: dma_code' or 'GeoIPRecord' has no member named 'dma_code'.
|
||||
|
||||
Note that it is recommended that you use GNU make. Also, if you are using
|
||||
OpenBSD, GeoIP requires OpenBSD 3.1 or greater.
|
||||
|
||||
if you get "cannot load shared object file: No such file or directory"
|
||||
error, add the directory libGeoIP.so was installed to to /etc/ld.so.conf
|
||||
and run ldconfig
|
||||
|
||||
On Solaris, if you get a
|
||||
ld: fatal: relocations remain against allocatable but non-writable sections
|
||||
error, try running
|
||||
|
||||
# make clean
|
||||
# ./configure --disable-shared
|
||||
# make
|
||||
|
||||
If you get a "ar : command not found" error, make sure that ar is
|
||||
in your path. On Solaris, ar is typically found in /usr/ccs/bin
|
||||
|
||||
If you get a "geoipupdate.c:24: getopt.h: No such file or directory"
|
||||
error, run
|
||||
|
||||
# export CPPFLAGS="-I/usr/local/include"
|
||||
|
||||
(assuming that getopt.h is in /usr/local/include)
|
||||
|
||||
If you get a "zlib.h: No such file or directory" error, make sure
|
||||
that the zlib development libraries are installed on your server.
|
||||
These are typically included in a "zlib-devel" package.
|
||||
|
||||
If you get a "bad interpreter: No such file or directory" error
|
||||
when running ./configure, make sure that there are no DOS
|
||||
returns in the configure script. To remove DOS returns,
|
||||
run perl -pi -e 's!\r!!g' configure.
|
||||
|
||||
If gcc fails while consuming a large amount of memory, try
|
||||
compiling with CFLAGS=-O1 (or -O0) instead of the default -O2.
|
||||
It seems that some
|
||||
versions of gcc have a bug and consume 1 GB of memory when optimizing
|
||||
certain source files (the other source file where this was reported is
|
||||
from XORG X-Server). It happens at least with gcc 3.3.1 and with gcc
|
||||
4.2(.0). Thanks to Kai Schätzl for the report.
|
||||
|
||||
If GEOIP_MMAP_CACHE doesn't work on a 64bit machine, try adding
|
||||
the flag "MAP_32BIT" to the mmap call.
|
||||
|
||||
If you get a "passing argument 3 of 'gethostbyname_r' from incompatible pointer type"
|
||||
error on AIX, download and/or untar a fresh copy of GeoIP. ( To avoid cached
|
||||
results from a previous ./configure run )
|
||||
|
||||
cd ./GeoIP-1.4.6
|
||||
then edit the file ./configure
|
||||
|
||||
and delete these two lines:
|
||||
|
||||
#define HAVE_GETHOSTBYNAME_R 1
|
||||
|
||||
#define GETHOSTBYNAME_R_RETURNS_INT 1
|
||||
|
||||
then save the configure script
|
||||
|
||||
and build it as usual
|
||||
|
||||
./configure
|
||||
make
|
||||
sudo make install
|
||||
|
||||
|
||||
|
||||
To submit a patch, please contact support@maxmind.com
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
# how to build under MinGW/MSYS:
|
||||
# (first you need to build & "install" zlib)
|
||||
|
||||
export "CFLAGS=-O3 -I/usr/local/include"
|
||||
export "LDFLAGS=-L/usr/local/lib -lwsock32"
|
||||
./configure
|
||||
make
|
||||
cp data/GeoIP.dat test/
|
||||
make check
|
||||
|
||||
# note that GeoIP.dat file should be placed in the
|
||||
# same place as GeoIP-enabled executable modules!
|
||||
# there's NO DEFAULT PATH concept on Win32 :)
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Building OSX fat binaries is easy.
|
||||
#
|
||||
# - start in a clean directory.
|
||||
# - copy the shell script below to a file and edit the file to your needs.
|
||||
#
|
||||
# 1.) modify export GEOIP_ARCH='-arch i386 -arch x86_64 -arch ppc -arch ppc64'
|
||||
# to include all architectures you need.
|
||||
# 2.) add whatever you want to the ./configure line.
|
||||
# 3.) execute the script.
|
||||
# 4.) do a 'make install'
|
||||
#
|
||||
#
|
||||
# make clean or make distclean before building this
|
||||
#
|
||||
# tell systems before leopard that we like to build for 10.5 or higher
|
||||
# with MACOSX_DEPLOYMENT_TARGET=10.5
|
||||
# starting with leopard we have to add -mmacosx-version-min=10.5
|
||||
# to the CFLAGS and export MACOSX_DEPLOYMENT_TARGET!?
|
||||
|
||||
## for tiger, leopard and snow leopard you might use this
|
||||
## export GEOIP_ARCH='-arch i386 -arch x86_64 -arch ppc -arch ppc64'
|
||||
## export MACOSX_DEPLOYMENT_TARGET=10.4
|
||||
## export LDFLAGS=$GEOIP_ARCH
|
||||
## export CFLAGS="-mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk $GEOIP_ARCH"
|
||||
|
||||
# here we go for leopard and snow leopard
|
||||
export GEOIP_ARCH='-arch i386 -arch x86_64 -arch ppc'
|
||||
export MACOSX_DEPLOYMENT_TARGET=10.5
|
||||
export LDFLAGS=$GEOIP_ARCH
|
||||
export CFLAGS="-g -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk $GEOIP_ARCH"
|
||||
./configure --disable-dependency-tracking
|
||||
perl -i.bak -pe'/^archive_cmds=/ and !/\bGEOIP_ARCH\b/ and s/-dynamiclib\b/-dynamiclib \\\$(GEOIP_ARCH)/' ./libtool
|
||||
make
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
=======================================================
|
||||
|
||||
Environmental variables:
|
||||
|
||||
1. GeoIPDBFileName is hardcoded to "\\windows\\system32\\GeoIP.dat" on
|
||||
windows in GeoIP.c
|
||||
2. #ifdef DLL is used to determine whether you want to have a DLL built
|
||||
in GeoIP.h
|
||||
|
||||
You may want to change these depending on your system configuration
|
||||
and compiler.
|
||||
|
||||
=======================================================
|
||||
Thanks to Chris Gibbs for supplying these instructions.
|
||||
|
||||
The GeoIP C library should work under windows. Note that it requires the zlib
|
||||
DLL.
|
||||
|
||||
To install zlib with GeoIP:
|
||||
|
||||
i) Downloda the zlib prebuilt DLL and static library from
|
||||
http://www.winimage.com/zLibDll/ look for "pre-built zlib DLL".
|
||||
|
||||
Unzip it to some location on your hard drive, and in Project-->Settings ,
|
||||
go to the Link tab, and add the following 3 libraries:
|
||||
|
||||
ws2_32.lib
|
||||
zlib.lib
|
||||
zlibstat.lib
|
||||
|
||||
iii) Go to Tools-->Options, then the Directories tab, and add library paths to
|
||||
the locations of the zlib static libraries. You will also need to add the
|
||||
include path to zlib.h to the include paths.
|
||||
|
||||
iv) NOTE: These instructions are for MS VC++ 6.0, but should be similar for
|
||||
previous versions, and for VC .NET.
|
||||
|
||||
=======================================================
|
||||
Building GeoIP as a DLL
|
||||
|
||||
Stanislaw Pusep has contributed a patch for building GeoIP as a DLL.
|
||||
You can find the patch in GeoIPWinDLL.patch
|
||||
|
||||
Note a modified version of this patch is now merged into the main code.
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
To make a static GeoIP.lib, edit the top level
|
||||
Makefile.vc to reflect where the GeoIP.dat database
|
||||
file should be placed, as well as the locations
|
||||
of the lib, include, and bin directories for installation.
|
||||
Then give the command
|
||||
nmake /f Makefile.vc
|
||||
This will build the GeoIP.lib library, as well as available
|
||||
application and test programs. The command
|
||||
nmake /f Makefile.vc test
|
||||
will run available tests in the test/ subdirectory.
|
||||
nmake /f Makefile.vc install
|
||||
will then copy the lib and header files to the locations
|
||||
specified in the top-level Makefile.vc, as well as
|
||||
available application programs in the apps/ subdirectory.
|
||||
nmake /f Makefile.vc clean
|
||||
will remove intermediate object and executable files.
|
||||
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
Rutger Okhuizen 7/31/2006
|
||||
|
||||
Implement waiting algorithm for GEOIP_CHECK_CACHE,
|
||||
so stat is called on every lookup.
|
||||
|
||||
-----------------------
|
||||
|
||||
Maurice Cinquini
|
||||
|
||||
*** ifndef WIN32 on netdb.h ? ***
|
||||
In GeoIPCity.c you don't "#ifndef WIN32" the netdb.h include,
|
||||
but in GeoIP.c you do. Which one is right?
|
||||
|
||||
*** Warnings in GeoIP-1.2.1 before I made changes ***
|
||||
GeoIPUpdate.c:73: warning: implicit declaration of function `_setup_dbfilename'
|
||||
I suggest a GeoIP_private.h file to include prototypes for
|
||||
_setup_dbfilename and other private functions also used by GeoIPCity.c
|
||||
|
||||
*** Drop the GeoIP_*_by_addr API calls ***
|
||||
And now that I think of it, why do you need a seperate
|
||||
GeoIP_region_by_addr and GeoIP_region_by_name since
|
||||
the later does the work of the former just as efficently.
|
||||
For backward compatibility you could #define GeoIP_region_by_addr
|
||||
to GeoIP_region_by_name
|
||||
|
||||
|
||||
|
||||
|
||||
Performance improvements suggested by Jason Linhart
|
||||
1. cluster nodes to improve disk performance when using GEOIP_STANDARD
|
||||
2. evaluate preformance of replacing binary tree with nodes containing 4 children
|
||||
|
||||
Write function to list countries, sorted by name. Chris Gibbs contributed this which could be
|
||||
used:
|
||||
|
||||
int GeoIP_country_sorted_index[246] = {
|
||||
0, 5, 8, 61, 14, 3, 11, 7, 12, 6, 13, 9, 17, 1, 16, 15, 18, 32, 25, 21,
|
||||
20,36, 22, 37, 27, 28, 33, 30, 19, 35, 34, 31, 104, 29, 24, 23, 26,
|
||||
114, 47, 38, 52,121, 41, 207, 46, 48, 53, 39, 49, 116, 42, 40, 45,
|
||||
50, 44, 97, 51, 54, 55, 58, 57, 59, 60, 216, 62, 64, 203, 87, 66,
|
||||
63, 68, 2, 71, 73, 70, 69, 74, 75, 80, 170,208, 76, 84, 79, 56, 81,
|
||||
82, 88, 83, 78, 86, 91, 90, 85, 92, 93, 98, 95, 228, 96,94, 99, 107,
|
||||
103, 100, 106, 105, 101, 102, 108, 109, 111, 110, 122, 112, 115,
|
||||
118,119, 120, 113, 123, 132, 124, 129, 128, 133, 126, 130, 131,
|
||||
143, 139, 137,151,153, 150, 140, 148, 138, 145, 146, 149, 238,
|
||||
152, 72, 136, 135, 142, 147, 134,154, 141, 155, 164, 163, 161,
|
||||
10, 156, 166, 160, 157, 159, 165, 158, 144, 162, 167,173, 180,
|
||||
178, 168, 171, 181, 169, 172, 176, 174, 179, 177, 182, 183, 184,
|
||||
185,186, 193, 117, 125, 175, 229, 236, 198, 202, 187, 199, 189,
|
||||
197, 192, 196,194,188, 200, 240, 89, 67, 127, 190, 201, 195, 205,
|
||||
191, 43, 204, 220, 211, 221,210,209, 212, 215, 218, 214, 217,
|
||||
213,206, 219, 223, 222, 4, 77, 225, 224, 226,227,234, 230, 233,
|
||||
231,232, 235, 65, 237, 239, 242, 241, 243, 244, 245};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,26 +0,0 @@
|
|||
INCLUDES = \
|
||||
-I$(top_srcdir)/libGeoIP \
|
||||
-Wall
|
||||
|
||||
AM_CPPFLAGS = -DSYSCONFDIR=\"$(sysconfdir)\" -Wall
|
||||
|
||||
DEPS = $(top_builddir)/libGeoIP/libGeoIP.la
|
||||
LDADDS = $(top_builddir)/libGeoIP/libGeoIP.la
|
||||
|
||||
bin_PROGRAMS = geoiplookup geoiplookup6 geoipupdate
|
||||
|
||||
geoiplookup_SOURCES = geoiplookup.c
|
||||
geoiplookup_LDFLAGS =
|
||||
geoiplookup_DEPENDENCIES = $(top_builddir)/libGeoIP/libGeoIP.la
|
||||
geoiplookup_LDADD = $(top_builddir)/libGeoIP/libGeoIP.la
|
||||
|
||||
geoiplookup6_SOURCES = geoiplookup6.c
|
||||
geoiplookup6_LDFLAGS =
|
||||
geoiplookup6_DEPENDENCIES = $(top_builddir)/libGeoIP/libGeoIP.la
|
||||
geoiplookup6_LDADD = $(top_builddir)/libGeoIP/libGeoIP.la
|
||||
|
||||
geoipupdate_SOURCES = geoipupdate.c
|
||||
geoipupdate_LDFLAGS =
|
||||
geoipupdate_DEPENDENCIES = $(top_builddir)/libGeoIP/libGeoIP.la $(top_builddir)/libGeoIP/libGeoIPUpdate.la
|
||||
geoipupdate_LDADD = $(top_builddir)/libGeoIP/libGeoIPUpdate.la $(top_builddir)/libGeoIP/libGeoIP.la
|
||||
EXTRA_DIST = geoipupdate-pureperl.pl Makefile.vc
|
||||
|
|
@ -1,544 +0,0 @@
|
|||
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
|
||||
# Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
bin_PROGRAMS = geoiplookup$(EXEEXT) geoiplookup6$(EXEEXT) \
|
||||
geoipupdate$(EXEEXT)
|
||||
subdir = apps
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.in
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
am__installdirs = "$(DESTDIR)$(bindir)"
|
||||
PROGRAMS = $(bin_PROGRAMS)
|
||||
am_geoiplookup_OBJECTS = geoiplookup.$(OBJEXT)
|
||||
geoiplookup_OBJECTS = $(am_geoiplookup_OBJECTS)
|
||||
geoiplookup_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(geoiplookup_LDFLAGS) $(LDFLAGS) -o $@
|
||||
am_geoiplookup6_OBJECTS = geoiplookup6.$(OBJEXT)
|
||||
geoiplookup6_OBJECTS = $(am_geoiplookup6_OBJECTS)
|
||||
geoiplookup6_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(geoiplookup6_LDFLAGS) $(LDFLAGS) -o $@
|
||||
am_geoipupdate_OBJECTS = geoipupdate.$(OBJEXT)
|
||||
geoipupdate_OBJECTS = $(am_geoipupdate_OBJECTS)
|
||||
geoipupdate_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(geoipupdate_LDFLAGS) $(LDFLAGS) -o $@
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
am__mv = mv -f
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
|
||||
--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
|
||||
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
|
||||
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
|
||||
$(LDFLAGS) -o $@
|
||||
SOURCES = $(geoiplookup_SOURCES) $(geoiplookup6_SOURCES) \
|
||||
$(geoipupdate_SOURCES)
|
||||
DIST_SOURCES = $(geoiplookup_SOURCES) $(geoiplookup6_SOURCES) \
|
||||
$(geoipupdate_SOURCES)
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GEOIP_VERSION_INFO = @GEOIP_VERSION_INFO@
|
||||
GREP = @GREP@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
lt_ECHO = @lt_ECHO@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
INCLUDES = \
|
||||
-I$(top_srcdir)/libGeoIP \
|
||||
-Wall
|
||||
|
||||
AM_CPPFLAGS = -DSYSCONFDIR=\"$(sysconfdir)\" -Wall
|
||||
DEPS = $(top_builddir)/libGeoIP/libGeoIP.la
|
||||
LDADDS = $(top_builddir)/libGeoIP/libGeoIP.la
|
||||
geoiplookup_SOURCES = geoiplookup.c
|
||||
geoiplookup_LDFLAGS =
|
||||
geoiplookup_DEPENDENCIES = $(top_builddir)/libGeoIP/libGeoIP.la
|
||||
geoiplookup_LDADD = $(top_builddir)/libGeoIP/libGeoIP.la
|
||||
geoiplookup6_SOURCES = geoiplookup6.c
|
||||
geoiplookup6_LDFLAGS =
|
||||
geoiplookup6_DEPENDENCIES = $(top_builddir)/libGeoIP/libGeoIP.la
|
||||
geoiplookup6_LDADD = $(top_builddir)/libGeoIP/libGeoIP.la
|
||||
geoipupdate_SOURCES = geoipupdate.c
|
||||
geoipupdate_LDFLAGS =
|
||||
geoipupdate_DEPENDENCIES = $(top_builddir)/libGeoIP/libGeoIP.la $(top_builddir)/libGeoIP/libGeoIPUpdate.la
|
||||
geoipupdate_LDADD = $(top_builddir)/libGeoIP/libGeoIPUpdate.la $(top_builddir)/libGeoIP/libGeoIP.la
|
||||
EXTRA_DIST = geoipupdate-pureperl.pl Makefile.vc
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu apps/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu apps/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
install-binPROGRAMS: $(bin_PROGRAMS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
|
||||
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed 's/$(EXEEXT)$$//' | \
|
||||
while read p p1; do if test -f $$p || test -f $$p1; \
|
||||
then echo "$$p"; echo "$$p"; else :; fi; \
|
||||
done | \
|
||||
sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
|
||||
-e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
|
||||
sed 'N;N;N;s,\n, ,g' | \
|
||||
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
|
||||
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
|
||||
if ($$2 == $$4) files[d] = files[d] " " $$1; \
|
||||
else { print "f", $$3 "/" $$4, $$1; } } \
|
||||
END { for (d in files) print "f", d, files[d] }' | \
|
||||
while read type dir files; do \
|
||||
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
|
||||
test -z "$$files" || { \
|
||||
echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
|
||||
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
|
||||
} \
|
||||
; done
|
||||
|
||||
uninstall-binPROGRAMS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
|
||||
files=`for p in $$list; do echo "$$p"; done | \
|
||||
sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
|
||||
-e 's/$$/$(EXEEXT)/' `; \
|
||||
test -n "$$list" || exit 0; \
|
||||
echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(bindir)" && rm -f $$files
|
||||
|
||||
clean-binPROGRAMS:
|
||||
@list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
|
||||
echo " rm -f" $$list; \
|
||||
rm -f $$list || exit $$?; \
|
||||
test -n "$(EXEEXT)" || exit 0; \
|
||||
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
|
||||
echo " rm -f" $$list; \
|
||||
rm -f $$list
|
||||
geoiplookup$(EXEEXT): $(geoiplookup_OBJECTS) $(geoiplookup_DEPENDENCIES)
|
||||
@rm -f geoiplookup$(EXEEXT)
|
||||
$(geoiplookup_LINK) $(geoiplookup_OBJECTS) $(geoiplookup_LDADD) $(LIBS)
|
||||
geoiplookup6$(EXEEXT): $(geoiplookup6_OBJECTS) $(geoiplookup6_DEPENDENCIES)
|
||||
@rm -f geoiplookup6$(EXEEXT)
|
||||
$(geoiplookup6_LINK) $(geoiplookup6_OBJECTS) $(geoiplookup6_LDADD) $(LIBS)
|
||||
geoipupdate$(EXEEXT): $(geoipupdate_OBJECTS) $(geoipupdate_DEPENDENCIES)
|
||||
@rm -f geoipupdate$(EXEEXT)
|
||||
$(geoipupdate_LINK) $(geoipupdate_OBJECTS) $(geoipupdate_LDADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/geoiplookup.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/geoiplookup6.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/geoipupdate.Po@am__quote@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
|
||||
|
||||
.c.obj:
|
||||
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
|
||||
|
||||
.c.lo:
|
||||
@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(PROGRAMS)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(bindir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am: install-binPROGRAMS
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-binPROGRAMS
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
|
||||
clean-generic clean-libtool ctags distclean distclean-compile \
|
||||
distclean-generic distclean-libtool distclean-tags distdir dvi \
|
||||
dvi-am html html-am info info-am install install-am \
|
||||
install-binPROGRAMS install-data install-data-am install-dvi \
|
||||
install-dvi-am install-exec install-exec-am install-html \
|
||||
install-html-am install-info install-info-am install-man \
|
||||
install-pdf install-pdf-am install-ps install-ps-am \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
maintainer-clean maintainer-clean-generic mostlyclean \
|
||||
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
|
||||
pdf pdf-am ps ps-am tags uninstall uninstall-am \
|
||||
uninstall-binPROGRAMS
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
#NMAKE makefile for Windows developers.
|
||||
#Produces a static library (GeoIP.lib).
|
||||
|
||||
COMPILER=cl
|
||||
|
||||
LINK = link -nologo
|
||||
|
||||
CFLAGS=-DWIN32 -MD -nologo
|
||||
|
||||
GEOIPINC = -I..\libGeoIP
|
||||
|
||||
CC1 = $(COMPILER) $(CFLAGS) $(GEOIPINC)
|
||||
|
||||
GEOIPLIB = ..\libGeoIP\GeoIP.lib
|
||||
|
||||
EXTRA_LIBS= advapi32.lib wsock32.lib
|
||||
|
||||
AR=lib
|
||||
|
||||
APPS: geoiplookup.exe
|
||||
|
||||
geoiplookup.exe: geoiplookup.c
|
||||
$(CC1) -c geoiplookup.c
|
||||
$(LINK) geoiplookup.obj $(GEOIPLIB)
|
||||
|
||||
|
|
@ -1,401 +0,0 @@
|
|||
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
|
||||
/* geoiplookup.c
|
||||
*
|
||||
* Copyright (C) 2006 MaxMind LLC
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "GeoIP.h"
|
||||
#include "GeoIPCity.h"
|
||||
#include "GeoIP_internal.h"
|
||||
|
||||
#if defined(_WIN32)
|
||||
# ifndef uint32_t
|
||||
typedef unsigned int uint32_t;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
void geoiplookup(GeoIP* gi,char *hostname,int i);
|
||||
|
||||
void usage() {
|
||||
fprintf(stderr,"Usage: geoiplookup [-d custom_dir] [-f custom_file] [-v] [-i] <ipaddress|hostname>\n");
|
||||
}
|
||||
|
||||
/* extra info used in _say_range_ip */
|
||||
int info_flag = 0;
|
||||
|
||||
int main (int argc, char *argv[]) {
|
||||
char * hostname = NULL;
|
||||
char * db_info;
|
||||
GeoIP * gi;
|
||||
int i;
|
||||
char *custom_directory = NULL;
|
||||
char *custom_file = NULL;
|
||||
int version_flag = 0;
|
||||
|
||||
if (argc < 2) {
|
||||
usage();
|
||||
exit(1);
|
||||
}
|
||||
i = 1;
|
||||
while (i < argc) {
|
||||
if (strcmp(argv[i],"-v") == 0) {
|
||||
version_flag = 1;
|
||||
} else if (strcmp(argv[i],"-i") == 0) {
|
||||
info_flag = 1;
|
||||
} else if (strcmp(argv[i],"-f") == 0) {
|
||||
if ((i+1) < argc){
|
||||
i++;
|
||||
custom_file = argv[i];
|
||||
}
|
||||
} else if (strcmp(argv[i],"-d") == 0) {
|
||||
if ((i+1) < argc){
|
||||
i++;
|
||||
custom_directory = argv[i];
|
||||
}
|
||||
} else {
|
||||
hostname = argv[i];
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (hostname == NULL) {
|
||||
usage();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (custom_directory != NULL) {
|
||||
GeoIP_setup_custom_directory(custom_directory);
|
||||
}
|
||||
_GeoIP_setup_dbfilename();
|
||||
|
||||
if (custom_file != NULL) {
|
||||
gi = GeoIP_open(custom_file, GEOIP_STANDARD);
|
||||
|
||||
if (NULL == gi) {
|
||||
printf("%s not available, skipping...\n", custom_file);
|
||||
} else {
|
||||
i = GeoIP_database_edition(gi);
|
||||
if (version_flag == 1) {
|
||||
db_info = GeoIP_database_info(gi);
|
||||
printf("%s: %s\n",GeoIPDBDescription[i],db_info == NULL ? "": db_info );
|
||||
free(db_info);
|
||||
} else {
|
||||
geoiplookup(gi,hostname,i);
|
||||
}
|
||||
}
|
||||
GeoIP_delete(gi);
|
||||
} else {
|
||||
/* iterate through different database types */
|
||||
for (i = 0; i < NUM_DB_TYPES; ++i) {
|
||||
if (GeoIP_db_avail(i)) {
|
||||
gi = GeoIP_open_type(i, GEOIP_STANDARD);
|
||||
if (NULL == gi) {
|
||||
printf("%s not available, skipping...\n", GeoIPDBDescription[i]);
|
||||
} else {
|
||||
if (version_flag == 1) {
|
||||
db_info = GeoIP_database_info(gi);
|
||||
printf("%s: %s\n",GeoIPDBDescription[i], db_info == NULL ? "" : db_info );
|
||||
free(db_info);
|
||||
} else {
|
||||
geoiplookup(gi,hostname,i);
|
||||
}
|
||||
}
|
||||
GeoIP_delete(gi);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char * _mk_NA( const char * p ){
|
||||
return p ? p : "N/A";
|
||||
}
|
||||
|
||||
static void _mk_conf_str( unsigned char val , char * to, int size){
|
||||
if ( ( val & 0x7f ) == 0x7f ){
|
||||
snprintf(to, 5, "N/A");
|
||||
return;
|
||||
}
|
||||
snprintf(to, 5, "%d", val);
|
||||
return;
|
||||
}
|
||||
|
||||
static unsigned long
|
||||
__addr_to_num(const char *addr)
|
||||
{
|
||||
unsigned int c, octet, t;
|
||||
unsigned long ipnum;
|
||||
int i = 3;
|
||||
|
||||
octet = ipnum = 0;
|
||||
while ((c = *addr++)) {
|
||||
if (c == '.') {
|
||||
if (octet > 255)
|
||||
return 0;
|
||||
ipnum <<= 8;
|
||||
ipnum += octet;
|
||||
i--;
|
||||
octet = 0;
|
||||
} else {
|
||||
t = octet;
|
||||
octet <<= 3;
|
||||
octet += t;
|
||||
octet += t;
|
||||
c -= '0';
|
||||
if (c > 9)
|
||||
return 0;
|
||||
octet += c;
|
||||
}
|
||||
}
|
||||
if ((octet > 255) || (i != 0))
|
||||
return 0;
|
||||
ipnum <<= 8;
|
||||
return ipnum + octet;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ptr must be a memory area with at least 16 bytes */
|
||||
static char *__num_to_addr_r (unsigned long ipnum, char * ptr) {
|
||||
char *cur_str;
|
||||
int octet[4];
|
||||
int num_chars_written, i;
|
||||
|
||||
cur_str = ptr;
|
||||
|
||||
for (i = 0; i<4; i++) {
|
||||
octet[3 - i] = ipnum % 256;
|
||||
ipnum >>= 8;
|
||||
}
|
||||
|
||||
for (i = 0; i<4; i++) {
|
||||
num_chars_written = sprintf(cur_str, "%d", octet[i]);
|
||||
cur_str += num_chars_written;
|
||||
|
||||
if (i < 3) {
|
||||
cur_str[0] = '.';
|
||||
cur_str++;
|
||||
}
|
||||
}
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void _say_range_by_ip(GeoIP * gi, uint32_t ipnum ) {
|
||||
unsigned long last_nm, mask, low, hi;
|
||||
char ipaddr[16];
|
||||
char tmp[16];
|
||||
char ** range;
|
||||
|
||||
if ( info_flag == 0 )
|
||||
return; /* noop unless extra information is requested */
|
||||
|
||||
range = GeoIP_range_by_ip( gi, __num_to_addr_r( ipnum, ipaddr ) );
|
||||
if ( range == NULL )
|
||||
return;
|
||||
|
||||
printf ( " ipaddr: %s\n", ipaddr );
|
||||
|
||||
printf( " range_by_ip: %s - %s\n", range[0], range[1] );
|
||||
last_nm = GeoIP_last_netmask(gi);
|
||||
mask = 0xffffffff << ( 32 - last_nm );
|
||||
low = ipnum & mask;
|
||||
hi = low + ( 0xffffffff & ~mask );
|
||||
printf( " network: %s - %s ::%ld\n",
|
||||
__num_to_addr_r( low, ipaddr ),
|
||||
__num_to_addr_r( hi, tmp ),
|
||||
last_nm
|
||||
);
|
||||
printf( " ipnum: %u\n", ipnum );
|
||||
printf( " range_by_num: %lu - %lu\n", __addr_to_num(range[0]), __addr_to_num(range[1]) );
|
||||
printf( " network num: %lu - %lu ::%lu\n", low, hi, last_nm );
|
||||
|
||||
GeoIP_range_by_ip_delete(range);
|
||||
}
|
||||
|
||||
void
|
||||
geoiplookup(GeoIP * gi, char *hostname, int i)
|
||||
{
|
||||
const char *country_code;
|
||||
const char *country_name;
|
||||
const char *domain_name;
|
||||
const char *asnum_name;
|
||||
int netspeed;
|
||||
int country_id;
|
||||
GeoIPRegion *region;
|
||||
GeoIPRecord *gir;
|
||||
const char *org;
|
||||
uint32_t ipnum;
|
||||
|
||||
ipnum = _GeoIP_lookupaddress(hostname);
|
||||
if (ipnum == 0) {
|
||||
printf("%s: can't resolve hostname ( %s )\n", GeoIPDBDescription[i], hostname);
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
if (GEOIP_DOMAIN_EDITION == i) {
|
||||
domain_name = GeoIP_name_by_ipnum(gi, ipnum);
|
||||
if (domain_name == NULL) {
|
||||
printf("%s: IP Address not found\n", GeoIPDBDescription[i]);
|
||||
}
|
||||
else {
|
||||
printf("%s: %s\n", GeoIPDBDescription[i], domain_name);
|
||||
_say_range_by_ip(gi, ipnum);
|
||||
}
|
||||
}
|
||||
else if (GEOIP_LOCATIONA_EDITION == i || GEOIP_ACCURACYRADIUS_EDITION == i || GEOIP_ASNUM_EDITION == i || GEOIP_USERTYPE_EDITION == i || GEOIP_REGISTRAR_EDITION == i || GEOIP_NETSPEED_EDITION_REV1 == i ) {
|
||||
asnum_name = GeoIP_name_by_ipnum(gi, ipnum);
|
||||
if (asnum_name == NULL) {
|
||||
printf("%s: IP Address not found\n", GeoIPDBDescription[i]);
|
||||
}
|
||||
else {
|
||||
printf("%s: %s\n", GeoIPDBDescription[i], asnum_name);
|
||||
_say_range_by_ip(gi, ipnum);
|
||||
}
|
||||
}
|
||||
else if (GEOIP_COUNTRY_EDITION == i) {
|
||||
country_id = GeoIP_id_by_ipnum(gi, ipnum);
|
||||
country_code = GeoIP_country_code[country_id];
|
||||
country_name = GeoIP_country_name[country_id];
|
||||
if (country_id == 0) {
|
||||
printf("%s: IP Address not found\n", GeoIPDBDescription[i]);
|
||||
}
|
||||
else {
|
||||
printf("%s: %s, %s\n", GeoIPDBDescription[i], country_code, country_name);
|
||||
_say_range_by_ip(gi, ipnum);
|
||||
}
|
||||
}
|
||||
else if (GEOIP_REGION_EDITION_REV0 == i || GEOIP_REGION_EDITION_REV1 == i) {
|
||||
region = GeoIP_region_by_ipnum(gi, ipnum);
|
||||
if (NULL == region || region->country_code[0] == '\0' ) {
|
||||
printf("%s: IP Address not found\n", GeoIPDBDescription[i]);
|
||||
}
|
||||
else {
|
||||
printf("%s: %s, %s\n", GeoIPDBDescription[i], region->country_code, region->region);
|
||||
_say_range_by_ip(gi, ipnum);
|
||||
GeoIPRegion_delete(region);
|
||||
}
|
||||
}
|
||||
else if (GEOIP_CITY_EDITION_REV0 == i) {
|
||||
gir = GeoIP_record_by_ipnum(gi, ipnum);
|
||||
if (NULL == gir) {
|
||||
printf("%s: IP Address not found\n", GeoIPDBDescription[i]);
|
||||
}
|
||||
else {
|
||||
printf("%s: %s, %s, %s, %s, %f, %f\n", GeoIPDBDescription[i], gir->country_code, _mk_NA(gir->region),
|
||||
_mk_NA(gir->city), _mk_NA(gir->postal_code), gir->latitude, gir->longitude);
|
||||
_say_range_by_ip(gi, ipnum);
|
||||
GeoIPRecord_delete(gir);
|
||||
}
|
||||
}
|
||||
else if (GEOIP_CITY_EDITION_REV1 == i) {
|
||||
gir = GeoIP_record_by_ipnum(gi, ipnum);
|
||||
if (NULL == gir) {
|
||||
printf("%s: IP Address not found\n", GeoIPDBDescription[i]);
|
||||
}
|
||||
else {
|
||||
printf("%s: %s, %s, %s, %s, %f, %f, %d, %d\n", GeoIPDBDescription[i], gir->country_code, _mk_NA(gir->region), _mk_NA(gir->city), _mk_NA(gir->postal_code),
|
||||
gir->latitude, gir->longitude, gir->metro_code, gir->area_code);
|
||||
_say_range_by_ip(gi, ipnum);
|
||||
GeoIPRecord_delete(gir);
|
||||
}
|
||||
}
|
||||
else if (GEOIP_CITYCONFIDENCE_EDITION == i) {
|
||||
gir = GeoIP_record_by_ipnum(gi, ipnum);
|
||||
if (NULL == gir) {
|
||||
printf("%s: IP Address not found\n", GeoIPDBDescription[i]);
|
||||
}
|
||||
else {
|
||||
char country_str[5], region_str[5], city_str[5], postal_str[5];
|
||||
_mk_conf_str(gir->country_conf, country_str, 5);
|
||||
_mk_conf_str(gir->region_conf, region_str, 5);
|
||||
_mk_conf_str(gir->city_conf, city_str, 5);
|
||||
_mk_conf_str(gir->postal_conf, postal_str, 5);
|
||||
|
||||
printf("%s: %s, %s, %s, %s, %f, %f, %d, %d, %s, %s, %s, %s\n", GeoIPDBDescription[i], gir->country_code, _mk_NA(gir->region), _mk_NA(gir->city), _mk_NA(gir->postal_code),
|
||||
gir->latitude, gir->longitude, gir->metro_code, gir->area_code,
|
||||
country_str, region_str, city_str, postal_str
|
||||
);
|
||||
_say_range_by_ip(gi, ipnum);
|
||||
GeoIPRecord_delete(gir);
|
||||
}
|
||||
}
|
||||
else if (GEOIP_CITYCONFIDENCEDIST_EDITION == i) {
|
||||
gir = GeoIP_record_by_ipnum(gi, ipnum);
|
||||
if (NULL == gir) {
|
||||
printf("%s: IP Address not found\n", GeoIPDBDescription[i]);
|
||||
}
|
||||
else {
|
||||
char country_str[5], region_str[5], city_str[5], postal_str[5], accuracy_radius_str[5];
|
||||
_mk_conf_str(gir->country_conf, country_str, 5);
|
||||
_mk_conf_str(gir->region_conf, region_str, 5);
|
||||
_mk_conf_str(gir->city_conf, city_str, 5);
|
||||
_mk_conf_str(gir->postal_conf, postal_str, 5);
|
||||
if (gir->accuracy_radius != 1023){
|
||||
sprintf(accuracy_radius_str, "%d", gir->accuracy_radius );
|
||||
} else {
|
||||
strcpy(accuracy_radius_str,"N/A");}
|
||||
|
||||
printf("%s: %s, %s, %s, %s, %f, %f, %d, %d, %s, %s, %s, %s, %s\n", GeoIPDBDescription[i], gir->country_code, _mk_NA(gir->region), _mk_NA(gir->city), _mk_NA(gir->postal_code),
|
||||
gir->latitude, gir->longitude, gir->metro_code, gir->area_code,
|
||||
country_str, region_str, city_str, postal_str, accuracy_radius_str
|
||||
);
|
||||
_say_range_by_ip(gi, ipnum);
|
||||
GeoIPRecord_delete(gir);
|
||||
}
|
||||
}
|
||||
else if (GEOIP_ORG_EDITION == i || GEOIP_ISP_EDITION == i) {
|
||||
org = GeoIP_org_by_ipnum(gi, ipnum);
|
||||
if (org == NULL) {
|
||||
printf("%s: IP Address not found\n", GeoIPDBDescription[i]);
|
||||
}
|
||||
else {
|
||||
printf("%s: %s\n", GeoIPDBDescription[i], org);
|
||||
_say_range_by_ip(gi, ipnum);
|
||||
}
|
||||
}
|
||||
else if (GEOIP_NETSPEED_EDITION == i) {
|
||||
netspeed = GeoIP_id_by_ipnum(gi, ipnum);
|
||||
if (netspeed == GEOIP_UNKNOWN_SPEED) {
|
||||
printf("%s: Unknown\n", GeoIPDBDescription[i]);
|
||||
}
|
||||
else if (netspeed == GEOIP_DIALUP_SPEED) {
|
||||
printf("%s: Dialup\n", GeoIPDBDescription[i]);
|
||||
}
|
||||
else if (netspeed == GEOIP_CABLEDSL_SPEED) {
|
||||
printf("%s: Cable/DSL\n", GeoIPDBDescription[i]);
|
||||
}
|
||||
else if (netspeed == GEOIP_CORPORATE_SPEED) {
|
||||
printf("%s: Corporate\n", GeoIPDBDescription[i]);
|
||||
}
|
||||
_say_range_by_ip(gi, ipnum);
|
||||
}
|
||||
else {
|
||||
|
||||
/*
|
||||
* Silent ignore IPv6 databases. Otherwise we get annoying
|
||||
* messages whenever we have a mixed environment IPv4 and
|
||||
* IPv6
|
||||
*/
|
||||
|
||||
/*
|
||||
* printf("Can not handle database type -- try geoiplookup6\n");
|
||||
*/
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,255 +0,0 @@
|
|||
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
|
||||
/* geoiplookup.c
|
||||
*
|
||||
* Copyright (C) 2006 MaxMind LLC
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <GeoIP.h>
|
||||
#include <GeoIPCity.h>
|
||||
#include <GeoIP_internal.h>
|
||||
void geoiplookup(GeoIP* gi,char *hostname,int i);
|
||||
|
||||
void usage() {
|
||||
fprintf(stderr,"Usage: geoiplookup [-d custom_dir] [-f custom_file] [-v] <ipaddress|hostname>\n");
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[]) {
|
||||
char * hostname = NULL;
|
||||
char * db_info;
|
||||
GeoIP * gi;
|
||||
int i;
|
||||
char *custom_directory = NULL;
|
||||
char *custom_file = NULL;
|
||||
int version_flag = 0;
|
||||
|
||||
if (argc < 2) {
|
||||
usage();
|
||||
exit(1);
|
||||
}
|
||||
i = 1;
|
||||
while (i < argc) {
|
||||
if (strcmp(argv[i],"-v") == 0) {
|
||||
version_flag = 1;
|
||||
} else if (strcmp(argv[i],"-f") == 0) {
|
||||
if ((i+1) < argc){
|
||||
i++;
|
||||
custom_file = argv[i];
|
||||
}
|
||||
} else if (strcmp(argv[i],"-d") == 0) {
|
||||
if ((i+1) < argc){
|
||||
i++;
|
||||
custom_directory = argv[i];
|
||||
}
|
||||
} else {
|
||||
hostname = argv[i];
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (hostname == NULL) {
|
||||
usage();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (custom_directory != NULL) {
|
||||
GeoIP_setup_custom_directory(custom_directory);
|
||||
}
|
||||
_GeoIP_setup_dbfilename();
|
||||
|
||||
if (custom_file != NULL) {
|
||||
gi = GeoIP_open(custom_file, GEOIP_STANDARD);
|
||||
if (NULL == gi) {
|
||||
printf("%s not available, skipping...\n", custom_file);
|
||||
} else {
|
||||
i = GeoIP_database_edition(gi);
|
||||
if (version_flag == 1) {
|
||||
db_info = GeoIP_database_info(gi);
|
||||
printf("%s: %s\n",GeoIPDBDescription[i],db_info == NULL ? "": db_info );
|
||||
free(db_info);
|
||||
} else {
|
||||
geoiplookup(gi,hostname,i);
|
||||
}
|
||||
}
|
||||
GeoIP_delete(gi);
|
||||
} else {
|
||||
/* iterate through different database types */
|
||||
for (i = 0; i < NUM_DB_TYPES; ++i) {
|
||||
if (GeoIP_db_avail(i)) {
|
||||
gi = GeoIP_open_type(i, GEOIP_STANDARD);
|
||||
if (NULL == gi) {
|
||||
printf("%s not available, skipping...\n", GeoIPDBDescription[i]);
|
||||
} else {
|
||||
if (version_flag == 1) {
|
||||
db_info = GeoIP_database_info(gi);
|
||||
printf("%s: %s\n",GeoIPDBDescription[i],db_info);
|
||||
free(db_info);
|
||||
} else {
|
||||
geoiplookup(gi,hostname,i);
|
||||
}
|
||||
}
|
||||
GeoIP_delete(gi);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char * _mk_NA( const char * p ){
|
||||
return p ? p : "N/A";
|
||||
}
|
||||
|
||||
void
|
||||
geoiplookup(GeoIP * gi, char *hostname, int i)
|
||||
{
|
||||
const char *country_code;
|
||||
const char *country_name;
|
||||
const char *domain_name;
|
||||
const char *asnum_name;
|
||||
int netspeed;
|
||||
int country_id;
|
||||
GeoIPRegion *region;
|
||||
GeoIPRecord *gir;
|
||||
const char *org;
|
||||
|
||||
geoipv6_t ipnum;
|
||||
ipnum = _GeoIP_lookupaddress_v6(hostname);
|
||||
if (__GEOIP_V6_IS_NULL(ipnum)) {
|
||||
printf("%s: can't resolve hostname ( %s )\n", GeoIPDBDescription[i], hostname);
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
|
||||
#if 0
|
||||
if (GEOIP_DOMAIN_EDITION_V6 == i) {
|
||||
domain_name = GeoIP_name_by_name_v6(gi, hostname);
|
||||
if (domain_name == NULL) {
|
||||
printf("%s: IP Address not found\n", GeoIPDBDescription[i]);
|
||||
}
|
||||
else {
|
||||
printf("%s: %s\n", GeoIPDBDescription[i], domain_name);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
if (GEOIP_LOCATIONA_EDITION_V6 == i || GEOIP_ASNUM_EDITION_V6 == i || GEOIP_USERTYPE_EDITION_V6 == i || GEOIP_REGISTRAR_EDITION_V6 == i || GEOIP_DOMAIN_EDITION_V6 == i || GEOIP_ORG_EDITION_V6 == i || GEOIP_ISP_EDITION_V6 == i || GEOIP_NETSPEED_EDITION_REV1_V6 == i ) {
|
||||
asnum_name = GeoIP_name_by_ipnum_v6(gi, ipnum);
|
||||
if (asnum_name == NULL) {
|
||||
printf("%s: IP Address not found\n", GeoIPDBDescription[i]);
|
||||
}
|
||||
else {
|
||||
printf("%s: %s\n", GeoIPDBDescription[i], asnum_name);
|
||||
// _say_range_by_ip(gi, ipnum);
|
||||
}
|
||||
}
|
||||
|
||||
else if (GEOIP_CITY_EDITION_REV0_V6 == i) {
|
||||
gir = GeoIP_record_by_name_v6(gi, hostname);
|
||||
if (NULL == gir) {
|
||||
printf("%s: IP Address not found\n", GeoIPDBDescription[i]);
|
||||
}
|
||||
else {
|
||||
printf("%s: %s, %s, %s, %s, %f, %f\n", GeoIPDBDescription[i], gir->country_code, _mk_NA(gir->region),
|
||||
_mk_NA(gir->city), _mk_NA(gir->postal_code), gir->latitude, gir->longitude);
|
||||
}
|
||||
}
|
||||
else if (GEOIP_CITY_EDITION_REV1_V6 == i) {
|
||||
gir = GeoIP_record_by_name_v6(gi, hostname);
|
||||
if (NULL == gir) {
|
||||
printf("%s: IP Address not found\n", GeoIPDBDescription[i]);
|
||||
}
|
||||
else {
|
||||
printf("%s: %s, %s, %s, %s, %f, %f, %d, %d\n", GeoIPDBDescription[i], gir->country_code, _mk_NA(gir->region), _mk_NA(gir->city), _mk_NA(gir->postal_code),
|
||||
gir->latitude, gir->longitude, gir->metro_code, gir->area_code);
|
||||
}
|
||||
}
|
||||
|
||||
else if (GEOIP_COUNTRY_EDITION_V6 == i) {
|
||||
|
||||
country_id = GeoIP_id_by_ipnum_v6(gi, ipnum);
|
||||
country_code = GeoIP_country_code[country_id];
|
||||
country_name = GeoIP_country_name[country_id];
|
||||
if (country_id == 0) {
|
||||
printf("%s: IP Address not found\n", GeoIPDBDescription[i]);
|
||||
}
|
||||
else {
|
||||
printf("%s: %s, %s\n", GeoIPDBDescription[i], country_code, country_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
else
|
||||
if (GEOIP_REGION_EDITION_REV0 == i || GEOIP_REGION_EDITION_REV1 == i) {
|
||||
region = GeoIP_region_by_name_v6(gi, hostname);
|
||||
if (NULL == region) {
|
||||
printf("%s: IP Address not found\n", GeoIPDBDescription[i]);
|
||||
}
|
||||
else {
|
||||
printf("%s: %s, %s\n", GeoIPDBDescription[i], region->country_code, region->region);
|
||||
}
|
||||
}
|
||||
else if (GEOIP_CITY_EDITION_REV0 == i) {
|
||||
gir = GeoIP_record_by_name(gi, hostname);
|
||||
if (NULL == gir) {
|
||||
printf("%s: IP Address not found\n", GeoIPDBDescription[i]);
|
||||
}
|
||||
else {
|
||||
printf("%s: %s, %s, %s, %s, %f, %f\n", GeoIPDBDescription[i], gir->country_code, gir->region,
|
||||
gir->city, gir->postal_code, gir->latitude, gir->longitude);
|
||||
}
|
||||
}
|
||||
else if (GEOIP_CITY_EDITION_REV1 == i) {
|
||||
gir = GeoIP_record_by_name(gi, hostname);
|
||||
if (NULL == gir) {
|
||||
printf("%s: IP Address not found\n", GeoIPDBDescription[i]);
|
||||
}
|
||||
else {
|
||||
printf("%s: %s, %s, %s, %s, %f, %f, %d, %d\n", GeoIPDBDescription[i], gir->country_code, gir->region, gir->city, gir->postal_code,
|
||||
gir->latitude, gir->longitude, gir->metro_code, gir->area_code);
|
||||
}
|
||||
}
|
||||
else if (GEOIP_ORG_EDITION == i || GEOIP_ISP_EDITION == i) {
|
||||
org = GeoIP_org_by_name_v6(gi, hostname);
|
||||
if (org == NULL) {
|
||||
printf("%s: IP Address not found\n", GeoIPDBDescription[i]);
|
||||
}
|
||||
else {
|
||||
printf("%s: %s\n", GeoIPDBDescription[i], org);
|
||||
}
|
||||
}
|
||||
else if (GEOIP_NETSPEED_EDITION == i) {
|
||||
netspeed = GeoIP_id_by_name_v6(gi, hostname);
|
||||
if (netspeed == GEOIP_UNKNOWN_SPEED) {
|
||||
printf("%s: Unknown\n", GeoIPDBDescription[i]);
|
||||
}
|
||||
else if (netspeed == GEOIP_DIALUP_SPEED) {
|
||||
printf("%s: Dialup\n", GeoIPDBDescription[i]);
|
||||
}
|
||||
else if (netspeed == GEOIP_CABLEDSL_SPEED) {
|
||||
printf("%s: Cable/DSL\n", GeoIPDBDescription[i]);
|
||||
}
|
||||
else if (netspeed == GEOIP_CORPORATE_SPEED) {
|
||||
printf("%s: Corporate\n", GeoIPDBDescription[i]);
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
|
@ -1,260 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
=pod
|
||||
|
||||
/*
|
||||
*
|
||||
* Copyright (C) 2008 MaxMind LLC
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
=cut
|
||||
|
||||
=pod
|
||||
|
||||
pure perl version of geoipupdate. can handle anything, that
|
||||
|
||||
GeoIP_update_database
|
||||
GeoIP_update_database_general
|
||||
|
||||
handle. It is a drop in replacement for geoipupdate, as opposide to geoipupdate is the
|
||||
pp version able to handle proxy requests even with authentication and can be used with
|
||||
https
|
||||
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
our $VERSION = '0.07';
|
||||
|
||||
use 5.008;
|
||||
use Data::Dumper;
|
||||
use Digest::MD5;
|
||||
use File::Spec;
|
||||
use File::Basename;
|
||||
use Getopt::Std;
|
||||
use HTTP::Request::Common;
|
||||
use LWP::UserAgent;
|
||||
use PerlIO::gzip;
|
||||
use URI;
|
||||
|
||||
my $ua = LWP::UserAgent->new( agent => "pp_geoipupdate/$VERSION" );
|
||||
$ua->env_proxy;
|
||||
|
||||
## --- for auth proxies use
|
||||
## $ua->proxy(['http', 'ftp'] => 'http://username:password@proxy.myorg.com');
|
||||
|
||||
my $license_file = 'GeoIP.conf';
|
||||
my $update_host = 'updates.maxmind.com';
|
||||
my $proto = 'http';
|
||||
my %opts;
|
||||
|
||||
if ( !getopts( 'hvf:d:', \%opts ) or $opts{h} ) {
|
||||
print STDERR
|
||||
"Usage: geoipupdate [-hv] [-f license_file] [-d custom directory]\n";
|
||||
exit @ARGV ? 1 : 0;
|
||||
}
|
||||
|
||||
my $rootdir = File::Spec->rootdir;
|
||||
$opts{d} ||= File::Spec->catfile( $rootdir, qw/ usr local share GeoIP / );
|
||||
$opts{f} ||=
|
||||
File::Spec->catfile( $rootdir, qw/ usr local etc /, $license_file );
|
||||
|
||||
die "dir $opts{d} does not exist or is not readable or is not a directory\n"
|
||||
unless -d $opts{d};
|
||||
die "license_file $opts{f} does not exist, is not readable or is not a file\n"
|
||||
unless -f $opts{f};
|
||||
|
||||
#
|
||||
# --- parse license file
|
||||
#
|
||||
open my $fh, '<', $opts{f}
|
||||
or die "Error opening GeoIP Configuration file $opts{f}\n";
|
||||
print "Opened License file $opts{f}\n" if $opts{v};
|
||||
|
||||
my ( $user_id, $license_key, @product_ids );
|
||||
{
|
||||
local $_;
|
||||
|
||||
while (<$fh>) {
|
||||
next if /^\s*#/; # skip comments
|
||||
/^\s*UserId\s+(\d+)/ and $user_id = $1, next;
|
||||
/^\s*LicenseKey\s+(\S{12})/ and $license_key = $1, next;
|
||||
/^\s*ProductIds\s+(\d+(?:[a-zA-Z]{2,3})?(?:\s+\d+(?:[a-zA-Z]{2,3})?)*)/
|
||||
and @product_ids = split( /\s+/, $1 ), next;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ( $opts{v} ) {
|
||||
print "User id $user_id\n" if $user_id;
|
||||
print "Read in license key $license_key\n";
|
||||
print "Product ids @product_ids\n";
|
||||
}
|
||||
|
||||
if ($user_id) {
|
||||
for my $product_id (@product_ids) {
|
||||
|
||||
# update the databases using the user id string,
|
||||
# the license key string and the product id for each database
|
||||
eval {
|
||||
GeoIP_update_database_general( $user_id, $license_key,
|
||||
$product_id, $opts{v} );
|
||||
};
|
||||
my $err = $@;
|
||||
die $err if $err and $err !~ /^No new updates available/i;
|
||||
print $err;
|
||||
}
|
||||
} else {
|
||||
|
||||
# Old format with just license key for MaxMind GeoIP Country database updates
|
||||
# here for backwards compatibility
|
||||
eval { GeoIP_update_database( $license_key, $opts{v} ); };
|
||||
my $err = $@;
|
||||
die $err if $err and $err !~ /^No new updates available/i;
|
||||
print $err;
|
||||
}
|
||||
|
||||
exit 0;
|
||||
|
||||
sub GeoIP_update_database_general {
|
||||
my ( $user_id, $license_key, $product_id, $verbose, $client_ipaddr ) = @_;
|
||||
my $u = URI->new("$proto://$update_host/app/update_getfilename");
|
||||
$u->query_form( product_id => $product_id );
|
||||
|
||||
print 'Send request ' . $u->as_string, "\n" if ($verbose);
|
||||
my $res = $ua->request( GET $u->as_string, Host => $update_host );
|
||||
die $res->status_line unless ( $res->is_success );
|
||||
# make sure to use only the filename for security reason
|
||||
my $geoip_filename = File::Spec->catfile( $opts{d}, basename($res->content) );
|
||||
|
||||
# /* get MD5 of current GeoIP database file */
|
||||
my $old_md5 = _get_hexdigest($geoip_filename);
|
||||
|
||||
print "MD5 sum of database $geoip_filename is $old_md5\n" if $verbose;
|
||||
|
||||
unless ($client_ipaddr) {
|
||||
print 'Send request ' . $u->as_string, "\n" if ($verbose);
|
||||
|
||||
# /* get client ip address from MaxMind web page */
|
||||
$res = $ua->request( GET "$proto://$update_host/app/update_getipaddr",
|
||||
Host => $update_host );
|
||||
die $res->status_line unless ( $res->is_success );
|
||||
$client_ipaddr = $res->content;
|
||||
}
|
||||
|
||||
print "client ip address: $client_ipaddr\n" if $verbose;
|
||||
my $hex_digest2 =
|
||||
Digest::MD5->new->add( $license_key, $client_ipaddr )->hexdigest;
|
||||
print "md5sum of ip address and license key is $hex_digest2\n" if $verbose;
|
||||
|
||||
my $mk_db_req_cref = sub {
|
||||
|
||||
$u->path('/app/update_secure');
|
||||
$u->query_form(
|
||||
db_md5 => shift,
|
||||
challenge_md5 => $hex_digest2,
|
||||
user_id => $user_id,
|
||||
edition_id => $product_id
|
||||
);
|
||||
print 'Send request ' . $u->as_string, "\n" if ($verbose);
|
||||
return $ua->request( GET $u->as_string, Host => $update_host );
|
||||
};
|
||||
$res = $mk_db_req_cref->($old_md5);
|
||||
die $res->status_line unless ( $res->is_success );
|
||||
|
||||
# print Dumper($res);
|
||||
print "Downloading gzipped GeoIP Database...\n" if $verbose;
|
||||
|
||||
_gunzip_and_replace(
|
||||
$res->content,
|
||||
$geoip_filename,
|
||||
sub {
|
||||
|
||||
# as sanity check request a update for the new downloaded file
|
||||
# md5 of the new unpacked file
|
||||
my $new_md5 = _get_hexdigest(shift);
|
||||
return $mk_db_req_cref->($new_md5);
|
||||
}
|
||||
);
|
||||
print "Done\n" if $verbose;
|
||||
}
|
||||
|
||||
sub GeoIP_update_database {
|
||||
my ( $license_key, $verbose ) = @_;
|
||||
my $geoip_filename = File::Spec->catfile( $opts{d}, 'GeoIP.dat' );
|
||||
|
||||
# /* get MD5 of current GeoIP database file */
|
||||
my $hexdigest = _get_hexdigest($geoip_filename);
|
||||
|
||||
print "MD5 sum of database $geoip_filename is $hexdigest\n" if $verbose;
|
||||
|
||||
my $u = URI->new("$proto://$update_host/app/update");
|
||||
$u->query_form( license_key => $license_key, md5 => $hexdigest );
|
||||
|
||||
print 'Send request ' . $u->as_string, "\n" if ($verbose);
|
||||
my $res = $ua->request( GET $u->as_string, Host => $update_host );
|
||||
die $res->status_line unless ( $res->is_success );
|
||||
print "Downloading gzipped GeoIP Database...\n" if $verbose;
|
||||
_gunzip_and_replace( $res->content, $geoip_filename );
|
||||
print "Done\n" if $verbose;
|
||||
|
||||
}
|
||||
|
||||
# --- hexdigest of the file or 00000000000000000000000000000000
|
||||
sub _get_hexdigest {
|
||||
my $md5 = '0' x 32;
|
||||
if ( open my $fh, '<:raw', shift ) {
|
||||
$md5 = Digest::MD5->new->addfile($fh)->hexdigest;
|
||||
}
|
||||
return $md5;
|
||||
}
|
||||
|
||||
sub _gunzip_and_replace {
|
||||
my ( $content, $geoip_filename, $sanity_check_c ) = @_;
|
||||
my $max_retry = 1;
|
||||
|
||||
my $tmp_fname = $geoip_filename . '.test';
|
||||
|
||||
{
|
||||
|
||||
# --- error if our content does not start with the gzip header
|
||||
die $content || 'Not a gzip file' if substr( $content, 0, 2 ) ne "\x1f\x8b";
|
||||
|
||||
# --- uncompress the gzip data
|
||||
{
|
||||
local $_;
|
||||
open my $gin, '<:gzip', \$content or die $!;
|
||||
open my $gout, '>:raw', $tmp_fname or die $!;
|
||||
print {$gout} $_ while (<$gin>);
|
||||
}
|
||||
|
||||
# --- sanity check
|
||||
if ( defined $sanity_check_c ) {
|
||||
die "Download failed" if $max_retry-- <= 0;
|
||||
my $res = $sanity_check_c->($tmp_fname);
|
||||
die $res->status_line unless ( $res->is_success );
|
||||
$content = $res->content;
|
||||
|
||||
redo if ( $content !~ /^No new updates available/ );
|
||||
}
|
||||
}
|
||||
|
||||
# --- install GeoIP.dat.test -> GeoIP.dat
|
||||
rename( $tmp_fname, $geoip_filename ) or die $!;
|
||||
}
|
||||
|
||||
|
|
@ -1,283 +0,0 @@
|
|||
/* geoipupdate.c
|
||||
*
|
||||
* Copyright (C) 2006 MaxMind LLC
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "GeoIP.h"
|
||||
#include "GeoIPUpdate.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef __linux__
|
||||
#include <getopt.h>
|
||||
#endif
|
||||
#include <ctype.h>
|
||||
|
||||
#define PRODUCT_ID_TOKEN "ProductIds"
|
||||
#define USER_ID_TOKEN "UserId"
|
||||
#define LICENSE_KEY_TOKEN "LicenseKey"
|
||||
#define LICENSE_KEY_LENGTH 12
|
||||
|
||||
const char *GeoIPConfFile = "GeoIP.conf";
|
||||
|
||||
void usage() {
|
||||
fprintf(stderr,"Usage: geoipupdate [-hv] [-f license_file] [-d custom directory]\n");
|
||||
}
|
||||
|
||||
void my_printf(char * str) {
|
||||
printf("%s", str);
|
||||
}
|
||||
|
||||
void print_status (int err, char * license_file) {
|
||||
if (err == GEOIP_NO_NEW_UPDATES) {
|
||||
fprintf(stdout,"GeoIP Database up to date\n");
|
||||
} else if (err == GEOIP_LICENSE_KEY_INVALID_ERR) {
|
||||
fprintf(stderr,"Invalid License Key in %s - Please visit http://www.maxmind.com/app/products for a subscription\n",license_file);
|
||||
} else if (err == GEOIP_USER_ID_INVALID_ERR){
|
||||
fprintf(stderr,"Invalid UserID\n");
|
||||
} else if (err == GEOIP_PRODUCT_ID_INVALID_ERR){
|
||||
fprintf(stderr,"Invalid product ID or subscription expired\n");
|
||||
} else if (err < 0) {
|
||||
fprintf(stderr,"Received Error %d (%s) when attempting to update GeoIP Database\n",err, GeoIP_get_error_message(err));
|
||||
} else {
|
||||
fprintf(stdout,"Updated database\n");
|
||||
}
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[]) {
|
||||
int verbose = 0;
|
||||
char * license_file = NULL;
|
||||
FILE * license_fh;
|
||||
int n = 40;
|
||||
int line_index = 0;
|
||||
unsigned char *lineptr = malloc(sizeof(char) * n);
|
||||
char *a_license_key_str, *a_ptr;
|
||||
char *the_license_key_str = "";
|
||||
char * the_reference_empty_license_key_str = the_license_key_str;
|
||||
char *a_user_id_str = NULL;
|
||||
/* the string that holds the user id */
|
||||
char *the_user_id_str = NULL;
|
||||
/* the integer that holds the length of the string the_user_id_str */
|
||||
int the_user_id_strl = 0;
|
||||
/* the integer that holds the alloc length of the string the_user_id_str */
|
||||
int the_user_id_stral = 0;
|
||||
char *a_product_id_str = NULL;
|
||||
char **the_product_id_str = NULL;
|
||||
int *the_product_id_strl = NULL;
|
||||
int *the_product_id_stral = NULL;
|
||||
int num_product_ids = 0;
|
||||
char * client_ipaddr = NULL;
|
||||
char * custom_directory = NULL;
|
||||
int c;
|
||||
int err = 0;
|
||||
int i;
|
||||
|
||||
opterr = 0;
|
||||
|
||||
while ((c = getopt (argc, argv, "hvf:d:")) != -1)
|
||||
switch (c) {
|
||||
case 'h':
|
||||
usage();
|
||||
exit(0);
|
||||
case 'v':
|
||||
verbose = 1;
|
||||
break;
|
||||
case 'f':
|
||||
license_file = optarg;
|
||||
break;
|
||||
case 'd':
|
||||
custom_directory = optarg;
|
||||
break;
|
||||
case '?':
|
||||
if (isprint (optopt))
|
||||
fprintf (stderr, "Unknown option `-%c'.\n", optopt);
|
||||
else
|
||||
fprintf (stderr,
|
||||
"Unknown option character `\\x%x'.\n",
|
||||
optopt);
|
||||
usage();
|
||||
exit(1);
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
|
||||
if (custom_directory != NULL) {
|
||||
GeoIP_setup_custom_directory(custom_directory);
|
||||
}
|
||||
if (license_file == NULL) {
|
||||
license_file = malloc(sizeof(char) * (strlen(SYSCONFDIR)+strlen(GeoIPConfFile)+2));
|
||||
license_file[0] = '\0';
|
||||
strcat(license_file, SYSCONFDIR);
|
||||
strcat(license_file, "/");
|
||||
strcat(license_file, GeoIPConfFile);
|
||||
}
|
||||
|
||||
license_fh = fopen(license_file,"r");
|
||||
if (license_fh == NULL) {
|
||||
fprintf(stderr,"Error opening GeoIP Configuration file %s\n",license_file);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (verbose == 1)
|
||||
printf("Opened License file %s\n", license_file);
|
||||
|
||||
do {
|
||||
c = fgetc(license_fh);
|
||||
if (line_index >= n) {
|
||||
n += 20;
|
||||
lineptr = realloc(lineptr, n);
|
||||
}
|
||||
if (c == 10 || c == EOF) {
|
||||
lineptr[line_index++] = '\0';
|
||||
line_index = 0;
|
||||
if (lineptr[0] == '#')
|
||||
continue;
|
||||
/* get the product ids from the config file */
|
||||
a_product_id_str = strstr((char *)lineptr, PRODUCT_ID_TOKEN);//search for a product id token in the line
|
||||
if (a_product_id_str != NULL) {
|
||||
a_ptr = a_product_id_str;
|
||||
/* set pos at the end of product id token */
|
||||
a_ptr += strlen(PRODUCT_ID_TOKEN) + 1;
|
||||
while (a_ptr[0] == ' ') {
|
||||
/* skip spaces */
|
||||
a_ptr++;
|
||||
}
|
||||
/* alloc the array of product ids */
|
||||
the_product_id_str = (char **) malloc((num_product_ids+1) * sizeof(char*)); /* array of strings */
|
||||
the_product_id_strl = (int *) malloc((num_product_ids+1) * sizeof(char*)); /* array of string lengths */
|
||||
the_product_id_stral = (int *) malloc((num_product_ids+1) * sizeof(char*)); /* array of string alloc lengths */
|
||||
while (a_ptr[0] != '\0') {
|
||||
/* add new product id to the array of product ids */
|
||||
the_product_id_str[num_product_ids] = (char *) malloc(20); /* the string */
|
||||
the_product_id_strl[num_product_ids] = 0; /* the length of the string */
|
||||
the_product_id_stral[num_product_ids] = 20; /* the alloc length of the string */
|
||||
while ((a_ptr[0] != ' ') & (a_ptr[0] != '\0')) {
|
||||
if (the_product_id_strl[num_product_ids] >= the_product_id_stral[num_product_ids]) {
|
||||
/* if the length of the string is equal or more than
|
||||
* alloc length of the string then realloc the string and
|
||||
* increase the alloc length by 20 */
|
||||
the_product_id_stral[num_product_ids] = the_product_id_stral[num_product_ids] + 20;
|
||||
the_product_id_str[num_product_ids] = (char *) realloc(the_product_id_str[num_product_ids],the_product_id_stral[num_product_ids]+4);
|
||||
}
|
||||
/* read the product id from the line in the config file */
|
||||
the_product_id_str[num_product_ids][the_product_id_strl[num_product_ids]] = a_ptr[0];
|
||||
the_product_id_strl[num_product_ids]++;
|
||||
a_ptr++;
|
||||
}
|
||||
the_product_id_str[num_product_ids][the_product_id_strl[num_product_ids]] = 0;
|
||||
while ((a_ptr[0] == ' ') & (a_ptr[0] != '\0')) {
|
||||
a_ptr++;//skip spaces
|
||||
}
|
||||
/* new product id add, realloc the arrays */
|
||||
num_product_ids = num_product_ids + 1;
|
||||
/* array of string */
|
||||
the_product_id_str = (char **) realloc(the_product_id_str,(num_product_ids+1) * sizeof(char*));
|
||||
/* array of string lengths */
|
||||
the_product_id_strl = (int *) realloc(the_product_id_strl,(num_product_ids+1) * sizeof(char*));
|
||||
/* array of string alloc lengths */
|
||||
the_product_id_stral = (int *) realloc(the_product_id_stral,(num_product_ids+1) * sizeof(char*));
|
||||
}
|
||||
}
|
||||
|
||||
/* get the user id from the config file */
|
||||
a_user_id_str = strstr((char *)lineptr, USER_ID_TOKEN); /* search for a user id token in the line */
|
||||
if (a_user_id_str != NULL) {
|
||||
a_ptr = a_user_id_str;
|
||||
/* set the position at the end of user id token */
|
||||
a_ptr += strlen(USER_ID_TOKEN) + 1;
|
||||
while (a_ptr[0] == ' ') {
|
||||
/* skip spaces */
|
||||
a_ptr++;
|
||||
}
|
||||
/* get the string that has the user id */
|
||||
the_user_id_stral = 20;
|
||||
the_user_id_str = (char *)malloc(the_user_id_stral);
|
||||
/* loop while the chars are numbers */
|
||||
while ((a_ptr[0] >= '0') & (a_ptr[0] <= '9')) {
|
||||
the_user_id_str[the_user_id_strl++] = a_ptr[0];
|
||||
a_ptr++;
|
||||
if (the_user_id_strl >= the_user_id_stral) {
|
||||
/* if the length of user id string is greater or equal to
|
||||
* the alloc length of user id string then
|
||||
* add 20 to the alloc length and realloc the user id string */
|
||||
the_user_id_stral += 20;
|
||||
the_user_id_str = realloc(the_user_id_str,the_user_id_stral);
|
||||
}
|
||||
}
|
||||
the_user_id_str[the_user_id_strl] = 0; /* add NUL char */
|
||||
}
|
||||
a_license_key_str = strstr((char *)lineptr, LICENSE_KEY_TOKEN);
|
||||
if (a_license_key_str != NULL) {
|
||||
a_ptr = a_license_key_str;
|
||||
a_ptr += strlen(LICENSE_KEY_TOKEN) + 1;
|
||||
while (a_ptr[0] == ' ') {
|
||||
a_ptr++;
|
||||
}
|
||||
the_license_key_str = malloc(sizeof(char) * (LICENSE_KEY_LENGTH + 1));
|
||||
strncpy(the_license_key_str, a_ptr, LICENSE_KEY_LENGTH);
|
||||
the_license_key_str[LICENSE_KEY_LENGTH] = '\0';
|
||||
}
|
||||
} else {
|
||||
lineptr[line_index++] = c;
|
||||
}
|
||||
} while (c != EOF);
|
||||
|
||||
free(lineptr);
|
||||
|
||||
fclose(license_fh);
|
||||
|
||||
if (verbose == 1) {
|
||||
printf("Read in license key %s\n", the_license_key_str);
|
||||
printf("number of product ids %d \n",num_product_ids);
|
||||
}
|
||||
|
||||
if (the_user_id_str != NULL) {
|
||||
/* update the databases using the user id string, the license key string and the product id for each database */
|
||||
client_ipaddr = NULL;
|
||||
for (i = 0; i < num_product_ids; i++) {
|
||||
err = GeoIP_update_database_general(the_user_id_str, the_license_key_str, the_product_id_str[i], verbose,&client_ipaddr, &my_printf);
|
||||
print_status(err, license_file);
|
||||
}
|
||||
} else {
|
||||
/* Old format with just license key for MaxMind GeoIP Country database updates
|
||||
* here for backwards compatibility */
|
||||
err = GeoIP_update_database(the_license_key_str, verbose, &my_printf);
|
||||
print_status(err, license_file);
|
||||
}
|
||||
|
||||
if (the_product_id_str != NULL) {
|
||||
/* free the product ids */
|
||||
for (i = 0; i < num_product_ids; i++ ) {
|
||||
free(the_product_id_str[i]);
|
||||
}
|
||||
free(the_product_id_str);
|
||||
free(the_product_id_strl);
|
||||
free(the_product_id_stral);
|
||||
}
|
||||
|
||||
if ( the_reference_empty_license_key_str != the_license_key_str )
|
||||
free(the_license_key_str);
|
||||
|
||||
if (the_user_id_str)
|
||||
free(the_user_id_str);
|
||||
|
||||
if (client_ipaddr) {
|
||||
free(client_ipaddr);
|
||||
}
|
||||
exit(err);
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
#! /bin/sh
|
||||
|
||||
# disable dependency trackeing for OS X with multiply arch option's
|
||||
# automake -i --gnu --add-missing
|
||||
|
||||
aclocal \
|
||||
&& automake -i --gnu --add-missing \
|
||||
&& autoconf
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
# If you purchase a subscription to the GeoIP database,
|
||||
# then you will obtain a license key which you can
|
||||
# use to automatically obtain updates.
|
||||
# for more details, please go to
|
||||
# http://www.maxmind.com/app/products
|
||||
|
||||
# see https://www.maxmind.com/app/license_key_login to obtain License Key,
|
||||
# UserId, and available ProductIds
|
||||
|
||||
# Enter your license key here
|
||||
LicenseKey YOUR_LICENSE_KEY_HERE
|
||||
|
||||
# Enter your User ID here
|
||||
UserId YOUR_USER_ID_HERE
|
||||
|
||||
# Enter the Product ID(s) of the database(s) you would like to update
|
||||
# By default 106 (MaxMind GeoIP Country) is listed below
|
||||
ProductIds 106
|
||||
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
dist_sysconf_DATA = GeoIP.conf.default
|
||||
|
||||
DEFAULT_CONFIG_FILE = $(sysconfdir)/GeoIP.conf
|
||||
|
||||
install-exec-hook:
|
||||
@if test -f "$(DESTDIR)$(DEFAULT_CONFIG_FILE)" ; then \
|
||||
echo "$@ will not overwrite existing $(DESTDIR)$(DEFAULT_CONFIG_FILE)" ; \
|
||||
else \
|
||||
echo "$(INSTALL_DATA) GeoIP.conf.default $(DESTDIR)$(DEFAULT_CONFIG_FILE)"; \
|
||||
$(INSTALL_DATA) "$(srcdir)/GeoIP.conf.default" "$(DESTDIR)$(DEFAULT_CONFIG_FILE)"; \
|
||||
fi
|
||||
|
||||
uninstall-hook:
|
||||
@if test -f "$(DESTDIR)$(DEFAULT_CONFIG_FILE)" ; then \
|
||||
rm "$(DESTDIR)$(DEFAULT_CONFIG_FILE)"; \
|
||||
fi
|
||||
|
|
@ -1,414 +0,0 @@
|
|||
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
|
||||
# Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = conf
|
||||
DIST_COMMON = $(dist_sysconf_DATA) $(srcdir)/Makefile.am \
|
||||
$(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.in
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
*) f=$$p;; \
|
||||
esac;
|
||||
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
|
||||
am__install_max = 40
|
||||
am__nobase_strip_setup = \
|
||||
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
|
||||
am__nobase_strip = \
|
||||
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
|
||||
am__nobase_list = $(am__nobase_strip_setup); \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
|
||||
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
|
||||
if (++n[$$2] == $(am__install_max)) \
|
||||
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
|
||||
END { for (dir in files) print dir, files[dir] }'
|
||||
am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
am__installdirs = "$(DESTDIR)$(sysconfdir)"
|
||||
DATA = $(dist_sysconf_DATA)
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GEOIP_VERSION_INFO = @GEOIP_VERSION_INFO@
|
||||
GREP = @GREP@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
lt_ECHO = @lt_ECHO@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
dist_sysconf_DATA = GeoIP.conf.default
|
||||
DEFAULT_CONFIG_FILE = $(sysconfdir)/GeoIP.conf
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu conf/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu conf/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
install-dist_sysconfDATA: $(dist_sysconf_DATA)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(sysconfdir)" || $(MKDIR_P) "$(DESTDIR)$(sysconfdir)"
|
||||
@list='$(dist_sysconf_DATA)'; test -n "$(sysconfdir)" || list=; \
|
||||
for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; \
|
||||
done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(sysconfdir)'"; \
|
||||
$(INSTALL_DATA) $$files "$(DESTDIR)$(sysconfdir)" || exit $$?; \
|
||||
done
|
||||
|
||||
uninstall-dist_sysconfDATA:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(dist_sysconf_DATA)'; test -n "$(sysconfdir)" || list=; \
|
||||
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
|
||||
test -n "$$files" || exit 0; \
|
||||
echo " ( cd '$(DESTDIR)$(sysconfdir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(sysconfdir)" && rm -f $$files
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
ctags: CTAGS
|
||||
CTAGS:
|
||||
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(DATA)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(sysconfdir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am: install-dist_sysconfDATA
|
||||
@$(NORMAL_INSTALL)
|
||||
$(MAKE) $(AM_MAKEFLAGS) install-exec-hook
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-dist_sysconfDATA
|
||||
@$(NORMAL_INSTALL)
|
||||
$(MAKE) $(AM_MAKEFLAGS) uninstall-hook
|
||||
.MAKE: install-am install-exec-am install-strip uninstall-am
|
||||
|
||||
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
|
||||
distclean distclean-generic distclean-libtool distdir dvi \
|
||||
dvi-am html html-am info info-am install install-am \
|
||||
install-data install-data-am install-dist_sysconfDATA \
|
||||
install-dvi install-dvi-am install-exec install-exec-am \
|
||||
install-exec-hook install-html install-html-am install-info \
|
||||
install-info-am install-man install-pdf install-pdf-am \
|
||||
install-ps install-ps-am install-strip installcheck \
|
||||
installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-generic \
|
||||
mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
|
||||
uninstall-dist_sysconfDATA uninstall-hook
|
||||
|
||||
|
||||
install-exec-hook:
|
||||
@if test -f "$(DESTDIR)$(DEFAULT_CONFIG_FILE)" ; then \
|
||||
echo "$@ will not overwrite existing $(DESTDIR)$(DEFAULT_CONFIG_FILE)" ; \
|
||||
else \
|
||||
echo "$(INSTALL_DATA) GeoIP.conf.default $(DESTDIR)$(DEFAULT_CONFIG_FILE)"; \
|
||||
$(INSTALL_DATA) "$(srcdir)/GeoIP.conf.default" "$(DESTDIR)$(DEFAULT_CONFIG_FILE)"; \
|
||||
fi
|
||||
|
||||
uninstall-hook:
|
||||
@if test -f "$(DESTDIR)$(DEFAULT_CONFIG_FILE)" ; then \
|
||||
rm "$(DESTDIR)$(DEFAULT_CONFIG_FILE)"; \
|
||||
fi
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -1,50 +0,0 @@
|
|||
dnl AM_CONFIG_HEADER(config.h)
|
||||
|
||||
AC_INIT([GeoIP], [1.4.8],[support@maxmind.com],[GeoIP])
|
||||
AC_GNU_SOURCE
|
||||
AM_INIT_AUTOMAKE
|
||||
AC_CONFIG_SRCDIR([libGeoIP/GeoIP.c])
|
||||
GEOIP_VERSION_INFO=`echo $VERSION | awk -F. '{ printf "%d:%d:%d", $1+$2, $3, $2 }'`
|
||||
AC_SUBST(GEOIP_VERSION_INFO)
|
||||
|
||||
AC_PROG_CC
|
||||
AC_PROG_LIBTOOL
|
||||
|
||||
AC_CHECK_TYPE(byte,[AC_DEFINE(HAVE_BYTE_TYPEDEF)],[])
|
||||
AC_CHECK_TYPE(ushort,[AC_DEFINE(HAVE_USHORT_TYPEDEF)],[])
|
||||
AC_CHECK_TYPE(ulong,[AC_DEFINE(HAVE_ULONG_TYPEDEF)],[])
|
||||
AC_CHECK_TYPE(u16,[AC_DEFINE(HAVE_U16_TYPEDEF)],[])
|
||||
AC_CHECK_TYPE(u32,[AC_DEFINE(HAVE_U32_TYPEDEF)],[])
|
||||
|
||||
AC_C_BIGENDIAN([AC_DEFINE(BIG_ENDIAN_HOST,1)],[AC_DEFINE(LITTLE_ENDIAN_HOST,1)])
|
||||
|
||||
AC_CHECK_HEADERS(stdint.h)
|
||||
AC_CHECK_HEADERS(zlib.h, , AC_MSG_ERROR(Zlib header (zlib.h) not found. Tor requires zlib to build. You may need to install a zlib development package.))
|
||||
|
||||
AC_CHECK_FUNC(gettimeofday, AC_DEFINE(HAVE_GETTIMEOFDAY))
|
||||
AC_CHECK_FUNC(vasprintf, AC_DEFINE(HAVE_VASPRINTF))
|
||||
AC_CHECK_FUNC(vsnprintf, AC_DEFINE(HAVE_VSNPRINTF))
|
||||
AC_CHECK_FUNC(vsprintf, AC_DEFINE(HAVE_VSPRINTF))
|
||||
|
||||
AC_CHECK_FUNC(gethostbyname, AC_DEFINE(HAVE_GETHOSTBYNAME),
|
||||
AC_CHECK_LIB(nsl, gethostbyname, AC_DEFINE(HAVE_GETHOSTBYNAME)
|
||||
LIBS="${LIBS} -lsocket -lnsl"))
|
||||
|
||||
AC_CHECK_FUNC(gethostbyname_r, [
|
||||
AC_DEFINE(HAVE_GETHOSTBYNAME_R)
|
||||
# We look for the one that returns `int'.
|
||||
# Hopefully this check is robust enough.
|
||||
AC_EGREP_HEADER(int.*gethostbyname_r, netdb.h, [
|
||||
AC_DEFINE(GETHOSTBYNAME_R_RETURNS_INT)])
|
||||
])
|
||||
|
||||
AC_OUTPUT([
|
||||
Makefile
|
||||
GeoIP.spec
|
||||
libGeoIP/Makefile
|
||||
apps/Makefile
|
||||
conf/Makefile
|
||||
data/Makefile
|
||||
man/Makefile
|
||||
test/Makefile
|
||||
])
|
||||
Binary file not shown.
|
|
@ -1,19 +0,0 @@
|
|||
pkgdata_DATA =
|
||||
|
||||
dist_pkgdata_DATA = GeoIP.dat
|
||||
|
||||
DEFAULT_DB_FILE = $(pkgdatadir)/GeoIP.dat
|
||||
|
||||
install-data-hook:
|
||||
@if test -f "$(DESTDIR)$(DEFAULT_DB_FILE)" ; then \
|
||||
echo "$@ will not overwrite existing $(DESTDIR)$(DEFAULT_DB_FILE)" ; \
|
||||
else \
|
||||
echo "$(INSTALL_DATA) GeoIP.dat $(DESTDIR)$(DEFAULT_DB_FILE)"; \
|
||||
$(INSTALL_DATA) "$(srcdir)/GeoIP.dat" "$(DESTDIR)$(DEFAULT_DB_FILE)"; \
|
||||
fi
|
||||
|
||||
uninstall-hook:
|
||||
@if test -f "$(DESTDIR)$(DEFAULT_DB_FILE)" ; then \
|
||||
rm "$(DESTDIR)$(DEFAULT_DB_FILE)"; \
|
||||
$(INSTALL_DATA) GeoIP.dat $(DESTDIR)$(DEFAULT_DB_FILE); \
|
||||
fi
|
||||
|
|
@ -1,437 +0,0 @@
|
|||
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
|
||||
# Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = data
|
||||
DIST_COMMON = $(dist_pkgdata_DATA) $(srcdir)/Makefile.am \
|
||||
$(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.in
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
*) f=$$p;; \
|
||||
esac;
|
||||
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
|
||||
am__install_max = 40
|
||||
am__nobase_strip_setup = \
|
||||
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
|
||||
am__nobase_strip = \
|
||||
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
|
||||
am__nobase_list = $(am__nobase_strip_setup); \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
|
||||
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
|
||||
if (++n[$$2] == $(am__install_max)) \
|
||||
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
|
||||
END { for (dir in files) print dir, files[dir] }'
|
||||
am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
am__installdirs = "$(DESTDIR)$(pkgdatadir)" "$(DESTDIR)$(pkgdatadir)"
|
||||
DATA = $(dist_pkgdata_DATA) $(pkgdata_DATA)
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GEOIP_VERSION_INFO = @GEOIP_VERSION_INFO@
|
||||
GREP = @GREP@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
lt_ECHO = @lt_ECHO@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
pkgdata_DATA =
|
||||
dist_pkgdata_DATA = GeoIP.dat
|
||||
DEFAULT_DB_FILE = $(pkgdatadir)/GeoIP.dat
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu data/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu data/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
install-dist_pkgdataDATA: $(dist_pkgdata_DATA)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(pkgdatadir)" || $(MKDIR_P) "$(DESTDIR)$(pkgdatadir)"
|
||||
@list='$(dist_pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \
|
||||
for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; \
|
||||
done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgdatadir)'"; \
|
||||
$(INSTALL_DATA) $$files "$(DESTDIR)$(pkgdatadir)" || exit $$?; \
|
||||
done
|
||||
|
||||
uninstall-dist_pkgdataDATA:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(dist_pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \
|
||||
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
|
||||
test -n "$$files" || exit 0; \
|
||||
echo " ( cd '$(DESTDIR)$(pkgdatadir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(pkgdatadir)" && rm -f $$files
|
||||
install-pkgdataDATA: $(pkgdata_DATA)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(pkgdatadir)" || $(MKDIR_P) "$(DESTDIR)$(pkgdatadir)"
|
||||
@list='$(pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \
|
||||
for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; \
|
||||
done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgdatadir)'"; \
|
||||
$(INSTALL_DATA) $$files "$(DESTDIR)$(pkgdatadir)" || exit $$?; \
|
||||
done
|
||||
|
||||
uninstall-pkgdataDATA:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \
|
||||
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
|
||||
test -n "$$files" || exit 0; \
|
||||
echo " ( cd '$(DESTDIR)$(pkgdatadir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(pkgdatadir)" && rm -f $$files
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
ctags: CTAGS
|
||||
CTAGS:
|
||||
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(DATA)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(pkgdatadir)" "$(DESTDIR)$(pkgdatadir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am: install-dist_pkgdataDATA install-pkgdataDATA
|
||||
@$(NORMAL_INSTALL)
|
||||
$(MAKE) $(AM_MAKEFLAGS) install-data-hook
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-dist_pkgdataDATA uninstall-pkgdataDATA
|
||||
@$(NORMAL_INSTALL)
|
||||
$(MAKE) $(AM_MAKEFLAGS) uninstall-hook
|
||||
.MAKE: install-am install-data-am install-strip uninstall-am
|
||||
|
||||
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
|
||||
distclean distclean-generic distclean-libtool distdir dvi \
|
||||
dvi-am html html-am info info-am install install-am \
|
||||
install-data install-data-am install-data-hook \
|
||||
install-dist_pkgdataDATA install-dvi install-dvi-am \
|
||||
install-exec install-exec-am install-html install-html-am \
|
||||
install-info install-info-am install-man install-pdf \
|
||||
install-pdf-am install-pkgdataDATA install-ps install-ps-am \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
maintainer-clean maintainer-clean-generic mostlyclean \
|
||||
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
||||
uninstall uninstall-am uninstall-dist_pkgdataDATA \
|
||||
uninstall-hook uninstall-pkgdataDATA
|
||||
|
||||
|
||||
install-data-hook:
|
||||
@if test -f "$(DESTDIR)$(DEFAULT_DB_FILE)" ; then \
|
||||
echo "$@ will not overwrite existing $(DESTDIR)$(DEFAULT_DB_FILE)" ; \
|
||||
else \
|
||||
echo "$(INSTALL_DATA) GeoIP.dat $(DESTDIR)$(DEFAULT_DB_FILE)"; \
|
||||
$(INSTALL_DATA) "$(srcdir)/GeoIP.dat" "$(DESTDIR)$(DEFAULT_DB_FILE)"; \
|
||||
fi
|
||||
|
||||
uninstall-hook:
|
||||
@if test -f "$(DESTDIR)$(DEFAULT_DB_FILE)" ; then \
|
||||
rm "$(DESTDIR)$(DEFAULT_DB_FILE)"; \
|
||||
$(INSTALL_DATA) GeoIP.dat $(DESTDIR)$(DEFAULT_DB_FILE); \
|
||||
fi
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
|
|
@ -1,630 +0,0 @@
|
|||
#! /bin/sh
|
||||
# depcomp - compile a program generating dependencies as side-effects
|
||||
|
||||
scriptversion=2009-04-28.21; # UTC
|
||||
|
||||
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free
|
||||
# Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Run PROGRAMS ARGS to compile a file, generating dependencies
|
||||
as side-effects.
|
||||
|
||||
Environment variables:
|
||||
depmode Dependency tracking mode.
|
||||
source Source file read by `PROGRAMS ARGS'.
|
||||
object Object file output by `PROGRAMS ARGS'.
|
||||
DEPDIR directory where to store dependencies.
|
||||
depfile Dependency file to output.
|
||||
tmpdepfile Temporary file to use when outputing dependencies.
|
||||
libtool Whether libtool is used (yes/no).
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "depcomp $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
||||
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
|
||||
depfile=${depfile-`echo "$object" |
|
||||
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
|
||||
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
||||
|
||||
rm -f "$tmpdepfile"
|
||||
|
||||
# Some modes work just like other modes, but use different flags. We
|
||||
# parameterize here, but still list the modes in the big case below,
|
||||
# to make depend.m4 easier to write. Note that we *cannot* use a case
|
||||
# here, because this file can only contain one case statement.
|
||||
if test "$depmode" = hp; then
|
||||
# HP compiler uses -M and no extra arg.
|
||||
gccflag=-M
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
if test "$depmode" = dashXmstdout; then
|
||||
# This is just like dashmstdout with a different argument.
|
||||
dashmflag=-xM
|
||||
depmode=dashmstdout
|
||||
fi
|
||||
|
||||
cygpath_u="cygpath -u -f -"
|
||||
if test "$depmode" = msvcmsys; then
|
||||
# This is just like msvisualcpp but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u="sed s,\\\\\\\\,/,g"
|
||||
depmode=msvisualcpp
|
||||
fi
|
||||
|
||||
case "$depmode" in
|
||||
gcc3)
|
||||
## gcc 3 implements dependency tracking that does exactly what
|
||||
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
|
||||
## it if -MD -MP comes after the -MF stuff. Hmm.
|
||||
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
|
||||
## the command line argument order; so add the flags where they
|
||||
## appear in depend2.am. Note that the slowdown incurred here
|
||||
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
|
||||
*) set fnord "$@" "$arg" ;;
|
||||
esac
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
done
|
||||
"$@"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
mv "$tmpdepfile" "$depfile"
|
||||
;;
|
||||
|
||||
gcc)
|
||||
## There are various ways to get dependency output from gcc. Here's
|
||||
## why we pick this rather obscure method:
|
||||
## - Don't want to use -MD because we'd like the dependencies to end
|
||||
## up in a subdir. Having to rename by hand is ugly.
|
||||
## (We might end up doing this anyway to support other compilers.)
|
||||
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
|
||||
## -MM, not -M (despite what the docs say).
|
||||
## - Using -M directly means running the compiler twice (even worse
|
||||
## than renaming).
|
||||
if test -z "$gccflag"; then
|
||||
gccflag=-MD,
|
||||
fi
|
||||
"$@" -Wp,"$gccflag$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
|
||||
## The second -e expression handles DOS-style file names with drive letters.
|
||||
sed -e 's/^[^:]*: / /' \
|
||||
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
|
||||
## This next piece of magic avoids the `deleted header file' problem.
|
||||
## The problem is that when a header file which appears in a .P file
|
||||
## is deleted, the dependency causes make to die (because there is
|
||||
## typically no way to rebuild the header). We avoid this by adding
|
||||
## dummy dependencies for each header file. Too bad gcc doesn't do
|
||||
## this for us directly.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" |
|
||||
## Some versions of gcc put a space before the `:'. On the theory
|
||||
## that the space means something, we add a space to the output as
|
||||
## well.
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
sgi)
|
||||
if test "$libtool" = yes; then
|
||||
"$@" "-Wp,-MDupdate,$tmpdepfile"
|
||||
else
|
||||
"$@" -MDupdate "$tmpdepfile"
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
|
||||
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
|
||||
echo "$object : \\" > "$depfile"
|
||||
|
||||
# Clip off the initial element (the dependent). Don't try to be
|
||||
# clever and replace this with sed code, as IRIX sed won't handle
|
||||
# lines with more than a fixed number of characters (4096 in
|
||||
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
|
||||
# the IRIX cc adds comments like `#:fec' to the end of the
|
||||
# dependency line.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
|
||||
tr '
|
||||
' ' ' >> "$depfile"
|
||||
echo >> "$depfile"
|
||||
|
||||
# The second pass generates a dummy entry for each header file.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
||||
>> "$depfile"
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
aix)
|
||||
# The C for AIX Compiler uses -M and outputs the dependencies
|
||||
# in a .u file. In older versions, this file always lives in the
|
||||
# current directory. Also, the AIX compiler puts `$object:' at the
|
||||
# start of each line; $object doesn't have directory information.
|
||||
# Version 6 uses the directory in both cases.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$base.u
|
||||
tmpdepfile3=$dir.libs/$base.u
|
||||
"$@" -Wc,-M
|
||||
else
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$dir$base.u
|
||||
tmpdepfile3=$dir$base.u
|
||||
"$@" -M
|
||||
fi
|
||||
stat=$?
|
||||
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
# Each line is of the form `foo.o: dependent.h'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||
# That's a tab and a space in the [].
|
||||
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
icc)
|
||||
# Intel's C compiler understands `-MD -MF file'. However on
|
||||
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
|
||||
# ICC 7.0 will fill foo.d with something like
|
||||
# foo.o: sub/foo.c
|
||||
# foo.o: sub/foo.h
|
||||
# which is wrong. We want:
|
||||
# sub/foo.o: sub/foo.c
|
||||
# sub/foo.o: sub/foo.h
|
||||
# sub/foo.c:
|
||||
# sub/foo.h:
|
||||
# ICC 7.1 will output
|
||||
# foo.o: sub/foo.c sub/foo.h
|
||||
# and will wrap long lines using \ :
|
||||
# foo.o: sub/foo.c ... \
|
||||
# sub/foo.h ... \
|
||||
# ...
|
||||
|
||||
"$@" -MD -MF "$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each line is of the form `foo.o: dependent.h',
|
||||
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
|
||||
sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp2)
|
||||
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
|
||||
# compilers, which have integrated preprocessors. The correct option
|
||||
# to use with these is +Maked; it writes dependencies to a file named
|
||||
# 'foo.d', which lands next to the object file, wherever that
|
||||
# happens to be.
|
||||
# Much of this is similar to the tru64 case; see comments there.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir.libs/$base.d
|
||||
"$@" -Wc,+Maked
|
||||
else
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
"$@" +Maked
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
|
||||
# Add `dependent.h:' lines.
|
||||
sed -ne '2,${
|
||||
s/^ *//
|
||||
s/ \\*$//
|
||||
s/$/:/
|
||||
p
|
||||
}' "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile" "$tmpdepfile2"
|
||||
;;
|
||||
|
||||
tru64)
|
||||
# The Tru64 compiler uses -MD to generate dependencies as a side
|
||||
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
|
||||
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||
# dependencies in `foo.d' instead, so we check for that too.
|
||||
# Subdirectories are respected.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
|
||||
if test "$libtool" = yes; then
|
||||
# With Tru64 cc, shared objects can also be used to make a
|
||||
# static library. This mechanism is used in libtool 1.4 series to
|
||||
# handle both shared and static libraries in a single compilation.
|
||||
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
|
||||
#
|
||||
# With libtool 1.5 this exception was removed, and libtool now
|
||||
# generates 2 separate objects for the 2 libraries. These two
|
||||
# compilations output dependencies in $dir.libs/$base.o.d and
|
||||
# in $dir$base.o.d. We have to check for both files, because
|
||||
# one of the two compilations can be disabled. We should prefer
|
||||
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
|
||||
# automatically cleaned when .libs/ is deleted, while ignoring
|
||||
# the former would cause a distcleancheck panic.
|
||||
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
|
||||
tmpdepfile2=$dir$base.o.d # libtool 1.5
|
||||
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
|
||||
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
|
||||
"$@" -Wc,-MD
|
||||
else
|
||||
tmpdepfile1=$dir$base.o.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
tmpdepfile3=$dir$base.d
|
||||
tmpdepfile4=$dir$base.d
|
||||
"$@" -MD
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||
# That's a tab and a space in the [].
|
||||
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
#nosideeffect)
|
||||
# This comment above is used by automake to tell side-effect
|
||||
# dependency tracking mechanisms from slower ones.
|
||||
|
||||
dashmstdout)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout, regardless of -o.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove `-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
test -z "$dashmflag" && dashmflag=-M
|
||||
# Require at least two characters before searching for `:'
|
||||
# in the target name. This is to cope with DOS-style filenames:
|
||||
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
|
||||
"$@" $dashmflag |
|
||||
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
dashXmstdout)
|
||||
# This case only exists to satisfy depend.m4. It is never actually
|
||||
# run, as this mode is specially recognized in the preamble.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
makedepend)
|
||||
"$@" || exit $?
|
||||
# Remove any Libtool call
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
# X makedepend
|
||||
shift
|
||||
cleared=no eat=no
|
||||
for arg
|
||||
do
|
||||
case $cleared in
|
||||
no)
|
||||
set ""; shift
|
||||
cleared=yes ;;
|
||||
esac
|
||||
if test $eat = yes; then
|
||||
eat=no
|
||||
continue
|
||||
fi
|
||||
case "$arg" in
|
||||
-D*|-I*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
# Strip any option that makedepend may not understand. Remove
|
||||
# the object too, otherwise makedepend will parse it as a source file.
|
||||
-arch)
|
||||
eat=yes ;;
|
||||
-*|$object)
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
esac
|
||||
done
|
||||
obj_suffix=`echo "$object" | sed 's/^.*\././'`
|
||||
touch "$tmpdepfile"
|
||||
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
sed '1,2d' "$tmpdepfile" | tr ' ' '
|
||||
' | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile" "$tmpdepfile".bak
|
||||
;;
|
||||
|
||||
cpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove `-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
"$@" -E |
|
||||
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
|
||||
sed '$ s: \\$::' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
cat < "$tmpdepfile" >> "$depfile"
|
||||
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvisualcpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case "$arg" in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
||||
set fnord "$@"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
"$@" -E 2>/dev/null |
|
||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
|
||||
echo " " >> "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvcmsys)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
none)
|
||||
exec "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown depmode $depmode" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.0 KiB |
|
|
@ -1,14 +0,0 @@
|
|||
# fetch version number from input file and write them to STDOUT
|
||||
BEGIN {
|
||||
while ((getline < ARGV[1]) > 0) {
|
||||
if (match ($0, /^VERSION=/)) {
|
||||
split($1, t, "=");
|
||||
my_ver_str = t[2];
|
||||
split(my_ver_str, v, ".");
|
||||
gsub("[^0-9].*$", "", v[3]);
|
||||
my_ver = v[1] "," v[2] "," v[3];
|
||||
}
|
||||
}
|
||||
print "GEOIP_VERSION = " my_ver "";
|
||||
print "GEOIP_VERSION_STR = " my_ver_str "";
|
||||
}
|
||||
|
|
@ -1,520 +0,0 @@
|
|||
#!/bin/sh
|
||||
# install - install a program, script, or datafile
|
||||
|
||||
scriptversion=2009-04-28.21; # UTC
|
||||
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
# following copyright and license.
|
||||
#
|
||||
# Copyright (C) 1994 X Consortium
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the X Consortium shall not
|
||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
# ings in this Software without prior written authorization from the X Consor-
|
||||
# tium.
|
||||
#
|
||||
#
|
||||
# FSF changes to this file are in the public domain.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch.
|
||||
|
||||
nl='
|
||||
'
|
||||
IFS=" "" $nl"
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit=${DOITPROG-}
|
||||
if test -z "$doit"; then
|
||||
doit_exec=exec
|
||||
else
|
||||
doit_exec=$doit
|
||||
fi
|
||||
|
||||
# Put in absolute file names if you don't have them in your path;
|
||||
# or use environment vars.
|
||||
|
||||
chgrpprog=${CHGRPPROG-chgrp}
|
||||
chmodprog=${CHMODPROG-chmod}
|
||||
chownprog=${CHOWNPROG-chown}
|
||||
cmpprog=${CMPPROG-cmp}
|
||||
cpprog=${CPPROG-cp}
|
||||
mkdirprog=${MKDIRPROG-mkdir}
|
||||
mvprog=${MVPROG-mv}
|
||||
rmprog=${RMPROG-rm}
|
||||
stripprog=${STRIPPROG-strip}
|
||||
|
||||
posix_glob='?'
|
||||
initialize_posix_glob='
|
||||
test "$posix_glob" != "?" || {
|
||||
if (set -f) 2>/dev/null; then
|
||||
posix_glob=
|
||||
else
|
||||
posix_glob=:
|
||||
fi
|
||||
}
|
||||
'
|
||||
|
||||
posix_mkdir=
|
||||
|
||||
# Desired mode of installed file.
|
||||
mode=0755
|
||||
|
||||
chgrpcmd=
|
||||
chmodcmd=$chmodprog
|
||||
chowncmd=
|
||||
mvcmd=$mvprog
|
||||
rmcmd="$rmprog -f"
|
||||
stripcmd=
|
||||
|
||||
src=
|
||||
dst=
|
||||
dir_arg=
|
||||
dst_arg=
|
||||
|
||||
copy_on_change=false
|
||||
no_target_directory=
|
||||
|
||||
usage="\
|
||||
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
||||
or: $0 [OPTION]... -d DIRECTORIES...
|
||||
|
||||
In the 1st form, copy SRCFILE to DSTFILE.
|
||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
||||
In the 4th, create DIRECTORIES.
|
||||
|
||||
Options:
|
||||
--help display this help and exit.
|
||||
--version display version info and exit.
|
||||
|
||||
-c (ignored)
|
||||
-C install only if different (preserve the last data modification time)
|
||||
-d create directories instead of installing files.
|
||||
-g GROUP $chgrpprog installed files to GROUP.
|
||||
-m MODE $chmodprog installed files to MODE.
|
||||
-o USER $chownprog installed files to USER.
|
||||
-s $stripprog installed files.
|
||||
-t DIRECTORY install into DIRECTORY.
|
||||
-T report an error if DSTFILE is a directory.
|
||||
|
||||
Environment variables override the default commands:
|
||||
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
|
||||
RMPROG STRIPPROG
|
||||
"
|
||||
|
||||
while test $# -ne 0; do
|
||||
case $1 in
|
||||
-c) ;;
|
||||
|
||||
-C) copy_on_change=true;;
|
||||
|
||||
-d) dir_arg=true;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift;;
|
||||
|
||||
--help) echo "$usage"; exit $?;;
|
||||
|
||||
-m) mode=$2
|
||||
case $mode in
|
||||
*' '* | *' '* | *'
|
||||
'* | *'*'* | *'?'* | *'['*)
|
||||
echo "$0: invalid mode: $mode" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift;;
|
||||
|
||||
-s) stripcmd=$stripprog;;
|
||||
|
||||
-t) dst_arg=$2
|
||||
shift;;
|
||||
|
||||
-T) no_target_directory=true;;
|
||||
|
||||
--version) echo "$0 $scriptversion"; exit $?;;
|
||||
|
||||
--) shift
|
||||
break;;
|
||||
|
||||
-*) echo "$0: invalid option: $1" >&2
|
||||
exit 1;;
|
||||
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
|
||||
# When -d is used, all remaining arguments are directories to create.
|
||||
# When -t is used, the destination is already specified.
|
||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
||||
for arg
|
||||
do
|
||||
if test -n "$dst_arg"; then
|
||||
# $@ is not empty: it contains at least $arg.
|
||||
set fnord "$@" "$dst_arg"
|
||||
shift # fnord
|
||||
fi
|
||||
shift # arg
|
||||
dst_arg=$arg
|
||||
done
|
||||
fi
|
||||
|
||||
if test $# -eq 0; then
|
||||
if test -z "$dir_arg"; then
|
||||
echo "$0: no input file specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
# It's OK to call `install-sh -d' without argument.
|
||||
# This can happen when creating conditional directories.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
trap '(exit $?); exit' 1 2 13 15
|
||||
|
||||
# Set umask so as not to create temps with too-generous modes.
|
||||
# However, 'strip' requires both read and write access to temps.
|
||||
case $mode in
|
||||
# Optimize common cases.
|
||||
*644) cp_umask=133;;
|
||||
*755) cp_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw='% 200'
|
||||
fi
|
||||
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
|
||||
*)
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw=,u+rw
|
||||
fi
|
||||
cp_umask=$mode$u_plus_rw;;
|
||||
esac
|
||||
fi
|
||||
|
||||
for src
|
||||
do
|
||||
# Protect names starting with `-'.
|
||||
case $src in
|
||||
-*) src=./$src;;
|
||||
esac
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
dst=$src
|
||||
dstdir=$dst
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
if test ! -f "$src" && test ! -d "$src"; then
|
||||
echo "$0: $src does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$dst_arg"; then
|
||||
echo "$0: no destination specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dst=$dst_arg
|
||||
# Protect names starting with `-'.
|
||||
case $dst in
|
||||
-*) dst=./$dst;;
|
||||
esac
|
||||
|
||||
# If destination is a directory, append the input filename; won't work
|
||||
# if double slashes aren't ignored.
|
||||
if test -d "$dst"; then
|
||||
if test -n "$no_target_directory"; then
|
||||
echo "$0: $dst_arg: Is a directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
dstdir=$dst
|
||||
dst=$dstdir/`basename "$src"`
|
||||
dstdir_status=0
|
||||
else
|
||||
# Prefer dirname, but fall back on a substitute if dirname fails.
|
||||
dstdir=`
|
||||
(dirname "$dst") 2>/dev/null ||
|
||||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
|
||||
X"$dst" : 'X\(//\)[^/]' \| \
|
||||
X"$dst" : 'X\(//\)$' \| \
|
||||
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
|
||||
echo X"$dst" |
|
||||
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\/\)[^/].*/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\/\)$/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\).*/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
s/.*/./; q'
|
||||
`
|
||||
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
fi
|
||||
fi
|
||||
|
||||
obsolete_mkdir_used=false
|
||||
|
||||
if test $dstdir_status != 0; then
|
||||
case $posix_mkdir in
|
||||
'')
|
||||
# Create intermediate dirs using mode 755 as modified by the umask.
|
||||
# This is like FreeBSD 'install' as of 1997-10-28.
|
||||
umask=`umask`
|
||||
case $stripcmd.$umask in
|
||||
# Optimize common cases.
|
||||
*[2367][2367]) mkdir_umask=$umask;;
|
||||
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
mkdir_umask=`expr $umask + 22 \
|
||||
- $umask % 100 % 40 + $umask % 20 \
|
||||
- $umask % 10 % 4 + $umask % 2
|
||||
`;;
|
||||
*) mkdir_umask=$umask,go-w;;
|
||||
esac
|
||||
|
||||
# With -d, create the new directory with the user-specified mode.
|
||||
# Otherwise, rely on $mkdir_umask.
|
||||
if test -n "$dir_arg"; then
|
||||
mkdir_mode=-m$mode
|
||||
else
|
||||
mkdir_mode=
|
||||
fi
|
||||
|
||||
posix_mkdir=false
|
||||
case $umask in
|
||||
*[123567][0-7][0-7])
|
||||
# POSIX mkdir -p sets u+wx bits regardless of umask, which
|
||||
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
|
||||
;;
|
||||
*)
|
||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
||||
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
|
||||
|
||||
if (umask $mkdir_umask &&
|
||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
|
||||
then
|
||||
if test -z "$dir_arg" || {
|
||||
# Check for POSIX incompatibilities with -m.
|
||||
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
|
||||
# other-writeable bit of parent directory when it shouldn't.
|
||||
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
|
||||
ls_ld_tmpdir=`ls -ld "$tmpdir"`
|
||||
case $ls_ld_tmpdir in
|
||||
d????-?r-*) different_mode=700;;
|
||||
d????-?--*) different_mode=755;;
|
||||
*) false;;
|
||||
esac &&
|
||||
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
|
||||
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
|
||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
|
||||
}
|
||||
}
|
||||
then posix_mkdir=:
|
||||
fi
|
||||
rmdir "$tmpdir/d" "$tmpdir"
|
||||
else
|
||||
# Remove any dirs left behind by ancient mkdir implementations.
|
||||
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
|
||||
fi
|
||||
trap '' 0;;
|
||||
esac;;
|
||||
esac
|
||||
|
||||
if
|
||||
$posix_mkdir && (
|
||||
umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
|
||||
)
|
||||
then :
|
||||
else
|
||||
|
||||
# The umask is ridiculous, or mkdir does not conform to POSIX,
|
||||
# or it failed possibly due to a race condition. Create the
|
||||
# directory the slow way, step by step, checking for races as we go.
|
||||
|
||||
case $dstdir in
|
||||
/*) prefix='/';;
|
||||
-*) prefix='./';;
|
||||
*) prefix='';;
|
||||
esac
|
||||
|
||||
eval "$initialize_posix_glob"
|
||||
|
||||
oIFS=$IFS
|
||||
IFS=/
|
||||
$posix_glob set -f
|
||||
set fnord $dstdir
|
||||
shift
|
||||
$posix_glob set +f
|
||||
IFS=$oIFS
|
||||
|
||||
prefixes=
|
||||
|
||||
for d
|
||||
do
|
||||
test -z "$d" && continue
|
||||
|
||||
prefix=$prefix$d
|
||||
if test -d "$prefix"; then
|
||||
prefixes=
|
||||
else
|
||||
if $posix_mkdir; then
|
||||
(umask=$mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
|
||||
# Don't fail if two instances are running concurrently.
|
||||
test -d "$prefix" || exit 1
|
||||
else
|
||||
case $prefix in
|
||||
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
|
||||
*) qprefix=$prefix;;
|
||||
esac
|
||||
prefixes="$prefixes '$qprefix'"
|
||||
fi
|
||||
fi
|
||||
prefix=$prefix/
|
||||
done
|
||||
|
||||
if test -n "$prefixes"; then
|
||||
# Don't fail if two instances are running concurrently.
|
||||
(umask $mkdir_umask &&
|
||||
eval "\$doit_exec \$mkdirprog $prefixes") ||
|
||||
test -d "$dstdir" || exit 1
|
||||
obsolete_mkdir_used=true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
|
||||
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
|
||||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
|
||||
else
|
||||
|
||||
# Make a couple of temp file names in the proper directory.
|
||||
dsttmp=$dstdir/_inst.$$_
|
||||
rmtmp=$dstdir/_rm.$$_
|
||||
|
||||
# Trap to clean up those temp files at exit.
|
||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
||||
|
||||
# Copy the file name to the temp name.
|
||||
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits.
|
||||
#
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
||||
#
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
|
||||
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
|
||||
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
|
||||
|
||||
# If -C, don't bother to copy if it wouldn't change the file.
|
||||
if $copy_on_change &&
|
||||
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
|
||||
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
|
||||
|
||||
eval "$initialize_posix_glob" &&
|
||||
$posix_glob set -f &&
|
||||
set X $old && old=:$2:$4:$5:$6 &&
|
||||
set X $new && new=:$2:$4:$5:$6 &&
|
||||
$posix_glob set +f &&
|
||||
|
||||
test "$old" = "$new" &&
|
||||
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
||||
then
|
||||
rm -f "$dsttmp"
|
||||
else
|
||||
# Rename the file to the real destination.
|
||||
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
|
||||
|
||||
# The rename failed, perhaps because mv can't rename something else
|
||||
# to itself, or perhaps because mv is so ancient that it does not
|
||||
# support -f.
|
||||
{
|
||||
# Now remove or move aside any old file at destination location.
|
||||
# We try this two ways since rm can't unlink itself on some
|
||||
# systems and the destination file might be busy for other
|
||||
# reasons. In this case, the final cleanup might fail but the new
|
||||
# file should still install successfully.
|
||||
{
|
||||
test ! -f "$dst" ||
|
||||
$doit $rmcmd -f "$dst" 2>/dev/null ||
|
||||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
|
||||
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
|
||||
} ||
|
||||
{ echo "$0: cannot unlink or rename $dst" >&2
|
||||
(exit 1); exit 1
|
||||
}
|
||||
} &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
$doit $mvcmd "$dsttmp" "$dst"
|
||||
}
|
||||
fi || exit 1
|
||||
|
||||
trap '' 0
|
||||
fi
|
||||
done
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,307 +0,0 @@
|
|||
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
|
||||
/* GeoIP.h
|
||||
*
|
||||
* Copyright (C) 2006 MaxMind LLC
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef GEOIP_H
|
||||
#define GEOIP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#if !defined(_WIN32)
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#else /* !defined(_WIN32) */
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
//#include <wspiapi.h>
|
||||
#include <windows.h>
|
||||
#define snprintf _snprintf
|
||||
#define FILETIME_TO_USEC(ft) (((unsigned __int64) ft.dwHighDateTime << 32 | ft.dwLowDateTime) / 10)
|
||||
#endif /* !defined(_WIN32) */
|
||||
|
||||
#include<stdio.h>
|
||||
#include<stdlib.h>
|
||||
#include<string.h>
|
||||
#include <sys/types.h> /* for fstat */
|
||||
#include <sys/stat.h> /* for fstat */
|
||||
|
||||
#define SEGMENT_RECORD_LENGTH 3
|
||||
#define LARGE_SEGMENT_RECORD_LENGTH 4
|
||||
#define STANDARD_RECORD_LENGTH 3
|
||||
#define ORG_RECORD_LENGTH 4
|
||||
#define MAX_RECORD_LENGTH 4
|
||||
#define NUM_DB_TYPES (33+1)
|
||||
|
||||
/* 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 */
|
||||
|
|
@ -1,394 +0,0 @@
|
|||
|
||||
/*
|
||||
* GeoIPCity.c
|
||||
*
|
||||
* Copyright (C) 2006 MaxMind LLC
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation; either version 2.1 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this library; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <GeoIP.h>
|
||||
#include <GeoIP_internal.h>
|
||||
#include <GeoIPCity.h>
|
||||
#if !defined(_WIN32)
|
||||
#include <unistd.h>
|
||||
#include <netdb.h>
|
||||
#include <netinet/in.h> /* For ntohl */
|
||||
#else
|
||||
#include <windows.h>
|
||||
#include <winsock.h>
|
||||
#endif
|
||||
#include <sys/types.h> /* For uint32_t */
|
||||
#ifdef HAVE_STDINT_H
|
||||
#include <stdint.h> /* For uint32_t */
|
||||
#endif
|
||||
|
||||
static
|
||||
const int FULL_RECORD_LENGTH = 50;
|
||||
|
||||
#define CITYCONFIDENCE_FIXED_RECORD 4
|
||||
#define CITYCONFIDENCEDIST_FIXED_RECORD 6
|
||||
|
||||
|
||||
static
|
||||
GeoIPRecord *
|
||||
_extract_record(GeoIP * gi, unsigned int seek_record, int *next_record_ptr)
|
||||
{
|
||||
int record_pointer;
|
||||
unsigned char *record_buf = NULL;
|
||||
unsigned char *begin_record_buf = NULL;
|
||||
GeoIPRecord *record;
|
||||
int str_length = 0;
|
||||
int j;
|
||||
double latitude = 0, longitude = 0;
|
||||
int metroarea_combo = 0;
|
||||
int bytes_read = 0;
|
||||
int t = 0;
|
||||
if (seek_record == gi->databaseSegments[0])
|
||||
return NULL;
|
||||
|
||||
record = malloc(sizeof(GeoIPRecord));
|
||||
memset(record, 0, sizeof(GeoIPRecord));
|
||||
record->charset = gi->charset;
|
||||
|
||||
if (gi->databaseType == GEOIP_CITYCONFIDENCE_EDITION
|
||||
|| gi->databaseType == GEOIP_CITYCONFIDENCEDIST_EDITION) {
|
||||
|
||||
int fixed_rec_size = gi->record_length +
|
||||
((gi->databaseType == GEOIP_CITYCONFIDENCE_EDITION)
|
||||
? CITYCONFIDENCE_FIXED_RECORD
|
||||
: CITYCONFIDENCEDIST_FIXED_RECORD);
|
||||
|
||||
//allocate max rec size, even for CITYCONFIDENCE_FIXED_RECORD
|
||||
//+4 is the max_record_length
|
||||
unsigned char tmp_fixed_record[CITYCONFIDENCEDIST_FIXED_RECORD + 4];
|
||||
int dseg = gi->databaseSegments[0] * gi->record_length * 2 + gi->record_length;
|
||||
// int aligned_dseg = dseg ;
|
||||
|
||||
int offset = seek_record - gi->databaseSegments[0] - 1; /* -1 b/c zero is not
|
||||
* found. but the array
|
||||
* start with 0 */
|
||||
record_pointer = offset * fixed_rec_size + dseg + gi->dyn_seg_size;
|
||||
if (gi->cache == NULL) {
|
||||
|
||||
/* read from disk */
|
||||
bytes_read = pread(fileno(gi->GeoIPDatabase), tmp_fixed_record, fixed_rec_size, record_pointer);
|
||||
|
||||
if (bytes_read != fixed_rec_size)
|
||||
return NULL;
|
||||
|
||||
record->country_conf = tmp_fixed_record[0];
|
||||
record->region_conf = tmp_fixed_record[1];
|
||||
record->city_conf = tmp_fixed_record[2];
|
||||
record->postal_conf = tmp_fixed_record[3];
|
||||
|
||||
t = fixed_rec_size - gi->record_length;
|
||||
|
||||
record->accuracy_radius =
|
||||
gi->databaseType == GEOIP_CITYCONFIDENCEDIST_EDITION
|
||||
? ((tmp_fixed_record[4] + (tmp_fixed_record[5] << 8)) & 0x3ff) : 0x3ff;
|
||||
|
||||
|
||||
record_pointer = dseg + tmp_fixed_record[t] +
|
||||
(tmp_fixed_record[t + 1] << 8) + (tmp_fixed_record[t + 2] << 16) ;
|
||||
|
||||
if (gi->record_length == 4)
|
||||
record_pointer += (tmp_fixed_record[t + 3] << 24);
|
||||
|
||||
begin_record_buf = record_buf = malloc(sizeof(char) * FULL_RECORD_LENGTH);
|
||||
|
||||
bytes_read = pread(fileno(gi->GeoIPDatabase), record_buf, FULL_RECORD_LENGTH, record_pointer);
|
||||
|
||||
if (bytes_read == 0) {
|
||||
/* eof or other error */
|
||||
free(begin_record_buf);
|
||||
free(record);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
record_buf = gi->cache + (long) record_pointer;
|
||||
|
||||
record->country_conf = record_buf[0];
|
||||
record->region_conf = record_buf[1];
|
||||
record->city_conf = record_buf[2];
|
||||
record->postal_conf = record_buf[3];
|
||||
|
||||
record->accuracy_radius =
|
||||
gi->databaseType == GEOIP_CITYCONFIDENCEDIST_EDITION
|
||||
? ((record_buf[4] + (record_buf[5] << 8)) & 0x3ff) : 0x3ff;
|
||||
|
||||
t = fixed_rec_size - gi->record_length;
|
||||
|
||||
record_pointer = dseg + record_buf[t] +
|
||||
(record_buf[t + 1] << 8) + (record_buf[t + 2] << 16) ;
|
||||
|
||||
if (gi->record_length == 4)
|
||||
record_pointer += (record_buf[t + 3] << 24);
|
||||
|
||||
record_buf = gi->cache + (long) record_pointer;
|
||||
}
|
||||
|
||||
} /* other city records */
|
||||
else {
|
||||
|
||||
record->country_conf = GEOIP_UNKNOWN_CONF;
|
||||
record->region_conf = GEOIP_UNKNOWN_CONF;
|
||||
record->city_conf = GEOIP_UNKNOWN_CONF;
|
||||
record->postal_conf = GEOIP_UNKNOWN_CONF;
|
||||
record->accuracy_radius = GEOIP_UNKNOWN_ACCURACY_RADIUS;
|
||||
|
||||
record_pointer = seek_record + (2 * gi->record_length - 1) * gi->databaseSegments[0];
|
||||
|
||||
if (gi->cache == NULL) {
|
||||
begin_record_buf = record_buf = malloc(sizeof(char) * FULL_RECORD_LENGTH);
|
||||
bytes_read = pread(fileno(gi->GeoIPDatabase), record_buf, FULL_RECORD_LENGTH, record_pointer);
|
||||
if (bytes_read == 0) {
|
||||
/* eof or other error */
|
||||
free(begin_record_buf);
|
||||
free(record);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else {
|
||||
record_buf = gi->cache + (long) record_pointer;
|
||||
}
|
||||
}
|
||||
|
||||
/* get country */
|
||||
record->continent_code = (char *) GeoIP_country_continent[record_buf[0]];
|
||||
record->country_code = (char *) GeoIP_country_code[record_buf[0]];
|
||||
record->country_code3 = (char *) GeoIP_country_code3[record_buf[0]];
|
||||
record->country_name = (char *) GeoIP_country_name_by_id(gi, record_buf[0]);
|
||||
record_buf++;
|
||||
|
||||
/* get region */
|
||||
while (record_buf[str_length] != '\0')
|
||||
str_length++;
|
||||
if (str_length > 0) {
|
||||
record->region = malloc(str_length + 1);
|
||||
strncpy(record->region, (char *) record_buf, str_length + 1);
|
||||
}
|
||||
record_buf += str_length + 1;
|
||||
str_length = 0;
|
||||
|
||||
/* get city */
|
||||
while (record_buf[str_length] != '\0')
|
||||
str_length++;
|
||||
if (str_length > 0) {
|
||||
if (gi->charset == GEOIP_CHARSET_UTF8) {
|
||||
record->city = _GeoIP_iso_8859_1__utf8((const char *) record_buf);
|
||||
}
|
||||
else {
|
||||
record->city = malloc(str_length + 1);
|
||||
strncpy(record->city, (const char *) record_buf, str_length + 1);
|
||||
}
|
||||
}
|
||||
record_buf += (str_length + 1);
|
||||
str_length = 0;
|
||||
|
||||
/* get postal code */
|
||||
while (record_buf[str_length] != '\0')
|
||||
str_length++;
|
||||
if (str_length > 0) {
|
||||
record->postal_code = malloc(str_length + 1);
|
||||
strncpy(record->postal_code, (char *) record_buf, str_length + 1);
|
||||
}
|
||||
record_buf += (str_length + 1);
|
||||
|
||||
/* get latitude */
|
||||
for (j = 0; j < 3; ++j)
|
||||
latitude += (record_buf[j] << (j * 8));
|
||||
record->latitude = latitude / 10000 - 180;
|
||||
record_buf += 3;
|
||||
|
||||
/* get longitude */
|
||||
for (j = 0; j < 3; ++j)
|
||||
longitude += (record_buf[j] << (j * 8));
|
||||
record->longitude = longitude / 10000 - 180;
|
||||
|
||||
/*
|
||||
* get area code and metro code for post April 2002 databases and for US
|
||||
* locations
|
||||
*/
|
||||
if (GEOIP_CITY_EDITION_REV1 == gi->databaseType
|
||||
|| GEOIP_CITYCONFIDENCE_EDITION == gi->databaseType) {
|
||||
if (!strcmp(record->country_code, "US")) {
|
||||
record_buf += 3;
|
||||
for (j = 0; j < 3; ++j)
|
||||
metroarea_combo += (record_buf[j] << (j * 8));
|
||||
record->metro_code = metroarea_combo / 1000;
|
||||
record->area_code = metroarea_combo % 1000;
|
||||
}
|
||||
}
|
||||
|
||||
if (gi->cache == NULL)
|
||||
free(begin_record_buf);
|
||||
|
||||
/* Used for GeoIP_next_record */
|
||||
if (next_record_ptr != NULL)
|
||||
*next_record_ptr = seek_record + record_buf - begin_record_buf + 3;
|
||||
|
||||
return record;
|
||||
}
|
||||
|
||||
static
|
||||
GeoIPRecord *
|
||||
_get_record(GeoIP * gi, unsigned long ipnum)
|
||||
{
|
||||
unsigned int seek_record;
|
||||
if (gi->databaseType != GEOIP_CITY_EDITION_REV0
|
||||
&& gi->databaseType != GEOIP_CITY_EDITION_REV1
|
||||
&& gi->databaseType != GEOIP_CITYCONFIDENCE_EDITION
|
||||
&& gi->databaseType != GEOIP_CITYCONFIDENCEDIST_EDITION) {
|
||||
printf("Invalid database type %s, expected %s\n", GeoIPDBDescription[(int) gi->databaseType], GeoIPDBDescription[GEOIP_CITY_EDITION_REV1]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
seek_record = _GeoIP_seek_record(gi, ipnum);
|
||||
return _extract_record(gi, seek_record, NULL);
|
||||
}
|
||||
|
||||
static
|
||||
GeoIPRecord *
|
||||
_get_record_v6(GeoIP * gi, geoipv6_t ipnum)
|
||||
{
|
||||
unsigned int seek_record;
|
||||
if (gi->databaseType != GEOIP_CITY_EDITION_REV0_V6 &&
|
||||
gi->databaseType != GEOIP_CITY_EDITION_REV1_V6) {
|
||||
printf("Invalid database type %s, expected %s\n", GeoIPDBDescription[(int) gi->databaseType], GeoIPDBDescription[GEOIP_CITY_EDITION_REV1_V6]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
seek_record = _GeoIP_seek_record_v6(gi, ipnum);
|
||||
return _extract_record(gi, seek_record, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
GeoIPRecord *
|
||||
GeoIP_record_by_ipnum(GeoIP * gi, unsigned long ipnum)
|
||||
{
|
||||
return _get_record(gi, ipnum);
|
||||
}
|
||||
|
||||
GeoIPRecord *
|
||||
GeoIP_record_by_ipnum_v6(GeoIP * gi, geoipv6_t ipnum)
|
||||
{
|
||||
return _get_record_v6(gi, ipnum);
|
||||
}
|
||||
|
||||
GeoIPRecord *
|
||||
GeoIP_record_by_addr(GeoIP * gi, const char *addr)
|
||||
{
|
||||
unsigned long ipnum;
|
||||
if (addr == NULL) {
|
||||
return 0;
|
||||
}
|
||||
ipnum = GeoIP_addr_to_num(addr);
|
||||
return _get_record(gi, ipnum);
|
||||
}
|
||||
|
||||
GeoIPRecord *
|
||||
GeoIP_record_by_addr_v6(GeoIP * gi, const char *addr)
|
||||
{
|
||||
geoipv6_t ipnum;
|
||||
if (addr == NULL) {
|
||||
return 0;
|
||||
}
|
||||
ipnum = _GeoIP_addr_to_num_v6(addr);
|
||||
return _get_record_v6(gi, ipnum);
|
||||
}
|
||||
|
||||
GeoIPRecord *
|
||||
GeoIP_record_by_name(GeoIP * gi, const char *name)
|
||||
{
|
||||
unsigned long ipnum;
|
||||
if (name == NULL) {
|
||||
return 0;
|
||||
}
|
||||
ipnum = _GeoIP_lookupaddress(name);
|
||||
return _get_record(gi, ipnum);
|
||||
}
|
||||
|
||||
GeoIPRecord *
|
||||
GeoIP_record_by_name_v6(GeoIP * gi, const char *name)
|
||||
{
|
||||
geoipv6_t ipnum;
|
||||
if (name == NULL) {
|
||||
return 0;
|
||||
}
|
||||
ipnum = _GeoIP_lookupaddress_v6(name);
|
||||
return _get_record_v6(gi, ipnum);
|
||||
}
|
||||
|
||||
int
|
||||
GeoIP_record_id_by_addr(GeoIP * gi, const char *addr)
|
||||
{
|
||||
unsigned long ipnum;
|
||||
if (gi->databaseType != GEOIP_CITY_EDITION_REV0 &&
|
||||
gi->databaseType != GEOIP_CITY_EDITION_REV1) {
|
||||
printf("Invalid database type %s, expected %s\n", GeoIPDBDescription[(int) gi->databaseType], GeoIPDBDescription[GEOIP_CITY_EDITION_REV1]);
|
||||
return 0;
|
||||
}
|
||||
if (addr == NULL) {
|
||||
return 0;
|
||||
}
|
||||
ipnum = GeoIP_addr_to_num(addr);
|
||||
return _GeoIP_seek_record(gi, ipnum);
|
||||
}
|
||||
|
||||
int
|
||||
GeoIP_record_id_by_addr_v6(GeoIP * gi, const char *addr)
|
||||
{
|
||||
geoipv6_t ipnum;
|
||||
if (gi->databaseType != GEOIP_CITY_EDITION_REV0_V6 &&
|
||||
gi->databaseType != GEOIP_CITY_EDITION_REV1_V6) {
|
||||
printf("Invalid database type %s, expected %s\n", GeoIPDBDescription[(int) gi->databaseType], GeoIPDBDescription[GEOIP_CITY_EDITION_REV1]);
|
||||
return 0;
|
||||
}
|
||||
if (addr == NULL) {
|
||||
return 0;
|
||||
}
|
||||
ipnum = _GeoIP_addr_to_num_v6(addr);
|
||||
return _GeoIP_seek_record_v6(gi, ipnum);
|
||||
}
|
||||
|
||||
int
|
||||
GeoIP_init_record_iter(GeoIP * gi)
|
||||
{
|
||||
return gi->databaseSegments[0] + 1;
|
||||
}
|
||||
|
||||
int
|
||||
GeoIP_next_record(GeoIP * gi, GeoIPRecord ** gir, int *record_iter)
|
||||
{
|
||||
if (gi->cache != NULL) {
|
||||
printf("GeoIP_next_record not supported in memory cache mode\n");
|
||||
return 1;
|
||||
}
|
||||
*gir = _extract_record(gi, *record_iter, record_iter);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
GeoIPRecord_delete(GeoIPRecord * gir)
|
||||
{
|
||||
free(gir->region);
|
||||
free(gir->city);
|
||||
free(gir->postal_code);
|
||||
free(gir);
|
||||
}
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
|
||||
/* GeoIPCity.h
|
||||
*
|
||||
* Copyright (C) 2006 MaxMind LLC
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef GEOIPCITY_H
|
||||
#define GEOIPCITY_H
|
||||
|
||||
#include <GeoIP.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define GEOIP_UNKNOWN_CONF ( 0x7f )
|
||||
#define GEOIP_UNKNOWN_ACCURACY_RADIUS ( 0x3ff )
|
||||
|
||||
typedef struct GeoIPRecordTag {
|
||||
char *country_code;
|
||||
char *country_code3;
|
||||
char *country_name;
|
||||
char *region;
|
||||
char *city;
|
||||
char *postal_code;
|
||||
float latitude;
|
||||
float longitude;
|
||||
union {
|
||||
int metro_code; /* metro_code is a alias for dma_code */
|
||||
int dma_code;
|
||||
};
|
||||
int area_code;
|
||||
int charset;
|
||||
char *continent_code;
|
||||
/* confidence factor for Country/Region/City/Postal */
|
||||
unsigned char country_conf, region_conf, city_conf, postal_conf;
|
||||
int accuracy_radius;
|
||||
} GeoIPRecord;
|
||||
|
||||
|
||||
GEOIP_API GeoIPRecord * GeoIP_record_by_ipnum (GeoIP* gi, unsigned long ipnum);
|
||||
GEOIP_API GeoIPRecord * GeoIP_record_by_addr (GeoIP* gi, const char *addr);
|
||||
GEOIP_API GeoIPRecord * GeoIP_record_by_name (GeoIP* gi, const char *host);
|
||||
|
||||
GEOIP_API GeoIPRecord * GeoIP_record_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum);
|
||||
GEOIP_API GeoIPRecord * GeoIP_record_by_addr_v6 (GeoIP* gi, const char *addr);
|
||||
GEOIP_API GeoIPRecord * GeoIP_record_by_name_v6 (GeoIP* gi, const char *host);
|
||||
|
||||
GEOIP_API int GeoIP_record_id_by_addr (GeoIP* gi, const char *addr);
|
||||
GEOIP_API int GeoIP_record_id_by_addr_v6 (GeoIP* gi, const char *addr);
|
||||
|
||||
GEOIP_API int GeoIP_init_record_iter (GeoIP* gi);
|
||||
/* returns 0 on success, 1 on failure */
|
||||
GEOIP_API int GeoIP_next_record (GeoIP* gi, GeoIPRecord **gir, int *record_iter);
|
||||
|
||||
GEOIP_API void GeoIPRecord_delete (GeoIPRecord *gir);
|
||||
|
||||
/* NULL on failure otherwise a malloced string in utf8 */
|
||||
/* char * GeoIP_iso_8859_1__utf8(const char *); */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GEOIPCITY_H */
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue