1 /* 2 +----------------------------------------------------------------------+ 3 | PHP Version 7 | 4 +----------------------------------------------------------------------+ 5 | Copyright (c) The PHP Group | 6 +----------------------------------------------------------------------+ 7 | This source file is subject to version 3.01 of the PHP 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.php.net/license/3_01.txt | 11 | If you did not receive a copy of the PHP license and are unable to | 12 | obtain it through the world-wide-web, please send a note to | 13 | license@php.net so we can mail you a copy immediately. | 14 +----------------------------------------------------------------------+ 15 | Authors: Andrey Hristov <andrey@php.net> | 16 | Johannes Schlüter <johannes@php.net> | 17 | Ulf Wendel <uw@php.net> | 18 +----------------------------------------------------------------------+ 19 */ 20 21 #ifndef MYSQLND_EXT_PLUGIN_H 22 #define MYSQLND_EXT_PLUGIN_H 23 24 struct st_mysqlnd_plugin__plugin_area_getters 25 { 26 void ** (*get_connection_area)(const MYSQLND * conn, const unsigned int plugin_id); 27 void ** (*get_connection_data_area)(const MYSQLND_CONN_DATA * conn, const unsigned int plugin_id); 28 void ** (*get_result_area)(const MYSQLND_RES * result, const unsigned int plugin_id); 29 void ** (*get_unbuffered_area)(const MYSQLND_RES_UNBUFFERED * result, const unsigned int plugin_id); 30 void ** (*get_result_buffered_area)(const MYSQLND_RES_BUFFERED_ZVAL * result, const unsigned int plugin_id); 31 void ** (*get_result_buffered_aread_c)(const MYSQLND_RES_BUFFERED_C * result, const unsigned int plugin_id); 32 void ** (*get_stmt_area)(const MYSQLND_STMT * stmt, const unsigned int plugin_id); 33 void ** (*get_protocol_decoder_area)(const MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * factory, const unsigned int plugin_id); 34 void ** (*get_pfc_area)(const MYSQLND_PFC * pfc, const unsigned int plugin_id); 35 void ** (*get_vio_area)(const MYSQLND_VIO * vio, const unsigned int plugin_id); 36 }; 37 38 PHPAPI extern struct st_mysqlnd_plugin__plugin_area_getters mysqlnd_plugin_area_getters; 39 40 #define mysqlnd_plugin_get_plugin_connection_data(c, p_id) mysqlnd_plugin_area_getters.get_connection_area((c), (p_id)) 41 #define mysqlnd_plugin_get_plugin_connection_data_data(c, p_id) mysqlnd_plugin_area_getters.get_connection_data_area((c), (p_id)) 42 #define mysqlnd_plugin_get_plugin_result_data(res, p_id) mysqlnd_plugin_area_getters.get_result_area((res), (p_id)) 43 #define mysqlnd_plugin_get_plugin_result_unbuffered_data(res, p_id) mysqlnd_plugin_area_getters.get_unbuffered_area((res), (p_id)) 44 #define mysqlnd_plugin_get_plugin_result_buffered_data_zval(res, p_id) mysqlnd_plugin_area_getters.get_result_buffered_area((res), (p_id)) 45 #define mysqlnd_plugin_get_plugin_result_buffered_data_c(res, p_id) mysqlnd_plugin_area_getters.get_result_buffered_aread_c((res), (p_id)) 46 #define mysqlnd_plugin_get_plugin_stmt_data(stmt, p_id) mysqlnd_plugin_area_getters.get_stmt_area((stmt), (p_id)) 47 #define mysqlnd_plugin_get_plugin_protocol_data(proto, p_id) mysqlnd_plugin_area_getters.get_protocol_decoder_area((proto), (p_id)) 48 #define mysqlnd_plugin_get_plugin_pfc_data(pfc, p_id) mysqlnd_plugin_area_getters.get_pfc_area((pfc), (p_id)) 49 #define mysqlnd_plugin_get_plugin_vio_data(vio, p_id) mysqlnd_plugin_area_getters.get_pfc_area((vio), (p_id)) 50 51 52 struct st_mysqlnd_plugin_methods_xetters 53 { 54 struct st_mnd_object_factory_xetters 55 { 56 MYSQLND_CLASS_METHODS_TYPE(mysqlnd_object_factory) * (*get)(); 57 void (*set)(MYSQLND_CLASS_METHODS_TYPE(mysqlnd_object_factory) *methods); 58 } object_factory; 59 60 struct st_mnd_connection_xetters 61 { 62 MYSQLND_CLASS_METHODS_TYPE(mysqlnd_conn) * (*get)(); 63 void (*set)(MYSQLND_CLASS_METHODS_TYPE(mysqlnd_conn) *methods); 64 } connection; 65 66 struct st_mnd_connection_data_xetters 67 { 68 MYSQLND_CLASS_METHODS_TYPE(mysqlnd_conn_data) * (*get)(); 69 void (*set)(MYSQLND_CLASS_METHODS_TYPE(mysqlnd_conn_data) *methods); 70 } connection_data; 71 72 struct st_mnd_result_xetters 73 { 74 MYSQLND_CLASS_METHODS_TYPE(mysqlnd_res) * (*get)(); 75 void (*set)(MYSQLND_CLASS_METHODS_TYPE(mysqlnd_res) *methods); 76 } result; 77 78 struct st_mnd_unbuffered_result_xetters 79 { 80 MYSQLND_CLASS_METHODS_TYPE(mysqlnd_result_unbuffered) * (*get)(); 81 void (*set)(MYSQLND_CLASS_METHODS_TYPE(mysqlnd_result_unbuffered) *methods); 82 } unbuffered_result; 83 84 struct st_mnd_buffered_result_xetters 85 { 86 MYSQLND_CLASS_METHODS_TYPE(mysqlnd_result_buffered)* (*get)(); 87 void (*set)(MYSQLND_CLASS_METHODS_TYPE(mysqlnd_result_buffered) *methods); 88 } buffered_result; 89 90 struct st_mnd_stmt_xetters 91 { 92 MYSQLND_CLASS_METHODS_TYPE(mysqlnd_stmt) * (*get)(); 93 void (*set)(MYSQLND_CLASS_METHODS_TYPE(mysqlnd_stmt) * methods); 94 } statement; 95 96 struct st_mnd_protocol_xetters 97 { 98 MYSQLND_CLASS_METHODS_TYPE(mysqlnd_protocol_payload_decoder_factory)* (*get)(); 99 void (*set)(MYSQLND_CLASS_METHODS_TYPE(mysqlnd_protocol_payload_decoder_factory) *methods); 100 } protocol; 101 102 struct st_mnd_pfc_xetters 103 { 104 MYSQLND_CLASS_METHODS_TYPE(mysqlnd_protocol_packet_frame_codec) * (*get)(); 105 void (*set)(MYSQLND_CLASS_METHODS_TYPE(mysqlnd_protocol_packet_frame_codec) * methods); 106 } pfc; 107 108 struct st_mnd_vio_xetters 109 { 110 MYSQLND_CLASS_METHODS_TYPE(mysqlnd_vio) * (*get)(); 111 void (*set)(MYSQLND_CLASS_METHODS_TYPE(mysqlnd_vio) * methods); 112 } vio; 113 114 struct st_mnd_error_info_xetters 115 { 116 MYSQLND_CLASS_METHODS_TYPE(mysqlnd_error_info) * (*get)(); 117 void (*set)(MYSQLND_CLASS_METHODS_TYPE(mysqlnd_error_info) * methods); 118 } error_info; 119 120 struct st_mnd_command_xetters 121 { 122 MYSQLND_CLASS_METHODS_TYPE(mysqlnd_command) * (*get)(); 123 void (*set)(MYSQLND_CLASS_METHODS_TYPE(mysqlnd_command) * methods); 124 } command; 125 }; 126 127 PHPAPI extern struct st_mysqlnd_plugin_methods_xetters mysqlnd_plugin_methods_xetters; 128 129 130 #define mysqlnd_object_factory_get_methods() mysqlnd_plugin_methods_xetters.object_factory.get() 131 #define mysqlnd_object_factory_set_methods(m) mysqlnd_plugin_methods_xetters.object_factory.set((m)) 132 133 #define mysqlnd_conn_get_methods() mysqlnd_plugin_methods_xetters.connection.get() 134 #define mysqlnd_conn_set_methods(m) mysqlnd_plugin_methods_xetters.connection.set((m)) 135 136 #define mysqlnd_conn_data_get_methods() mysqlnd_plugin_methods_xetters.connection_data.get() 137 #define mysqlnd_conn_data_set_methods(m) mysqlnd_plugin_methods_xetters.connection_data.set((m)) 138 139 #define mysqlnd_result_get_methods() mysqlnd_plugin_methods_xetters.result.get() 140 #define mysqlnd_result_set_methods(m) mysqlnd_plugin_methods_xetters.result.set((m)) 141 142 #define mysqlnd_result_unbuffered_get_methods() mysqlnd_plugin_methods_xetters.unbuffered_result.get() 143 #define mysqlnd_result_unbuffered_set_methods(m) mysqlnd_plugin_methods_xetters.unbuffered_result.set((m)) 144 145 #define mysqlnd_result_buffered_get_methods() mysqlnd_plugin_methods_xetters.buffered_result.get() 146 #define mysqlnd_result_buffered_set_methods(m) mysqlnd_plugin_methods_xetters.buffered_result.set((m)) 147 148 #define mysqlnd_stmt_get_methods() mysqlnd_plugin_methods_xetters.statement.get() 149 #define mysqlnd_stmt_set_methods(m) mysqlnd_plugin_methods_xetters.statement.set((m)) 150 151 #define mysqlnd_protocol_get_methods() mysqlnd_plugin_methods_xetters.protocol.get() 152 #define mysqlnd_protocol_set_methods(m) mysqlnd_plugin_methods_xetters.protocol.set((m)) 153 154 #define mysqlnd_pfc_get_methods() mysqlnd_plugin_methods_xetters.pfc.get() 155 #define mysqlnd_pfc_set_methods(m) mysqlnd_plugin_methods_xetters.pfc.set((m)) 156 157 #define mysqlnd_vio_get_methods() mysqlnd_plugin_methods_xetters.vio.get() 158 #define mysqlnd_vio_set_methods(m) mysqlnd_plugin_methods_xetters.vio.set((m)) 159 160 #define mysqlnd_command_get_methods() mysqlnd_plugin_methods_xetters.command.get() 161 #define mysqlnd_command_set_methods(m) mysqlnd_plugin_methods_xetters.command.set((m)) 162 163 #define mysqlnd_error_info_get_methods() mysqlnd_plugin_methods_xetters.error_info.get() 164 #define mysqlnd_error_info_set_methods(m) mysqlnd_plugin_methods_xetters.error_info.set((m)) 165 166 #endif /* MYSQLND_EXT_PLUGIN_H */ 167