plugins/include/geoip.inc
author David Anderson <dvander@alliedmods.net>
Mon Aug 12 00:22:41 2013 +0100 (2013-08-12)
changeset 3989 b73dae36a0da
parent 3967 ceafb87d38a7
permissions -rw-r--r--
Eliminate InfoVars::rval (bug 5844 part 6, r=ds).
     1 /**
     2  * vim: set ts=4 :
     3  * =============================================================================
     4  * SourceMod (C)2004-2008 AlliedModders LLC.  All rights reserved.
     5  * =============================================================================
     6  *
     7  * This file is part of the SourceMod/SourcePawn SDK.
     8  *
     9  * This program is free software; you can redistribute it and/or modify it under
    10  * the terms of the GNU General Public License, version 3.0, as published by the
    11  * Free Software Foundation.
    12  * 
    13  * This program is distributed in the hope that it will be useful, but WITHOUT
    14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    15  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    16  * details.
    17  *
    18  * You should have received a copy of the GNU General Public License along with
    19  * this program.  If not, see <http://www.gnu.org/licenses/>.
    20  *
    21  * As a special exception, AlliedModders LLC gives you permission to link the
    22  * code of this program (as well as its derivative works) to "Half-Life 2," the
    23  * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
    24  * by the Valve Corporation.  You must obey the GNU General Public License in
    25  * all respects for all other code used.  Additionally, AlliedModders LLC grants
    26  * this exception to all derivative works.  AlliedModders LLC defines further
    27  * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
    28  * or <http://www.sourcemod.net/license.php>.
    29  *
    30  * Version: $Id$
    31  */
    32 
    33 #if defined _geoip_included
    34   #endinput
    35 #endif
    36 #define _geoip_included
    37 
    38 #include <core>
    39 
    40 /**
    41  * @section IP addresses can contain ports, the ports will be stripped out.
    42  */
    43 
    44 /**
    45  * Gets the two character country code from an IP address. (US, CA, etc)
    46  *
    47  * @param ip			Ip to determine the country code.
    48  * @param ccode			Destination string buffer to store the code.
    49  * @return				True on success, false if no country found.
    50  */
    51 native bool:GeoipCode2(const String:ip[], String:ccode[3]);
    52 
    53 /**
    54  * Gets the three character country code from an IP address. (USA, CAN, etc)
    55  *
    56  * @param ip			Ip to determine the country code.
    57  * @param ccode			Destination string buffer to store the code.
    58  * @return				True on success, false if no country found.
    59  */
    60 native bool:GeoipCode3(const String:ip[], String:ccode[4]);
    61 
    62 /**
    63  * Gets the full country name. (max length of output string is 45)
    64  *
    65  * @param ip			Ip to determine the country code.
    66  * @param name			Destination string buffer to store the country name.
    67  * @param maxlength			Maximum length of output string buffer.
    68  * @return				True on success, false if no country found.
    69  */
    70 native bool:GeoipCountry(const String:ip[], String:name[], maxlength);
    71 
    72 /**
    73  * @endsection
    74  */
    75 
    76 /**
    77  * Do not edit below this line!
    78  */
    79 public Extension:__ext_geoip = 
    80 {
    81 	name = "GeoIP",
    82 	file = "geoip.ext",
    83 #if defined AUTOLOAD_EXTENSIONS
    84 	autoload = 1,
    85 #else
    86 	autoload = 0,
    87 #endif
    88 #if defined REQUIRE_EXTENSIONS
    89 	required = 1,
    90 #else
    91 	required = 0,
    92 #endif
    93 };
    94 
    95 #if !defined REQUIRE_EXTENSIONS
    96 public __ext_geoip_SetNTVOptional()
    97 {
    98 	MarkNativeAsOptional("GeoipCode2");
    99 	MarkNativeAsOptional("GeoipCode3");
   100 	MarkNativeAsOptional("GeoipCountry");
   101 }
   102 #endif