1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 #ifndef ZEND_EXTENSIONS_H
23 #define ZEND_EXTENSIONS_H
24
25 #include "zend_compile.h"
26 #include "zend_build.h"
27
28
29
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
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
126
127
128
129
130
131
132
133