extensions/geoip/extension.h
author Scott Ehlert <ds@alliedmods.net>
Thu Mar 27 04:54:56 2008 +0000 (2008-03-27)
changeset 1947 e73a1e51833b
parent 1330 ab94316bb52b
child 2289 44045ead61cd
permissions -rw-r--r--
Updated copyright year
dvander@373
     1
/**
ds@757
     2
 * vim: set ts=4 :
ds@1330
     3
 * =============================================================================
ds@757
     4
 * SourceMod GeoIP Extension
ds@1947
     5
 * Copyright (C) 2004-2008 AlliedModders LLC.  All rights reserved.
ds@1330
     6
 * =============================================================================
dvander@373
     7
 *
ds@1330
     8
 * This program is free software; you can redistribute it and/or modify it under
ds@1330
     9
 * the terms of the GNU General Public License, version 3.0, as published by the
ds@1330
    10
 * Free Software Foundation.
dvander@1226
    11
 * 
ds@1330
    12
 * This program is distributed in the hope that it will be useful, but WITHOUT
ds@1330
    13
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
ds@1330
    14
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
ds@1330
    15
 * details.
dvander@1226
    16
 *
ds@1330
    17
 * You should have received a copy of the GNU General Public License along with
ds@1330
    18
 * this program.  If not, see <http://www.gnu.org/licenses/>.
dvander@1226
    19
 *
ds@1330
    20
 * As a special exception, AlliedModders LLC gives you permission to link the
ds@1330
    21
 * code of this program (as well as its derivative works) to "Half-Life 2," the
ds@1330
    22
 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
ds@1330
    23
 * by the Valve Corporation.  You must obey the GNU General Public License in
ds@1330
    24
 * all respects for all other code used.  Additionally, AlliedModders LLC grants
ds@1330
    25
 * this exception to all derivative works.  AlliedModders LLC defines further
ds@1330
    26
 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
ds@1330
    27
 * or <http://www.sourcemod.net/license.php>.
dvander@373
    28
 *
dvander@373
    29
 * Version: $Id$
dvander@373
    30
 */
dvander@373
    31
faluco@316
    32
#ifndef _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
faluco@316
    33
#define _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
faluco@316
    34
ds@757
    35
/**
ds@757
    36
 * @file extension.h
ds@757
    37
 * @brief GeoIP extension code header.
ds@757
    38
 */
ds@757
    39
faluco@316
    40
#include "smsdk_ext.h"
faluco@316
    41
faluco@316
    42
faluco@316
    43
/**
ds@757
    44
 * @brief Implementation of the GeoIP extension.
faluco@316
    45
 * Note: Uncomment one of the pre-defined virtual functions in order to use it.
faluco@316
    46
 */
faluco@316
    47
class GeoIP_Extension : public SDKExtension
faluco@316
    48
{
faluco@316
    49
public:
faluco@316
    50
	/**
faluco@316
    51
	 * @brief This is called after the initial loading sequence has been processed.
faluco@316
    52
	 *
faluco@316
    53
	 * @param error		Error message buffer.
ds@757
    54
	 * @param maxlength	Size of error message buffer.
faluco@316
    55
	 * @param late		Whether or not the module was loaded after map load.
faluco@316
    56
	 * @return			True to succeed loading, false to fail.
faluco@316
    57
	 */
ds@757
    58
	virtual bool SDK_OnLoad(char *error, size_t maxlength, bool late);
faluco@316
    59
	
faluco@316
    60
	/**
faluco@316
    61
	 * @brief This is called right before the extension is unloaded.
faluco@316
    62
	 */
faluco@316
    63
	virtual void SDK_OnUnload();
faluco@316
    64
faluco@316
    65
	/**
faluco@316
    66
	 * @brief This is called once all known extensions have been loaded.
faluco@316
    67
	 * Note: It is is a good idea to add natives here, if any are provided.
faluco@316
    68
	 */
faluco@316
    69
	//virtual void SDK_OnAllLoaded();
faluco@316
    70
faluco@316
    71
	/**
faluco@316
    72
	 * @brief Called when the pause state is changed.
faluco@316
    73
	 */
faluco@316
    74
	//virtual void SDK_OnPauseChange(bool paused);
faluco@316
    75
faluco@316
    76
	/**
faluco@316
    77
	 * @brief this is called when Core wants to know if your extension is working.
faluco@316
    78
	 *
faluco@316
    79
	 * @param error		Error message buffer.
ds@757
    80
	 * @param maxlength	Size of error message buffer.
faluco@316
    81
	 * @return			True if working, false otherwise.
faluco@316
    82
	 */
ds@757
    83
	//virtual bool QueryRunning(char *error, size_t maxlength);
faluco@316
    84
public:
faluco@316
    85
#if defined SMEXT_CONF_METAMOD
faluco@316
    86
	/**
ds@757
    87
	 * @brief Called when Metamod is attached, before the extension version is called.
ds@757
    88
	 *
ds@757
    89
	 * @param error			Error buffer.
ds@757
    90
	 * @param maxlength		Maximum size of error buffer.
ds@757
    91
	 * @param late			Whether or not Metamod considers this a late load.
ds@757
    92
	 * @return				True to succeed, false to fail.
faluco@316
    93
	 */
ds@757
    94
	//virtual bool SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlength, bool late);
faluco@316
    95
ds@757
    96
	/**
ds@757
    97
	 * @brief Called when Metamod is detaching, after the extension version is called.
ds@757
    98
	 * NOTE: By default this is blocked unless sent from SourceMod.
ds@757
    99
	 *
ds@757
   100
	 * @param error			Error buffer.
ds@757
   101
	 * @param maxlength		Maximum size of error buffer.
ds@757
   102
	 * @return				True to succeed, false to fail.
ds@757
   103
	 */
ds@757
   104
	//virtual bool SDK_OnMetamodUnload(char *error, size_t maxlength);
ds@757
   105
ds@757
   106
	/**
ds@757
   107
	 * @brief Called when Metamod's pause state is changing.
ds@757
   108
	 * NOTE: By default this is blocked unless sent from SourceMod.
ds@757
   109
	 *
ds@757
   110
	 * @param paused		Pause state being set.
ds@757
   111
	 * @param error			Error buffer.
ds@757
   112
	 * @param maxlength		Maximum size of error buffer.
ds@757
   113
	 * @return				True to succeed, false to fail.
ds@757
   114
	 */
ds@757
   115
	//virtual bool SDK_OnMetamodPauseChange(bool paused, char *error, size_t maxlength);
faluco@316
   116
#endif
faluco@316
   117
};
faluco@316
   118
faluco@321
   119
extern const sp_nativeinfo_t geoip_natives[];
faluco@321
   120
ds@757
   121
#endif // _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_