zend_extensions.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /*
  2. +----------------------------------------------------------------------+
  3. | Zend Engine |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1998-2016 Zend Technologies Ltd. (http://www.zend.com) |
  6. +----------------------------------------------------------------------+
  7. | This source file is subject to version 2.00 of the Zend license, |
  8. | that is bundled with this package in the file LICENSE, and is |
  9. | available through the world-wide-web at the following url: |
  10. | http://www.zend.com/license/2_00.txt. |
  11. | If you did not receive a copy of the Zend license and are unable to |
  12. | obtain it through the world-wide-web, please send a note to |
  13. | license@zend.com so we can mail you a copy immediately. |
  14. +----------------------------------------------------------------------+
  15. | Authors: Andi Gutmans <andi@zend.com> |
  16. | Zeev Suraski <zeev@zend.com> |
  17. +----------------------------------------------------------------------+
  18. */
  19. /* $Id$ */
  20. #ifndef ZEND_EXTENSIONS_H
  21. #define ZEND_EXTENSIONS_H
  22. #include "zend_compile.h"
  23. #include "zend_build.h"
  24. /* The first number is the engine version and the rest is the date.
  25. * This way engine 2/3 API no. is always greater than engine 1 API no..
  26. */
  27. #define ZEND_EXTENSION_API_NO 220131226
  28. typedef struct _zend_extension_version_info {
  29. int zend_extension_api_no;
  30. char *build_id;
  31. } zend_extension_version_info;
  32. #define ZEND_EXTENSION_BUILD_ID "API" ZEND_TOSTR(ZEND_EXTENSION_API_NO) ZEND_BUILD_TS ZEND_BUILD_DEBUG ZEND_BUILD_SYSTEM ZEND_BUILD_EXTRA
  33. typedef struct _zend_extension zend_extension;
  34. /* Typedef's for zend_extension function pointers */
  35. typedef int (*startup_func_t)(zend_extension *extension);
  36. typedef void (*shutdown_func_t)(zend_extension *extension);
  37. typedef void (*activate_func_t)(void);
  38. typedef void (*deactivate_func_t)(void);
  39. typedef void (*message_handler_func_t)(int message, void *arg);
  40. typedef void (*op_array_handler_func_t)(zend_op_array *op_array);
  41. typedef void (*statement_handler_func_t)(zend_op_array *op_array);
  42. typedef void (*fcall_begin_handler_func_t)(zend_op_array *op_array);
  43. typedef void (*fcall_end_handler_func_t)(zend_op_array *op_array);
  44. typedef void (*op_array_ctor_func_t)(zend_op_array *op_array);
  45. typedef void (*op_array_dtor_func_t)(zend_op_array *op_array);
  46. struct _zend_extension {
  47. char *name;
  48. char *version;
  49. char *author;
  50. char *URL;
  51. char *copyright;
  52. startup_func_t startup;
  53. shutdown_func_t shutdown;
  54. activate_func_t activate;
  55. deactivate_func_t deactivate;
  56. message_handler_func_t message_handler;
  57. op_array_handler_func_t op_array_handler;
  58. statement_handler_func_t statement_handler;
  59. fcall_begin_handler_func_t fcall_begin_handler;
  60. fcall_end_handler_func_t fcall_end_handler;
  61. op_array_ctor_func_t op_array_ctor;
  62. op_array_dtor_func_t op_array_dtor;
  63. int (*api_no_check)(int api_no);
  64. int (*build_id_check)(const char* build_id);
  65. void *reserved3;
  66. void *reserved4;
  67. void *reserved5;
  68. void *reserved6;
  69. void *reserved7;
  70. void *reserved8;
  71. DL_HANDLE handle;
  72. int resource_number;
  73. };
  74. BEGIN_EXTERN_C()
  75. ZEND_API int zend_get_resource_handle(zend_extension *extension);
  76. ZEND_API void zend_extension_dispatch_message(int message, void *arg);
  77. END_EXTERN_C()
  78. #define ZEND_EXTMSG_NEW_EXTENSION 1
  79. #define ZEND_EXTENSION() \
  80. ZEND_EXT_API zend_extension_version_info extension_version_info = { ZEND_EXTENSION_API_NO, ZEND_EXTENSION_BUILD_ID }
  81. #define STANDARD_ZEND_EXTENSION_PROPERTIES NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -1
  82. #define COMPAT_ZEND_EXTENSION_PROPERTIES NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -1
  83. #define BUILD_COMPAT_ZEND_EXTENSION_PROPERTIES NULL, NULL, NULL, NULL, NULL, NULL, NULL, -1
  84. ZEND_API extern zend_llist zend_extensions;
  85. void zend_extension_dtor(zend_extension *extension);
  86. ZEND_API void zend_append_version_info(const zend_extension *extension);
  87. int zend_startup_extensions_mechanism(void);
  88. int zend_startup_extensions(void);
  89. void zend_shutdown_extensions(TSRMLS_D);
  90. BEGIN_EXTERN_C()
  91. ZEND_API int zend_load_extension(const char *path);
  92. ZEND_API int zend_register_extension(zend_extension *new_extension, DL_HANDLE handle);
  93. ZEND_API zend_extension *zend_get_extension(const char *extension_name);
  94. END_EXTERN_C()
  95. #endif /* ZEND_EXTENSIONS_H */
  96. /*
  97. * Local variables:
  98. * tab-width: 4
  99. * c-basic-offset: 4
  100. * indent-tabs-mode: t
  101. * End:
  102. */