- Notifications
You must be signed in to change notification settings - Fork 7.8k
/
Copy pathzend_extensions.h
163 lines (127 loc) · 6.43 KB
/
zend_extensions.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/*
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
| Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
+----------------------------------------------------------------------+
| This source file is subject to version 2.00 of the Zend license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.zend.com/license/2_00.txt. |
| If you did not receive a copy of the Zend license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@zend.com so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Andi Gutmans <andi@php.net> |
| Zeev Suraski <zeev@php.net> |
+----------------------------------------------------------------------+
*/
#ifndefZEND_EXTENSIONS_H
#defineZEND_EXTENSIONS_H
#include"zend_compile.h"
#include"zend_build.h"
/*
The constants below are derived from ext/opcache/ZendAccelerator.h
You can use the following macro to check the extension API version for compatibilities:
#define ZEND_EXTENSION_API_NO_5_0_X 220040412
#define ZEND_EXTENSION_API_NO_5_1_X 220051025
#define ZEND_EXTENSION_API_NO_5_2_X 220060519
#define ZEND_EXTENSION_API_NO_5_3_X 220090626
#define ZEND_EXTENSION_API_NO_5_4_X 220100525
#define ZEND_EXTENSION_API_NO_5_5_X 220121212
#define ZEND_EXTENSION_API_NO_5_6_X 220131226
#define ZEND_EXTENSION_API_NO_7_0_X 320151012
#if ZEND_EXTENSION_API_NO < ZEND_EXTENSION_API_NO_5_5_X
// do something for php versions lower than 5.5.x
#endif
*/
/* The first number is the engine version and the rest is the date (YYYYMMDD).
* This way engine 2/3 API no. is always greater than engine 1 API no.. */
#defineZEND_EXTENSION_API_NO 420240924
typedefstruct_zend_extension_version_info {
intzend_extension_api_no;
constchar*build_id;
} zend_extension_version_info;
#defineZEND_EXTENSION_BUILD_ID "API" ZEND_TOSTR(ZEND_EXTENSION_API_NO) ZEND_BUILD_TS ZEND_BUILD_DEBUG ZEND_BUILD_SYSTEM ZEND_BUILD_EXTRA
typedefstruct_zend_extensionzend_extension;
/* Typedef's for zend_extension function pointers */
typedefint (*startup_func_t)(zend_extension*extension);
typedefvoid (*shutdown_func_t)(zend_extension*extension);
typedefvoid (*activate_func_t)(void);
typedefvoid (*deactivate_func_t)(void);
typedefvoid (*message_handler_func_t)(intmessage, void*arg);
typedefvoid (*op_array_handler_func_t)(zend_op_array*op_array);
typedefvoid (*statement_handler_func_t)(zend_execute_data*frame);
typedefvoid (*fcall_begin_handler_func_t)(zend_execute_data*frame);
typedefvoid (*fcall_end_handler_func_t)(zend_execute_data*frame);
typedefvoid (*op_array_ctor_func_t)(zend_op_array*op_array);
typedefvoid (*op_array_dtor_func_t)(zend_op_array*op_array);
typedefsize_t (*op_array_persist_calc_func_t)(zend_op_array*op_array);
typedefsize_t (*op_array_persist_func_t)(zend_op_array*op_array, void*mem);
struct_zend_extension {
constchar*name;
constchar*version;
constchar*author;
constchar*URL;
constchar*copyright;
startup_func_tstartup;
shutdown_func_tshutdown;
activate_func_tactivate;
deactivate_func_tdeactivate;
message_handler_func_tmessage_handler;
op_array_handler_func_top_array_handler;
statement_handler_func_tstatement_handler;
fcall_begin_handler_func_tfcall_begin_handler;
fcall_end_handler_func_tfcall_end_handler;
op_array_ctor_func_top_array_ctor;
op_array_dtor_func_top_array_dtor;
int (*api_no_check)(intapi_no);
int (*build_id_check)(constchar*build_id);
op_array_persist_calc_func_top_array_persist_calc;
op_array_persist_func_top_array_persist;
void*reserved5;
void*reserved6;
void*reserved7;
void*reserved8;
DL_HANDLEhandle;
intresource_number;
};
BEGIN_EXTERN_C()
externZEND_APIintzend_op_array_extension_handles;
ZEND_APIintzend_get_resource_handle(constchar*module_name);
ZEND_APIintzend_get_op_array_extension_handle(constchar*module_name);
ZEND_APIintzend_get_op_array_extension_handles(constchar*module_name, inthandles);
ZEND_APIintzend_get_internal_function_extension_handle(constchar*module_name);
ZEND_APIintzend_get_internal_function_extension_handles(constchar*module_name, inthandles);
ZEND_APIvoidzend_extension_dispatch_message(intmessage, void*arg);
END_EXTERN_C()
#defineZEND_EXTMSG_NEW_EXTENSION 1
#defineZEND_EXTENSION() \
ZEND_EXT_API zend_extension_version_info extension_version_info = { ZEND_EXTENSION_API_NO, ZEND_EXTENSION_BUILD_ID }
#defineSTANDARD_ZEND_EXTENSION_PROPERTIES NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -1
#defineCOMPAT_ZEND_EXTENSION_PROPERTIES NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -1
#defineBUILD_COMPAT_ZEND_EXTENSION_PROPERTIES NULL, NULL, NULL, NULL, NULL, NULL, NULL, -1
ZEND_APIexternzend_llistzend_extensions;
ZEND_APIexternuint32_tzend_extension_flags;
#defineZEND_EXTENSIONS_HAVE_OP_ARRAY_CTOR (1<<0)
#defineZEND_EXTENSIONS_HAVE_OP_ARRAY_DTOR (1<<1)
#defineZEND_EXTENSIONS_HAVE_OP_ARRAY_HANDLER (1<<2)
#defineZEND_EXTENSIONS_HAVE_OP_ARRAY_PERSIST_CALC (1<<3)
#defineZEND_EXTENSIONS_HAVE_OP_ARRAY_PERSIST (1<<4)
voidzend_extension_dtor(zend_extension*extension);
ZEND_APIvoidzend_append_version_info(constzend_extension*extension);
voidzend_startup_extensions_mechanism(void);
voidzend_startup_extensions(void);
voidzend_shutdown_extensions(void);
ZEND_APIsize_tzend_internal_run_time_cache_reserved_size(void);
ZEND_APIvoidzend_init_internal_run_time_cache(void);
ZEND_APIvoidzend_reset_internal_run_time_cache(void);
BEGIN_EXTERN_C()
ZEND_APIzend_resultzend_load_extension(constchar*path);
ZEND_APIzend_resultzend_load_extension_handle(DL_HANDLEhandle, constchar*path);
ZEND_APIvoidzend_register_extension(zend_extension*new_extension, DL_HANDLEhandle);
ZEND_APIzend_extension*zend_get_extension(constchar*extension_name);
ZEND_APIsize_tzend_extensions_op_array_persist_calc(zend_op_array*op_array);
ZEND_APIsize_tzend_extensions_op_array_persist(zend_op_array*op_array, void*mem);
END_EXTERN_C()
#endif/* ZEND_EXTENSIONS_H */