extensions/geoip/extension.h
author David Anderson <dvander@alliedmods.net>
Fri Jun 22 17:24:48 2007 +0000 (2007-06-22)
changeset 1002 786f5abf93ea
parent 757 b799caa9a190
child 1226 478550a4d5ec
permissions -rw-r--r--
fixed a bug where the "keyOnly" parameter to KvGotoNextKey was read backwards
dvander@373
     1
/**
ds@757
     2
 * vim: set ts=4 :
ds@757
     3
 * ===============================================================
ds@757
     4
 * SourceMod GeoIP Extension
ds@757
     5
 * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
ds@757
     6
 * ===============================================================
dvander@373
     7
 *
dvander@373
     8
 * This program is free software; you can redistribute it and/or
dvander@373
     9
 * modify it under the terms of the GNU General Public License
dvander@373
    10
 * as published by the Free Software Foundation; either version 2
dvander@373
    11
 * of the License, or (at your option) any later version.
dvander@373
    12
 * This program is distributed in the hope that it will be useful,
dvander@373
    13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
dvander@373
    14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
dvander@373
    15
 * GNU General Public License for more details.
dvander@373
    16
 * 
dvander@373
    17
 * You should have received a copy of the GNU General Public License
dvander@373
    18
 * along with this program; if not, write to the Free Software
dvander@373
    19
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
dvander@373
    20
 *
dvander@373
    21
 * Version: $Id$
dvander@373
    22
 */
dvander@373
    23
faluco@316
    24
#ifndef _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
faluco@316
    25
#define _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
faluco@316
    26
ds@757
    27
/**
ds@757
    28
 * @file extension.h
ds@757
    29
 * @brief GeoIP extension code header.
ds@757
    30
 */
ds@757
    31
faluco@316
    32
#include "smsdk_ext.h"
faluco@316
    33
faluco@316
    34
faluco@316
    35
/**
ds@757
    36
 * @brief Implementation of the GeoIP extension.
faluco@316
    37
 * Note: Uncomment one of the pre-defined virtual functions in order to use it.
faluco@316
    38
 */
faluco@316
    39
class GeoIP_Extension : public SDKExtension
faluco@316
    40
{
faluco@316
    41
public:
faluco@316
    42
	/**
faluco@316
    43
	 * @brief This is called after the initial loading sequence has been processed.
faluco@316
    44
	 *
faluco@316
    45
	 * @param error		Error message buffer.
ds@757
    46
	 * @param maxlength	Size of error message buffer.
faluco@316
    47
	 * @param late		Whether or not the module was loaded after map load.
faluco@316
    48
	 * @return			True to succeed loading, false to fail.
faluco@316
    49
	 */
ds@757
    50
	virtual bool SDK_OnLoad(char *error, size_t maxlength, bool late);
faluco@316
    51
	
faluco@316
    52
	/**
faluco@316
    53
	 * @brief This is called right before the extension is unloaded.
faluco@316
    54
	 */
faluco@316
    55
	virtual void SDK_OnUnload();
faluco@316
    56
faluco@316
    57
	/**
faluco@316
    58
	 * @brief This is called once all known extensions have been loaded.
faluco@316
    59
	 * Note: It is is a good idea to add natives here, if any are provided.
faluco@316
    60
	 */
faluco@316
    61
	//virtual void SDK_OnAllLoaded();
faluco@316
    62
faluco@316
    63
	/**
faluco@316
    64
	 * @brief Called when the pause state is changed.
faluco@316
    65
	 */
faluco@316
    66
	//virtual void SDK_OnPauseChange(bool paused);
faluco@316
    67
faluco@316
    68
	/**
faluco@316
    69
	 * @brief this is called when Core wants to know if your extension is working.
faluco@316
    70
	 *
faluco@316
    71
	 * @param error		Error message buffer.
ds@757
    72
	 * @param maxlength	Size of error message buffer.
faluco@316
    73
	 * @return			True if working, false otherwise.
faluco@316
    74
	 */
ds@757
    75
	//virtual bool QueryRunning(char *error, size_t maxlength);
faluco@316
    76
public:
faluco@316
    77
#if defined SMEXT_CONF_METAMOD
faluco@316
    78
	/**
ds@757
    79
	 * @brief Called when Metamod is attached, before the extension version is called.
ds@757
    80
	 *
ds@757
    81
	 * @param error			Error buffer.
ds@757
    82
	 * @param maxlength		Maximum size of error buffer.
ds@757
    83
	 * @param late			Whether or not Metamod considers this a late load.
ds@757
    84
	 * @return				True to succeed, false to fail.
faluco@316
    85
	 */
ds@757
    86
	//virtual bool SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlength, bool late);
faluco@316
    87
ds@757
    88
	/**
ds@757
    89
	 * @brief Called when Metamod is detaching, after the extension version is called.
ds@757
    90
	 * NOTE: By default this is blocked unless sent from SourceMod.
ds@757
    91
	 *
ds@757
    92
	 * @param error			Error buffer.
ds@757
    93
	 * @param maxlength		Maximum size of error buffer.
ds@757
    94
	 * @return				True to succeed, false to fail.
ds@757
    95
	 */
ds@757
    96
	//virtual bool SDK_OnMetamodUnload(char *error, size_t maxlength);
ds@757
    97
ds@757
    98
	/**
ds@757
    99
	 * @brief Called when Metamod's pause state is changing.
ds@757
   100
	 * NOTE: By default this is blocked unless sent from SourceMod.
ds@757
   101
	 *
ds@757
   102
	 * @param paused		Pause state being set.
ds@757
   103
	 * @param error			Error buffer.
ds@757
   104
	 * @param maxlength		Maximum size of error buffer.
ds@757
   105
	 * @return				True to succeed, false to fail.
ds@757
   106
	 */
ds@757
   107
	//virtual bool SDK_OnMetamodPauseChange(bool paused, char *error, size_t maxlength);
faluco@316
   108
#endif
faluco@316
   109
};
faluco@316
   110
faluco@321
   111
extern const sp_nativeinfo_t geoip_natives[];
faluco@321
   112
ds@757
   113
#endif // _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_