plugin.h 2.4 KB

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