~drizzle-trunk/drizzle/development

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
2234 by Brian Aker
Mass removal of ifdef/endif in favor of pragma once.
21
#pragma once
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.
22
23
#include "vio.h"
24
25
#define LIBDRIZZLE_ERRMSG_SIZE 512
26
#define LIBDRIZZLE_SQLSTATE_LENGTH 5
27
2318.2.21 by Olaf van der Spek
Refactor
28
namespace drizzle_plugin {
29
2318.2.30 by Olaf van der Spek
Refactor
30
class NET
1964.2.9 by Monty Taylor
All protocol stuff except for the buffer_length. WTF?
31
{
2318.2.30 by Olaf van der Spek
Refactor
32
public:
33
  Vio* vio;
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.
34
  unsigned char *buff,*buff_end,*write_pos,*read_pos;
35
  unsigned long remain_in_buf,length, buf_length, where_b;
36
  unsigned long max_packet,max_packet_size;
37
  unsigned int pkt_nr,compress_pkt_nr;
2318.2.30 by Olaf van der Spek
Refactor
38
  unsigned int write_timeout_;
39
  unsigned int read_timeout_;
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.
40
  unsigned int retry_count;
41
  char save_char;
42
  bool compress;
43
  unsigned int last_errno;
2318.2.34 by Olaf van der Spek
Refactor
44
  unsigned char error_;
2318.2.30 by Olaf van der Spek
Refactor
45
2318.2.35 by Olaf van der Spek
Refactor
46
  void init(int sock, uint32_t buffer_length);
2318.2.34 by Olaf van der Spek
Refactor
47
  bool flush();
48
  void end();
2318.2.33 by Olaf van der Spek
Refactor
49
  void close();
50
  bool peer_addr(char *buf, size_t buflen, uint16_t&);
2318.2.32 by Olaf van der Spek
Refactor
51
  void keepalive(bool flag);
52
  int get_sd() const;
2318.2.30 by Olaf van der Spek
Refactor
53
  void set_write_timeout(uint32_t timeout);
54
  void set_read_timeout(uint32_t timeout);
2318.2.36 by Olaf van der Spek
Refactor
55
  bool write(const void*, size_t);
2385.2.11 by Olaf van der Spek
Use data_ref
56
  bool write_command(unsigned char command, data_ref header, data_ref body);
2318.2.36 by Olaf van der Spek
Refactor
57
  uint32_t read();
2318.2.30 by Olaf van der Spek
Refactor
58
};
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.
59
1964.2.9 by Monty Taylor
All protocol stuff except for the buffer_length. WTF?
60
61
} /* 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.
62