diff options
author | FlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-01-08 08:35:32 +0000 |
---|---|---|
committer | FlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-01-08 08:35:32 +0000 |
commit | 4e5a65295ad732fd53630d8c29912ec047038d9d (patch) | |
tree | 863815cddc095c55fa3c7645e4c52cffc9e744b9 /src/common/plugin.h | |
parent | 8fd7ea9e4f38bd02b99e4fa42fc2003390a25adc (diff) | |
download | hercules-4e5a65295ad732fd53630d8c29912ec047038d9d.tar.gz hercules-4e5a65295ad732fd53630d8c29912ec047038d9d.tar.bz2 hercules-4e5a65295ad732fd53630d8c29912ec047038d9d.tar.xz hercules-4e5a65295ad732fd53630d8c29912ec047038d9d.zip |
- Added a precompiler error when the shutdown defines are not found.
- Added parse_console to the plugin API.
- Added plugin for parsing the console. (working with cygwin)
- Added the console plugin to plugin_athena.conf commented out.
- Copied the parse_console code form login txt to login sql and char.
- Added propper plugin version compatibility tests.
- Better output when a plugin fails to load.
-----
The console plugin (at it's 3rd version) uses two pipes and another thread.
- the other thread reads data from stdin and sends it through one of the pipes
- the other pipe serves as semaphore (and terminator) to that thread
- the normal thread checks if the pipe has data once every timer cycle, if data is found it invokes parse_console with that data
Worth noting: the first version didn't use another thread and just checked if data was available on the input stream, but apparently that can't be done to standard input in windows
It's only been tested on cygwin (and should work on most *nix systems), can't test native windows right now because I'm having trouble exporting the required plugin variables in VS8
src/plugins/Makefile hasn't been updated because it's not working properly for me
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9631 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/common/plugin.h')
-rw-r--r-- | src/common/plugin.h | 59 |
1 files changed, 51 insertions, 8 deletions
diff --git a/src/common/plugin.h b/src/common/plugin.h index 402636b1d..f30a15e5e 100644 --- a/src/common/plugin.h +++ b/src/common/plugin.h @@ -4,23 +4,44 @@ #ifndef _PLUGIN_H_ #define _PLUGIN_H_ +#include "cbasetypes.h" + ////// Plugin functions /////////////// -#define PLUGIN_VERSION "1.02" +// Plugin version <major version>.<minor version> +// * <major version> is increased and <minor version> reset when at least one +// export of the previous version becomes incompatible +// * <minor version> is increased if the previous version remains compatible +// +// Compatible plugins have: +// - equal major version +// - lower or equal minor version +#define PLUGIN_VERSION "1.03" typedef struct _Plugin_Info { - char *name; + char* name; char type; - char *version; - char *req_version; - char *description; + char* version; + char* req_version; + char* description; } Plugin_Info; typedef struct _Plugin_Event_Table { - char *func_name; - char *event_name; + char* func_name; + char* event_name; } Plugin_Event_Table; +// Format of the test function +typedef int Plugin_Test_Func(void); +#define EVENT_PLUGIN_INIT "Plugin_Init" // Initialize the plugin +#define EVENT_PLUGIN_FINAL "Plugin_Final" // Finalize the plugin +#define EVENT_ATHENA_INIT "Athena_Init" // Server started +#define EVENT_ATHENA_FINAL "Athena_Final" // Server ended + +// Format of event functions +typedef void Plugin_Event_Func(void); +#define EVENT_PLUGIN_TEST "Plugin_Test" // Test the plugin for compatibility + ////// Plugin Export functions ///////////// #define PLUGIN_ALL 0 @@ -31,10 +52,32 @@ typedef struct _Plugin_Event_Table { #define IMPORT_SYMBOL(s,n) (s) = plugin_call_table[n] +#define SYMBOL_SERVER_TYPE 0 +#define SYMBOL_SERVER_NAME 1 +#define SYMBOL_ARG_C 2 +#define SYMBOL_ARG_V 3 +#define SYMBOL_RUNFLAG 4 +#define SYMBOL_GETTICK 5 +#define SYMBOL_GET_SVN_REVISION 6 +#define SYMBOL_ADD_TIMER 7 +#define SYMBOL_ADD_TIMER_INTERVAL 8 +#define SYMBOL_ADD_TIMER_FUNC_LIST 9 +#define SYMBOL_DELETE_TIMER 10 +#define SYMBOL_GET_UPTIME 11 +#define SYMBOL_ADDR 12 +#define SYMBOL_FD_MAX 13 +#define SYMBOL_SESSION 14 +#define SYMBOL_DELETE_SESSION 15 +#define SYMBOL_WFIFOSET 16 +#define SYMBOL_RFIFOSKIP 17 +#define SYMBOL_FUNC_PARSE_TABLE 18 +// 1.03 +#define SYMBOL_PARSE_CONSOLE 19 + ////// Global Plugin variables ///////////// #define PLUGIN_INFO struct _Plugin_Info plugin_info #define PLUGIN_EVENTS_TABLE struct _Plugin_Event_Table plugin_event_table[] -void **plugin_call_table; +void** plugin_call_table; #endif // _PLUGIN_H_ |