ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Coro-Mysql/violite.h
(Generate patch)

Comparing Coro-Mysql/violite.h (file contents):
Revision 1.4 by root, Fri Aug 2 04:08:56 2013 UTC vs.
Revision 1.5 by root, Sun Apr 13 08:01:45 2014 UTC

130 SSL_TYPE_ANY, 130 SSL_TYPE_ANY,
131 SSL_TYPE_X509, 131 SSL_TYPE_X509,
132 SSL_TYPE_SPECIFIED 132 SSL_TYPE_SPECIFIED
133}; 133};
134 134
135typedef unsigned char uchar;
135 136
136/* HFTODO - hide this if we don't want client in embedded server */ 137/* HFTODO - hide this if we don't want client in embedded server */
137/* This structure is for every connection on both sides */ 138/* This structure is for every connection on both sides */
138#if defined(MARIADB_BASE_VERSION) 139#if defined(MARIADB_BASE_VERSION) && 0
139 140
140#define DESC_IS_PTR 1 141#define DESC_IS_PTR 1
141typedef unsigned char uchar;
142 142
143struct st_vio 143struct st_vio
144{ 144{
145 my_socket sd; /* my_socket - real or imaginary */ 145 my_socket sd; /* my_socket - real or imaginary */
146 void *m_psi; 146 void *m_psi;
209 my_bool (*was_interrupted)(Vio*); 209 my_bool (*was_interrupted)(Vio*);
210 int (*vioclose)(Vio*); 210 int (*vioclose)(Vio*);
211 void (*timeout)(Vio*, unsigned int which, unsigned int timeout); 211 void (*timeout)(Vio*, unsigned int which, unsigned int timeout);
212}; 212};
213 213
214#else 214#elif MYSQL_VERSION_ID < 50600
215 215
216struct st_vio 216struct st_vio
217{ 217{
218 my_socket sd; /* my_socket - real or imaginary */ 218 my_socket sd; /* my_socket - real or imaginary */
219 HANDLE hPipe; 219 HANDLE hPipe;
246 my_bool (*poll_read)(Vio *vio, uint timeout); 246 my_bool (*poll_read)(Vio *vio, uint timeout);
247 my_bool (*is_connected)(Vio*); 247 my_bool (*is_connected)(Vio*);
248 my_bool (*has_data) (Vio*); 248 my_bool (*has_data) (Vio*);
249}; 249};
250 250
251#else
252
253/* this is not supposed to work, but it's a start
254 * one needs to look into MYSQL_SOCKET, missing
255 * vioblocking and this io_wait stuff, at the least. */
256
257/**
258 VIO I/O events.
259*/
260enum enum_vio_io_event
261{
262 VIO_IO_EVENT_READ,
263 VIO_IO_EVENT_WRITE,
264 VIO_IO_EVENT_CONNECT
265};
266
267struct st_vio
268{
269 MYSQL_SOCKET mysql_socket; /* Instrumented socket */
270 my_bool localhost; /* Are we from localhost? */
271 struct sockaddr_storage local; /* Local internet address */
272 struct sockaddr_storage remote; /* Remote internet address */
273 int addrLen; /* Length of remote address */
274 enum enum_vio_type type; /* Type of connection */
275 my_bool inactive; /* Connection inactive (has been shutdown) */
276 char desc[30]; /* Description string. This
277 member MUST NOT be
278 used directly, but only
279 via function
280 "vio_description" */
281 char *read_buffer; /* buffer for vio_read_buff */
282 char *read_pos; /* start of unfetched data in the
283 read buffer */
284 char *read_end; /* end of unfetched data */
285 int read_timeout; /* Timeout value (ms) for read ops. */
286 int write_timeout; /* Timeout value (ms) for write ops. */
287
288 /*
289 VIO vtable interface to be implemented by VIO's like SSL, Socket,
290 Named Pipe, etc.
291 */
292
293 /*
294 viodelete is responsible for cleaning up the VIO object by freeing
295 internal buffers, closing descriptors, handles.
296 */
297 void (*viodelete)(Vio*);
298 int (*vioerrno)(Vio*);
299 size_t (*read)(Vio*, uchar *, size_t);
300 size_t (*write)(Vio*, const uchar *, size_t);
301 int (*timeout)(Vio*, uint, my_bool);
302 int (*viokeepalive)(Vio*, my_bool);
303 int (*fastsend)(Vio*);
304 my_bool (*peer_addr)(Vio*, char *, uint16*, size_t);
305 void (*in_addr)(Vio*, struct sockaddr_storage*);
306 my_bool (*should_retry)(Vio*);
307 my_bool (*was_timeout)(Vio*);
308 /*
309 vioshutdown is resposnible to shutdown/close the channel, so that no
310 further communications can take place, however any related buffers,
311 descriptors, handles can remain valid after a shutdown.
312 */
313 int (*vioshutdown)(Vio*);
314 my_bool (*is_connected)(Vio*);
315 my_bool (*has_data) (Vio*);
316 int (*io_wait)(Vio*, enum enum_vio_io_event, int);
317 my_bool (*connect)(Vio*, struct sockaddr *, socklen_t, int);
318};
319
251#endif 320#endif
252 321
253#endif /* vio_violite_h_ */ 322#endif /* vio_violite_h_ */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines