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 20 /* $Id$ */ 21 22 #ifndef ZEND_EXTENSIONS_H 23 #define ZEND_EXTENSIONS_H 24 25 #include "zend_compile.h" 26 #include "zend_build.h" 27 28 /* The first number is the engine version and the rest is the date. 29 * This way engine 2/3 API no. is always greater than engine 1 API no.. 30 */ 31 #define ZEND_EXTENSION_API_NO 220131226 32 33 typedef struct _zend_extension_version_info { 34 int zend_extension_api_no; 35 char *build_id; 36 } zend_extension_version_info; 37 38 #define ZEND_EXTENSION_BUILD_ID "API" ZEND_TOSTR(ZEND_EXTENSION_API_NO) ZEND_BUILD_TS ZEND_BUILD_DEBUG ZEND_BUILD_SYSTEM ZEND_BUILD_EXTRA 39 40 typedef struct _zend_extension zend_extension; 41 42 /* Typedef's for zend_extension function pointers */ 43 typedef int (*startup_func_t)(zend_extension *extension); 44 typedef void (*shutdown_func_t)(zend_extension *extension); 45 typedef void (*activate_func_t)(void); 46 typedef void (*deactivate_func_t)(void); 47 48 typedef void (*message_handler_func_t)(int message, void *arg); 49 50 typedef void (*op_array_handler_func_t)(zend_op_array *op_array); 51 52 typedef void (*statement_handler_func_t)(zend_op_array *op_array); 53 typedef void (*fcall_begin_handler_func_t)(zend_op_array *op_array); 54 typedef void (*fcall_end_handler_func_t)(zend_op_array *op_array); 55 56 typedef void (*op_array_ctor_func_t)(zend_op_array *op_array); 57 typedef void (*op_array_dtor_func_t)(zend_op_array *op_array); 58 59 struct _zend_extension { 60 char *name; 61 char *version; 62 char *author; 63 char *URL; 64 char *copyright; 65 66 startup_func_t startup; 67 shutdown_func_t shutdown; 68 activate_func_t activate; 69 deactivate_func_t deactivate; 70 71 message_handler_func_t message_handler; 72 73 op_array_handler_func_t op_array_handler; 74 75 statement_handler_func_t statement_handler; 76 fcall_begin_handler_func_t fcall_begin_handler; 77 fcall_end_handler_func_t fcall_end_handler; 78 79 op_array_ctor_func_t op_array_ctor; 80 op_array_dtor_func_t op_array_dtor; 81 82 int (*api_no_check)(int api_no); 83 int (*build_id_check)(const char* build_id); 84 void *reserved3; 85 void *reserved4; 86 void *reserved5; 87 void *reserved6; 88 void *reserved7; 89 void *reserved8; 90 91 DL_HANDLE handle; 92 int resource_number; 93 }; 94 95 BEGIN_EXTERN_C() 96 ZEND_API int zend_get_resource_handle(zend_extension *extension); 97 ZEND_API void zend_extension_dispatch_message(int message, void *arg); 98 END_EXTERN_C() 99 100 #define ZEND_EXTMSG_NEW_EXTENSION 1 101 102 103 #define ZEND_EXTENSION() \ 104 ZEND_EXT_API zend_extension_version_info extension_version_info = { ZEND_EXTENSION_API_NO, ZEND_EXTENSION_BUILD_ID } 105 106 #define STANDARD_ZEND_EXTENSION_PROPERTIES NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -1 107 #define COMPAT_ZEND_EXTENSION_PROPERTIES NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -1 108 #define BUILD_COMPAT_ZEND_EXTENSION_PROPERTIES NULL, NULL, NULL, NULL, NULL, NULL, NULL, -1 109 110 111 ZEND_API extern zend_llist zend_extensions; 112 113 void zend_extension_dtor(zend_extension *extension); 114 ZEND_API void zend_append_version_info(const zend_extension *extension); 115 int zend_startup_extensions_mechanism(void); 116 int zend_startup_extensions(void); 117 void zend_shutdown_extensions(TSRMLS_D); 118 119 BEGIN_EXTERN_C() 120 ZEND_API int zend_load_extension(const char *path); 121 ZEND_API int zend_register_extension(zend_extension *new_extension, DL_HANDLE handle); 122 ZEND_API zend_extension *zend_get_extension(const char *extension_name); 123 END_EXTERN_C() 124 125 #endif /* ZEND_EXTENSIONS_H */ 126 127 /* 128 * Local variables: 129 * tab-width: 4 130 * c-basic-offset: 4 131 * indent-tabs-mode: t 132 * End: 133 */ 134