~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to libdrizzle/net_serv.h

  • Committer: Brian Aker
  • Date: 2008-09-04 19:31:00 UTC
  • Revision ID: brian@tangent.org-20080904193100-l849hgghfy4urj43
Changing default character set from this point on.

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 _libdrizzle_net_serv_h_
22
 
#define _libdrizzle_net_serv_h_
23
 
 
24
 
#include <vio/violite.h>
25
 
 
26
 
#define net_new_transaction(net) ((net)->pkt_nr=0)
27
 
 
28
 
#ifdef __cplusplus
29
 
extern "C" {
30
 
#endif
31
 
 
32
 
#define LIBDRIZZLE_ERRMSG_SIZE 512
33
 
#define LIBDRIZZLE_SQLSTATE_LENGTH 5
34
 
 
35
 
typedef struct st_net {
36
 
  Vio *vio;
37
 
  unsigned char *buff,*buff_end,*write_pos,*read_pos;
38
 
  int fd;                                       /* For Perl DBI/dbd */
39
 
  /*
40
 
    The following variable is set if we are doing several queries in one
41
 
    command ( as in LOAD TABLE ... FROM MASTER ),
42
 
    and do not want to confuse the client with OK at the wrong time
43
 
  */
44
 
  unsigned long remain_in_buf,length, buf_length, where_b;
45
 
  unsigned long max_packet,max_packet_size;
46
 
  unsigned int pkt_nr,compress_pkt_nr;
47
 
  unsigned int write_timeout;
48
 
  unsigned int read_timeout;
49
 
  unsigned int retry_count;
50
 
  int fcntl;
51
 
  unsigned int *return_status;
52
 
  unsigned char reading_or_writing;
53
 
  char save_char;
54
 
  bool compress;
55
 
  /*
56
 
    Pointer to query object in query cache, do not equal NULL (0) for
57
 
    queries in cache that have not stored its results yet
58
 
  */
59
 
  /*
60
 
    Unused, please remove with the next incompatible ABI change.
61
 
  */
62
 
  unsigned char *unused;
63
 
  unsigned int last_errno;
64
 
  unsigned char error; 
65
 
  /** Client library error message buffer. Actually belongs to struct MYSQL. */
66
 
  char last_error[LIBDRIZZLE_ERRMSG_SIZE];
67
 
  /** Client library sqlstate buffer. Set along with the error message. */
68
 
  char sqlstate[LIBDRIZZLE_SQLSTATE_LENGTH+1];
69
 
  void *extension;
70
 
} NET;
71
 
 
72
 
  bool my_net_init(NET *net, Vio* vio);
73
 
  void my_net_local_init(NET *net);
74
 
  void net_end(NET *net);
75
 
  void net_clear(NET *net, bool clear_buffer);
76
 
  bool net_realloc(NET *net, size_t length);
77
 
  bool net_flush(NET *net);
78
 
  bool my_net_write(NET *net,const unsigned char *packet, size_t len);
79
 
  bool net_write_command(NET *net,unsigned char command,
80
 
                         const unsigned char *header, size_t head_len,
81
 
                         const unsigned char *packet, size_t len);
82
 
  int32_t net_real_write(NET *net,const unsigned char *packet, size_t len);
83
 
  uint32_t my_net_read(NET *net);
84
 
  void net_close(NET *net);
85
 
  bool net_init_sock(NET * net, int sock, int flags);
86
 
  bool net_peer_addr(NET *net, char *buf, uint16_t *port, size_t buflen);
87
 
  void net_keepalive(NET *net, bool flag);
88
 
  int net_get_sd(NET *net);
89
 
  bool net_should_close(NET *net);
90
 
  bool net_more_data(NET *net);
91
 
 
92
 
  void my_net_set_write_timeout(NET *net, uint32_t timeout);
93
 
  void my_net_set_read_timeout(NET *net, uint32_t timeout);
94
 
  void net_clear_error(NET *net);
95
 
 
96
 
#ifdef __cplusplus
97
 
}
98
 
#endif
99
 
 
100
 
#endif