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