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