faluco@319: /** ds@475: * vim: set ts=4 : ds@1330: * ============================================================================= ds@1947: * SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved. ds@1330: * ============================================================================= ds@1330: * ds@1330: * This file is part of the SourceMod/SourcePawn SDK. dvander@374: * ds@1330: * This program is free software; you can redistribute it and/or modify it under ds@1330: * the terms of the GNU General Public License, version 3.0, as published by the ds@1330: * Free Software Foundation. ds@1330: * ds@1330: * This program is distributed in the hope that it will be useful, but WITHOUT ds@1330: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ds@1330: * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more ds@1330: * details. ds@1330: * ds@1330: * You should have received a copy of the GNU General Public License along with ds@1330: * this program. If not, see . ds@1330: * ds@1330: * As a special exception, AlliedModders LLC gives you permission to link the ds@1330: * code of this program (as well as its derivative works) to "Half-Life 2," the ds@1330: * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software ds@1330: * by the Valve Corporation. You must obey the GNU General Public License in ds@1330: * all respects for all other code used. Additionally, AlliedModders LLC grants ds@1330: * this exception to all derivative works. AlliedModders LLC defines further ds@1330: * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007), ds@1330: * or . dvander@374: * dvander@374: * Version: $Id$ faluco@319: */ faluco@319: faluco@319: #if defined _geoip_included faluco@319: #endinput faluco@319: #endif faluco@319: #define _geoip_included faluco@319: dvander@320: #include dvander@320: faluco@319: /** dvander@619: * @section IP addresses can contain ports, the ports will be stripped out. faluco@319: */ faluco@319: faluco@319: /** faluco@319: * Gets the two character country code from an IP address. (US, CA, etc) faluco@319: * faluco@319: * @param ip Ip to determine the country code. faluco@319: * @param ccode Destination string buffer to store the code. dvander@1293: * @return True on success, false if no country found. faluco@319: */ dvander@1293: native bool:GeoipCode2(const String:ip[], String:ccode[3]); faluco@319: faluco@319: /** faluco@319: * Gets the three character country code from an IP address. (USA, CAN, etc) faluco@319: * faluco@319: * @param ip Ip to determine the country code. faluco@319: * @param ccode Destination string buffer to store the code. dvander@1293: * @return True on success, false if no country found. faluco@319: */ dvander@1293: native bool:GeoipCode3(const String:ip[], String:ccode[4]); faluco@319: faluco@319: /** faluco@319: * Gets the full country name. (max length of output string is 45) faluco@319: * faluco@319: * @param ip Ip to determine the country code. erik@3967: * @param name Destination string buffer to store the country name. erik@3967: * @param maxlength Maximum length of output string buffer. dvander@1293: * @return True on success, false if no country found. faluco@319: */ dvander@1293: native bool:GeoipCountry(const String:ip[], String:name[], maxlength); dvander@320: dvander@320: /** dvander@619: * @endsection dvander@619: */ dvander@619: dvander@619: /** dvander@320: * Do not edit below this line! dvander@320: */ dvander@320: public Extension:__ext_geoip = dvander@320: { dvander@320: name = "GeoIP", dvander@320: file = "geoip.ext", dvander@320: #if defined AUTOLOAD_EXTENSIONS dvander@320: autoload = 1, dvander@320: #else dvander@320: autoload = 0, dvander@320: #endif dvander@320: #if defined REQUIRE_EXTENSIONS dvander@320: required = 1, dvander@320: #else dvander@320: required = 0, dvander@320: #endif dvander@320: }; dvander@1573: dvander@1573: #if !defined REQUIRE_EXTENSIONS dvander@1573: public __ext_geoip_SetNTVOptional() dvander@1573: { dvander@1573: MarkNativeAsOptional("GeoipCode2"); dvander@1573: MarkNativeAsOptional("GeoipCode3"); dvander@1573: MarkNativeAsOptional("GeoipCountry"); dvander@1573: } dvander@1573: #endif