971.7.10
by Eric Day
Duplicated oldlibdrizzle module, one for Drizzle protocol and one for MySQL, per Brian's request from merge proposal. Port options are now --drizzle-protocol-port and --mysql-protocol-port. |
1 |
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
2 |
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
|
|
3 |
*
|
|
4 |
* Copyright (C) 2008 Sun Microsystems, Inc.
|
|
5 |
*
|
|
6 |
* This program is free software; you can redistribute it and/or modify
|
|
7 |
* it under the terms of the GNU General Public License as published by
|
|
8 |
* the Free Software Foundation; version 2 of the License.
|
|
9 |
*
|
|
10 |
* This program is distributed in the hope that it will be useful,
|
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 |
* GNU General Public License for more details.
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License
|
|
16 |
* along with this program; if not, write to the Free Software
|
|
17 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
18 |
*/
|
|
19 |
||
20 |
||
971.7.11
by Eric Day
Fixed header file guards and fixed test cases. |
21 |
#ifndef PLUGIN_MYSQL_PROTOCOL_NET_SERV_H
|
22 |
#define PLUGIN_MYSQL_PROTOCOL_NET_SERV_H
|
|
971.7.10
by Eric Day
Duplicated oldlibdrizzle module, one for Drizzle protocol and one for MySQL, per Brian's request from merge proposal. Port options are now --drizzle-protocol-port and --mysql-protocol-port. |
23 |
|
24 |
#include "vio.h" |
|
25 |
||
26 |
#define LIBDRIZZLE_ERRMSG_SIZE 512
|
|
27 |
#define LIBDRIZZLE_SQLSTATE_LENGTH 5
|
|
28 |
||
1964.2.9
by Monty Taylor
All protocol stuff except for the buffer_length. WTF? |
29 |
namespace drizzle_plugin |
30 |
{
|
|
971.7.10
by Eric Day
Duplicated oldlibdrizzle module, one for Drizzle protocol and one for MySQL, per Brian's request from merge proposal. Port options are now --drizzle-protocol-port and --mysql-protocol-port. |
31 |
|
32 |
typedef struct st_net { |
|
33 |
Vio *vio; |
|
34 |
unsigned char *buff,*buff_end,*write_pos,*read_pos; |
|
35 |
int fd; /* For Perl DBI/dbd */ |
|
36 |
/*
|
|
37 |
The following variable is set if we are doing several queries in one
|
|
38 |
command ( as in LOAD TABLE ... FROM MASTER ),
|
|
39 |
and do not want to confuse the client with OK at the wrong time
|
|
40 |
*/
|
|
41 |
unsigned long remain_in_buf,length, buf_length, where_b; |
|
42 |
unsigned long max_packet,max_packet_size; |
|
43 |
unsigned int pkt_nr,compress_pkt_nr; |
|
44 |
unsigned int write_timeout; |
|
45 |
unsigned int read_timeout; |
|
46 |
unsigned int retry_count; |
|
47 |
int fcntl; |
|
48 |
unsigned int *return_status; |
|
49 |
unsigned char reading_or_writing; |
|
50 |
char save_char; |
|
51 |
bool compress; |
|
52 |
/*
|
|
53 |
Pointer to query object in query cache, do not equal NULL (0) for
|
|
54 |
queries in cache that have not stored its results yet
|
|
55 |
*/
|
|
56 |
/*
|
|
57 |
Unused, please remove with the next incompatible ABI change.
|
|
58 |
*/
|
|
59 |
unsigned char *unused; |
|
60 |
unsigned int last_errno; |
|
61 |
unsigned char error; |
|
62 |
/** Client library error message buffer. Actually belongs to struct MYSQL. */
|
|
63 |
char last_error[LIBDRIZZLE_ERRMSG_SIZE]; |
|
64 |
/** Client library sqlstate buffer. Set along with the error message. */
|
|
65 |
char sqlstate[LIBDRIZZLE_SQLSTATE_LENGTH+1]; |
|
66 |
void *extension; |
|
67 |
} NET; |
|
68 |
||
1964.2.9
by Monty Taylor
All protocol stuff except for the buffer_length. WTF? |
69 |
bool drizzleclient_net_init(NET *net, Vio* vio, uint32_t buffer_length); |
70 |
void drizzleclient_net_end(NET *net); |
|
71 |
void drizzleclient_net_clear(NET *net, bool clear_buffer); |
|
72 |
bool drizzleclient_net_flush(NET *net); |
|
73 |
bool drizzleclient_net_write(NET *net,const unsigned char *packet, size_t len); |
|
74 |
bool drizzleclient_net_write_command(NET *net,unsigned char command, |
|
75 |
const unsigned char *header, size_t head_len, |
|
76 |
const unsigned char *packet, size_t len); |
|
77 |
uint32_t drizzleclient_net_read(NET *net); |
|
78 |
void drizzleclient_net_close(NET *net); |
|
79 |
bool drizzleclient_net_init_sock(NET * net, int sock, uint32_t buffer_length); |
|
80 |
bool drizzleclient_net_peer_addr(NET *net, char *buf, uint16_t *port, size_t buflen); |
|
81 |
void drizzleclient_net_keepalive(NET *net, bool flag); |
|
82 |
int drizzleclient_net_get_sd(NET *net); |
|
83 |
bool drizzleclient_net_more_data(NET *net); |
|
84 |
||
85 |
void drizzleclient_net_set_write_timeout(NET *net, uint32_t timeout); |
|
86 |
void drizzleclient_net_set_read_timeout(NET *net, uint32_t timeout); |
|
87 |
void drizzleclient_drizzleclient_net_clear_error(NET *net); |
|
88 |
||
89 |
} /* namespace drizzle_plugin */ |
|
971.7.10
by Eric Day
Duplicated oldlibdrizzle module, one for Drizzle protocol and one for MySQL, per Brian's request from merge proposal. Port options are now --drizzle-protocol-port and --mysql-protocol-port. |
90 |
|
971.7.11
by Eric Day
Fixed header file guards and fixed test cases. |
91 |
#endif /* PLUGIN_MYSQL_PROTOCOL_NET_SERV_H */ |