Parent Directory | Revision Log
Revision 17 - (view) (download)
1 : | ian | 1 | /* GeoIP module functions for AMX Mod X |
2 : | by David "BAILOPAN" Anderson | ||
3 : | (C)Copyrighted under the GNU General Public License, Version 2 | ||
4 : | */ | ||
5 : | |||
6 : | #if defined geoip_included | ||
7 : | #endinput | ||
8 : | #endif | ||
9 : | #define _geoip_included | ||
10 : | |||
11 : | #if AMXX_VERSION_NUM >= 175 | ||
12 : | #pragma reqlib geoip | ||
13 : | #if !defined AMXMODX_NOAUTOLOAD | ||
14 : | #pragma loadlib geoip | ||
15 : | #endif | ||
16 : | #else | ||
17 : | #pragma library geoip | ||
18 : | #endif | ||
19 : | |||
20 : | ian | 17 | /// IP addresses passed to these natives can contain ports, the ports will be ignored. |
21 : | ian | 1 | |
22 : | ian | 17 | /** |
23 : | * Lookup the two character country code for a given IP address. | ||
24 : | * e.g: "US", "CA", etc. | ||
25 : | * | ||
26 : | * @param ip The IP address to lookup. | ||
27 : | * @param result The result buffer. If the lookup does not succeed, the buffer is not modified. | ||
28 : | * @return true on a successful lookup, false on a failed lookup. | ||
29 : | */ | ||
30 : | native bool:geoip_code2_ex(const ip[], result[3]); | ||
31 : | |||
32 : | /** | ||
33 : | * Lookup the three character country code for a given IP address. | ||
34 : | * e.g: "USA", "cAN", etc. | ||
35 : | * | ||
36 : | * @param ip The IP address to lookup. | ||
37 : | * @param result The result buffer. If the lookup does not succeed, the buffer is not modified. | ||
38 : | * @return true on a successful lookup, false on a failed lookup. | ||
39 : | */ | ||
40 : | native bool:geoip_code3_ex(const ip[], result[4]); | ||
41 : | |||
42 : | /** | ||
43 : | * @deprecated | ||
44 : | * Lookup the two character country code for a given IP address. | ||
45 : | * | ||
46 : | * @note This native will overflow the buffer by one cell on an unknown ip lookup! | ||
47 : | * @note Use geoip_code2_ex instead! | ||
48 : | * | ||
49 : | * @param ip The IP address to lookup. | ||
50 : | * @param result The result buffer. | ||
51 : | */ | ||
52 : | ian | 1 | native geoip_code2(const ip[], ccode[3]); |
53 : | |||
54 : | ian | 17 | /** |
55 : | * @deprecated | ||
56 : | * Lookup the three character country code for a given IP address. | ||
57 : | * | ||
58 : | * @note This native will overflow the buffer by one cell on an unknown ip lookup! | ||
59 : | * @note Use geoip_code3_ex instead! | ||
60 : | * | ||
61 : | * @param ip The IP address to lookup. | ||
62 : | * @param result The result buffer. | ||
63 : | */ | ||
64 : | ian | 1 | native geoip_code3(const ip[], result[4]); |
65 : | |||
66 : | ian | 17 | /** |
67 : | * Lookup the full country name for the given IP address. Sets the buffer to "error" on | ||
68 : | * an unsuccessful lookup. | ||
69 : | * | ||
70 : | * @param ip The IP address to lookup. | ||
71 : | * @param result The result of the geoip lookup. | ||
72 : | * @param len The maximum length of the result buffer. | ||
73 : | */ | ||
74 : | ian | 1 | native geoip_country(const ip[], result[], len=45); |
Contact | ViewVC Help |
Powered by ViewVC 1.0.4 |