~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/drizzle_protocol/net_serv.h

  • Committer: Olaf van der Spek
  • Date: 2011-02-12 18:24:24 UTC
  • mto: (2167.1.2 build) (2172.1.4 build)
  • mto: This revision was merged to the branch mainline in revision 2168.
  • Revision ID: olafvdspek@gmail.com-20110212182424-kgnm9osi7qo97at2
casts

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
 
21
 
#ifndef PLUGIN_DRIZZLE_PROTOCOL_NET_SERV_H
22
 
#define PLUGIN_DRIZZLE_PROTOCOL_NET_SERV_H
23
 
 
24
 
#include "vio.h"
25
 
 
26
 
#include <stdint.h>
27
 
 
28
 
namespace drizzle_protocol
29
 
{
30
 
 
31
 
#define LIBDRIZZLE_ERRMSG_SIZE 512
32
 
#define LIBDRIZZLE_SQLSTATE_LENGTH 5
33
 
 
34
 
typedef struct st_net {
35
 
  Vio *vio;
36
 
  unsigned char *buff,*buff_end,*write_pos,*read_pos;
37
 
  int fd;                                       /* For Perl DBI/dbd */
38
 
  /*
39
 
    The following variable is set if we are doing several queries in one
40
 
    command ( as in LOAD TABLE ... FROM MASTER ),
41
 
    and do not want to confuse the client with OK at the wrong time
42
 
  */
43
 
  unsigned long remain_in_buf,length, buf_length, where_b;
44
 
  unsigned long max_packet,max_packet_size;
45
 
  unsigned int pkt_nr,compress_pkt_nr;
46
 
  unsigned int write_timeout;
47
 
  unsigned int read_timeout;
48
 
  unsigned int retry_count;
49
 
  int fcntl;
50
 
  unsigned int *return_status;
51
 
  unsigned char reading_or_writing;
52
 
  char save_char;
53
 
  bool compress;
54
 
  /*
55
 
    Pointer to query object in query cache, do not equal NULL (0) for
56
 
    queries in cache that have not stored its results yet
57
 
  */
58
 
  /*
59
 
    Unused, please remove with the next incompatible ABI change.
60
 
  */
61
 
  unsigned char *unused;
62
 
  unsigned int last_errno;
63
 
  unsigned char error;
64
 
  /** Client library error message buffer. Actually belongs to struct MYSQL. */
65
 
  char last_error[LIBDRIZZLE_ERRMSG_SIZE];
66
 
  /** Client library sqlstate buffer. Set along with the error message. */
67
 
  char sqlstate[LIBDRIZZLE_SQLSTATE_LENGTH+1];
68
 
  void *extension;
69
 
} NET;
70
 
 
71
 
bool drizzleclient_net_init(NET *net, Vio* vio, uint32_t buffer_length);
72
 
void drizzleclient_net_end(NET *net);
73
 
void drizzleclient_net_clear(NET *net, bool clear_buffer);
74
 
bool drizzleclient_net_flush(NET *net);
75
 
bool drizzleclient_net_write(NET *net,const unsigned char *packet, size_t len);
76
 
bool drizzleclient_net_write_command(NET *net,unsigned char command,
77
 
                                     const unsigned char *header, size_t head_len,
78
 
                                     const unsigned char *packet, size_t len);
79
 
uint32_t drizzleclient_net_read(NET *net);
80
 
void drizzleclient_net_close(NET *net);
81
 
bool drizzleclient_net_init_sock(NET * net, int sock, int flags,
82
 
                                 uint32_t buffer_length);
83
 
bool drizzleclient_net_peer_addr(NET *net, char *buf, uint16_t *port, size_t buflen);
84
 
void drizzleclient_net_keepalive(NET *net, bool flag);
85
 
int drizzleclient_net_get_sd(NET *net);
86
 
bool drizzleclient_net_more_data(NET *net);
87
 
 
88
 
void drizzleclient_net_set_write_timeout(NET *net, uint32_t timeout);
89
 
void drizzleclient_net_set_read_timeout(NET *net, uint32_t timeout);
90
 
void drizzleclient_drizzleclient_net_clear_error(NET *net);
91
 
 
92
 
} /* namespace drizzle_protocol */
93
 
 
94
 
#endif /* PLUGIN_DRIZZLE_PROTOCOL_NET_SERV_H */