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