1 | // Copyright (c) Athena Dev Teams - Licensed under GNU GPL |
---|
2 | // For more information, see LICENCE in the main folder |
---|
3 | |
---|
4 | #ifndef _PLUGIN_H_ |
---|
5 | #define _PLUGIN_H_ |
---|
6 | |
---|
7 | #ifndef _CBASETYPES_H_ |
---|
8 | #include "../common/cbasetypes.h" |
---|
9 | #endif |
---|
10 | |
---|
11 | ////// Plugin functions /////////////// |
---|
12 | |
---|
13 | // Plugin version <major version>.<minor version> |
---|
14 | // * <major version> is increased and <minor version> reset when at least one |
---|
15 | // export of the previous version becomes incompatible |
---|
16 | // * <minor version> is increased if the previous version remains compatible |
---|
17 | // |
---|
18 | // Compatible plugins have: |
---|
19 | // - equal major version |
---|
20 | // - lower or equal minor version |
---|
21 | #define PLUGIN_VERSION "1.03" |
---|
22 | |
---|
23 | typedef struct _Plugin_Info { |
---|
24 | char* name; |
---|
25 | char type; |
---|
26 | char* version; |
---|
27 | char* req_version; |
---|
28 | char* description; |
---|
29 | } Plugin_Info; |
---|
30 | |
---|
31 | typedef struct _Plugin_Event_Table { |
---|
32 | char* func_name; |
---|
33 | char* event_name; |
---|
34 | } Plugin_Event_Table; |
---|
35 | |
---|
36 | // Format of the test function |
---|
37 | typedef int Plugin_Test_Func(void); |
---|
38 | #define EVENT_PLUGIN_INIT "Plugin_Init" // Initialize the plugin |
---|
39 | #define EVENT_PLUGIN_FINAL "Plugin_Final" // Finalize the plugin |
---|
40 | #define EVENT_ATHENA_INIT "Athena_Init" // Server started |
---|
41 | #define EVENT_ATHENA_FINAL "Athena_Final" // Server ended |
---|
42 | |
---|
43 | // Format of event functions |
---|
44 | typedef void Plugin_Event_Func(void); |
---|
45 | #define EVENT_PLUGIN_TEST "Plugin_Test" // Test the plugin for compatibility |
---|
46 | |
---|
47 | ////// Plugin Export functions ///////////// |
---|
48 | |
---|
49 | #define PLUGIN_ALL 0 |
---|
50 | #define PLUGIN_LOGIN 1 |
---|
51 | #define PLUGIN_CHAR 2 |
---|
52 | #define PLUGIN_MAP 8 |
---|
53 | #define PLUGIN_CORE 16 |
---|
54 | |
---|
55 | #define IMPORT_SYMBOL(s,n) (s) = plugin_call_table[n] |
---|
56 | |
---|
57 | #define SYMBOL_SERVER_TYPE 0 |
---|
58 | #define SYMBOL_SERVER_NAME 1 |
---|
59 | #define SYMBOL_ARG_C 2 |
---|
60 | #define SYMBOL_ARG_V 3 |
---|
61 | #define SYMBOL_RUNFLAG 4 |
---|
62 | #define SYMBOL_GETTICK 5 |
---|
63 | #define SYMBOL_GET_SVN_REVISION 6 |
---|
64 | #define SYMBOL_ADD_TIMER 7 |
---|
65 | #define SYMBOL_ADD_TIMER_INTERVAL 8 |
---|
66 | #define SYMBOL_ADD_TIMER_FUNC_LIST 9 |
---|
67 | #define SYMBOL_DELETE_TIMER 10 |
---|
68 | #define SYMBOL_GET_UPTIME 11 |
---|
69 | #define SYMBOL_ADDR 12 |
---|
70 | #define SYMBOL_FD_MAX 13 |
---|
71 | #define SYMBOL_SESSION 14 |
---|
72 | #define SYMBOL_DELETE_SESSION 15 |
---|
73 | #define SYMBOL_WFIFOSET 16 |
---|
74 | #define SYMBOL_RFIFOSKIP 17 |
---|
75 | #define SYMBOL_FUNC_PARSE_TABLE 18 |
---|
76 | // 1.03 |
---|
77 | #define SYMBOL_PARSE_CONSOLE 19 |
---|
78 | |
---|
79 | ////// Global Plugin variables ///////////// |
---|
80 | |
---|
81 | #define PLUGIN_INFO struct _Plugin_Info plugin_info |
---|
82 | #define PLUGIN_EVENTS_TABLE struct _Plugin_Event_Table plugin_event_table[] |
---|
83 | |
---|
84 | #ifndef _PLUGINS_H_ |
---|
85 | void** plugin_call_table; |
---|
86 | #endif |
---|
87 | |
---|
88 | #endif /* _PLUGIN_H_ */ |
---|