Back to index

php5  5.3.10
zend_modules.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_modules.h 321634 2012-01-01 13:15:04Z felipe $ */
00021 
00022 #ifndef MODULES_H
00023 #define MODULES_H
00024 
00025 #include "zend.h"
00026 #include "zend_compile.h"
00027 #include "zend_build.h"
00028 
00029 #define INIT_FUNC_ARGS             int type, int module_number TSRMLS_DC
00030 #define INIT_FUNC_ARGS_PASSTHRU    type, module_number TSRMLS_CC
00031 #define SHUTDOWN_FUNC_ARGS  int type, int module_number TSRMLS_DC
00032 #define SHUTDOWN_FUNC_ARGS_PASSTHRU type, module_number TSRMLS_CC
00033 #define ZEND_MODULE_INFO_FUNC_ARGS zend_module_entry *zend_module TSRMLS_DC
00034 #define ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU zend_module TSRMLS_CC
00035 
00036 #define ZEND_MODULE_API_NO 20090626
00037 #ifdef ZTS
00038 #define USING_ZTS 1
00039 #else
00040 #define USING_ZTS 0
00041 #endif
00042 
00043 #define STANDARD_MODULE_HEADER_EX sizeof(zend_module_entry), ZEND_MODULE_API_NO, ZEND_DEBUG, USING_ZTS
00044 #define STANDARD_MODULE_HEADER \
00045        STANDARD_MODULE_HEADER_EX, NULL, NULL
00046 #define ZE2_STANDARD_MODULE_HEADER \
00047        STANDARD_MODULE_HEADER_EX, ini_entries, NULL
00048 
00049 #define ZEND_MODULE_BUILD_ID "API" ZEND_TOSTR(ZEND_MODULE_API_NO) ZEND_BUILD_TS ZEND_BUILD_DEBUG ZEND_BUILD_SYSTEM ZEND_BUILD_EXTRA
00050 
00051 #define STANDARD_MODULE_PROPERTIES_EX 0, 0, NULL, 0, ZEND_MODULE_BUILD_ID
00052 
00053 #define NO_MODULE_GLOBALS 0, NULL, NULL, NULL
00054 
00055 #ifdef ZTS
00056 # define ZEND_MODULE_GLOBALS(module_name) sizeof(zend_##module_name##_globals), &module_name##_globals_id
00057 #else
00058 # define ZEND_MODULE_GLOBALS(module_name) sizeof(zend_##module_name##_globals), &module_name##_globals
00059 #endif
00060 
00061 #define STANDARD_MODULE_PROPERTIES \
00062        NO_MODULE_GLOBALS, NULL, STANDARD_MODULE_PROPERTIES_EX
00063 
00064 #define NO_VERSION_YET NULL
00065 
00066 #define MODULE_PERSISTENT 1
00067 #define MODULE_TEMPORARY 2
00068 
00069 struct _zend_ini_entry;
00070 typedef struct _zend_module_entry zend_module_entry;
00071 typedef struct _zend_module_dep zend_module_dep;
00072 
00073 struct _zend_module_entry {
00074        unsigned short size;
00075        unsigned int zend_api;
00076        unsigned char zend_debug;
00077        unsigned char zts;
00078        const struct _zend_ini_entry *ini_entry;
00079        const struct _zend_module_dep *deps;
00080        const char *name;
00081        const struct _zend_function_entry *functions;
00082        int (*module_startup_func)(INIT_FUNC_ARGS);
00083        int (*module_shutdown_func)(SHUTDOWN_FUNC_ARGS);
00084        int (*request_startup_func)(INIT_FUNC_ARGS);
00085        int (*request_shutdown_func)(SHUTDOWN_FUNC_ARGS);
00086        void (*info_func)(ZEND_MODULE_INFO_FUNC_ARGS);
00087        const char *version;
00088        size_t globals_size;
00089 #ifdef ZTS
00090        ts_rsrc_id* globals_id_ptr;
00091 #else
00092        void* globals_ptr;
00093 #endif
00094        void (*globals_ctor)(void *global TSRMLS_DC);
00095        void (*globals_dtor)(void *global TSRMLS_DC);
00096        int (*post_deactivate_func)(void);
00097        int module_started;
00098        unsigned char type;
00099        void *handle;
00100        int module_number;
00101        char *build_id;
00102 };
00103 
00104 #define MODULE_DEP_REQUIRED        1
00105 #define MODULE_DEP_CONFLICTS       2
00106 #define MODULE_DEP_OPTIONAL        3
00107 
00108 #define ZEND_MOD_REQUIRED_EX(name, rel, ver)     { name, rel, ver, MODULE_DEP_REQUIRED  },
00109 #define ZEND_MOD_CONFLICTS_EX(name, rel, ver)    { name, rel, ver, MODULE_DEP_CONFLICTS },
00110 #define ZEND_MOD_OPTIONAL_EX(name, rel, ver)     { name, rel, ver, MODULE_DEP_OPTIONAL  },
00111 
00112 #define ZEND_MOD_REQUIRED(name)           ZEND_MOD_REQUIRED_EX(name, NULL, NULL)
00113 #define ZEND_MOD_CONFLICTS(name)   ZEND_MOD_CONFLICTS_EX(name, NULL, NULL)
00114 #define ZEND_MOD_OPTIONAL(name)           ZEND_MOD_OPTIONAL_EX(name, NULL, NULL)
00115 
00116 #define ZEND_MOD_END { NULL, NULL, NULL, 0 }
00117 
00118 struct _zend_module_dep {
00119        const char *name;           /* module name */
00120        const char *rel;            /* version relationship: NULL (exists), lt|le|eq|ge|gt (to given version) */
00121        const char *version; /* version */
00122        unsigned char type;         /* dependency type */
00123 };
00124 
00125 extern ZEND_API HashTable module_registry;
00126 
00127 void module_destructor(zend_module_entry *module);
00128 int module_registry_cleanup(zend_module_entry *module TSRMLS_DC);
00129 int module_registry_request_startup(zend_module_entry *module TSRMLS_DC);
00130 int module_registry_unload_temp(const zend_module_entry *module TSRMLS_DC);
00131 
00132 #define ZEND_MODULE_DTOR (void (*)(void *)) module_destructor
00133 #endif
00134 
00135 /*
00136  * Local variables:
00137  * tab-width: 4
00138  * c-basic-offset: 4
00139  * indent-tabs-mode: t
00140  * End:
00141  */