~jaypipes/drizzle/proto-definitions

« back to all changes in this revision

Viewing changes to libdrizzle/net_serv.h

  • Committer: Jay Pipes
  • Date: 2008-09-25 18:13:26 UTC
  • mfrom: (352.5.30 codestyle)
  • Revision ID: jay@mysql.com-20080925181326-2z7pr377hcvf28qt
Merged in trunk and added additional definition wrappers for proto buffer messages

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
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[DRIZZLE_ERRMSG_SIZE];
 
64
  /** Client library sqlstate buffer. Set along with the error message. */
 
65
  char sqlstate[SQLSTATE_LENGTH+1];
 
66
  void *extension;
 
67
} NET;
 
68
 
 
69
  bool my_net_init(NET *net, Vio* vio);
 
70
  void my_net_local_init(NET *net);
 
71
  void net_end(NET *net);
 
72
  void net_clear(NET *net, bool clear_buffer);
 
73
  bool net_realloc(NET *net, size_t length);
 
74
  bool net_flush(NET *net);
 
75
  bool my_net_write(NET *net,const unsigned char *packet, size_t len);
 
76
  bool 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
  int32_t net_real_write(NET *net,const unsigned char *packet, size_t len);
 
80
  uint32_t my_net_read(NET *net);
 
81
  void net_close(NET *net);
 
82
  bool net_init_sock(NET * net, int sock, int flags);
 
83
  bool net_peer_addr(NET *net, char *buf, uint16_t *port, size_t buflen);
 
84
  void net_keepalive(NET *net, bool flag);
 
85
  int net_get_sd(NET *net);
 
86
  bool net_should_close(NET *net);
 
87
  bool net_more_data(NET *net);
 
88
 
 
89
  void my_net_set_write_timeout(NET *net, uint32_t timeout);
 
90
  void my_net_set_read_timeout(NET *net, uint32_t timeout);
 
91
  void net_clear_error(NET *net);
 
92
 
 
93
#ifdef __cplusplus
 
94
}
 
95
#endif
 
96
 
 
97
#endif