Back to index

php5  5.3.10
zend_extensions.h
Go to the documentation of this file.
00001 /*
00002    +----------------------------------------------------------------------+
00003    | Zend Engine                                                          |
00004    +----------------------------------------------------------------------+
00005    | Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
00006    +----------------------------------------------------------------------+
00007    | This source file is subject to version 2.00 of the Zend license,     |
00008    | that is bundled with this package in the file LICENSE, and is        |
00009    | available through the world-wide-web at the following url:           |
00010    | http://www.zend.com/license/2_00.txt.                                |
00011    | If you did not receive a copy of the Zend license and are unable to  |
00012    | obtain it through the world-wide-web, please send a note to          |
00013    | license@zend.com so we can mail you a copy immediately.              |
00014    +----------------------------------------------------------------------+
00015    | Authors: Andi Gutmans <andi@zend.com>                                |
00016    |          Zeev Suraski <zeev@zend.com>                                |
00017    +----------------------------------------------------------------------+
00018 */
00019 
00020 /* $Id: zend_extensions.h 321634 2012-01-01 13:15:04Z felipe $ */
00021 
00022 #ifndef ZEND_EXTENSIONS_H
00023 #define ZEND_EXTENSIONS_H
00024 
00025 #include "zend_compile.h"
00026 #include "zend_build.h"
00027 
00028 /* The first number is the engine version and the rest is the date.
00029  * This way engine 2/3 API no. is always greater than engine 1 API no..
00030  */
00031 #define ZEND_EXTENSION_API_NO      220090626
00032 
00033 typedef struct _zend_extension_version_info {
00034        int zend_extension_api_no;
00035        char *build_id;
00036 } zend_extension_version_info;
00037 
00038 #define ZEND_EXTENSION_BUILD_ID "API" ZEND_TOSTR(ZEND_EXTENSION_API_NO) ZEND_BUILD_TS ZEND_BUILD_DEBUG ZEND_BUILD_SYSTEM ZEND_BUILD_EXTRA
00039 
00040 typedef struct _zend_extension zend_extension;
00041 
00042 /* Typedef's for zend_extension function pointers */
00043 typedef int (*startup_func_t)(zend_extension *extension);
00044 typedef void (*shutdown_func_t)(zend_extension *extension);
00045 typedef void (*activate_func_t)(void);
00046 typedef void (*deactivate_func_t)(void);
00047 
00048 typedef void (*message_handler_func_t)(int message, void *arg);
00049 
00050 typedef void (*op_array_handler_func_t)(zend_op_array *op_array);
00051 
00052 typedef void (*statement_handler_func_t)(zend_op_array *op_array);
00053 typedef void (*fcall_begin_handler_func_t)(zend_op_array *op_array);
00054 typedef void (*fcall_end_handler_func_t)(zend_op_array *op_array);
00055 
00056 typedef void (*op_array_ctor_func_t)(zend_op_array *op_array);
00057 typedef void (*op_array_dtor_func_t)(zend_op_array *op_array);
00058 
00059 struct _zend_extension {
00060        char *name;
00061        char *version;
00062        char *author;
00063        char *URL;
00064        char *copyright;
00065 
00066        startup_func_t startup;
00067        shutdown_func_t shutdown;
00068        activate_func_t activate;
00069        deactivate_func_t deactivate;
00070 
00071        message_handler_func_t message_handler;
00072 
00073        op_array_handler_func_t op_array_handler;
00074 
00075        statement_handler_func_t statement_handler;
00076        fcall_begin_handler_func_t fcall_begin_handler;
00077        fcall_end_handler_func_t fcall_end_handler;
00078 
00079        op_array_ctor_func_t op_array_ctor;
00080        op_array_dtor_func_t op_array_dtor;
00081 
00082        int (*api_no_check)(int api_no);
00083        int (*build_id_check)(const char* build_id);
00084        void *reserved3;
00085        void *reserved4;
00086        void *reserved5;
00087        void *reserved6;
00088        void *reserved7;
00089        void *reserved8;
00090 
00091        DL_HANDLE handle;
00092        int resource_number;
00093 };
00094 
00095 BEGIN_EXTERN_C()
00096 ZEND_API int zend_get_resource_handle(zend_extension *extension);
00097 ZEND_API void zend_extension_dispatch_message(int message, void *arg);
00098 END_EXTERN_C()
00099 
00100 #define ZEND_EXTMSG_NEW_EXTENSION         1
00101 
00102 
00103 #define ZEND_EXTENSION()    \
00104        ZEND_EXT_API zend_extension_version_info extension_version_info = { ZEND_EXTENSION_API_NO, ZEND_EXTENSION_BUILD_ID }
00105 
00106 #define STANDARD_ZEND_EXTENSION_PROPERTIES       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -1
00107 #define COMPAT_ZEND_EXTENSION_PROPERTIES         NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -1
00108 #define BUILD_COMPAT_ZEND_EXTENSION_PROPERTIES   NULL, NULL, NULL, NULL, NULL, NULL, NULL, -1
00109 
00110 
00111 ZEND_API extern zend_llist zend_extensions;
00112 
00113 void zend_extension_dtor(zend_extension *extension);
00114 void zend_append_version_info(const zend_extension *extension);
00115 int zend_startup_extensions_mechanism(void);
00116 int zend_startup_extensions(void);
00117 void zend_shutdown_extensions(TSRMLS_D);
00118 
00119 BEGIN_EXTERN_C()
00120 ZEND_API int zend_load_extension(const char *path);
00121 ZEND_API int zend_register_extension(zend_extension *new_extension, DL_HANDLE handle);
00122 ZEND_API zend_extension *zend_get_extension(const char *extension_name);
00123 END_EXTERN_C()
00124 
00125 #endif /* ZEND_EXTENSIONS_H */
00126 
00127 /*
00128  * Local variables:
00129  * tab-width: 4
00130  * c-basic-offset: 4
00131  * indent-tabs-mode: t
00132  * End:
00133  */