drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
net_serv.h
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#pragma once
22
23#include "vio.h"
24
25#define LIBDRIZZLE_ERRMSG_SIZE 512
26#define LIBDRIZZLE_SQLSTATE_LENGTH 5
27
28namespace drizzle_plugin {
29
30class NET
31{
32public:
33 Vio* vio;
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;
38 unsigned int write_timeout_;
39 unsigned int read_timeout_;
40 unsigned int retry_count;
41 char save_char;
42 bool compress;
43 unsigned int last_errno;
44 unsigned char error_;
45
46 void init(int sock, uint32_t buffer_length);
47 bool flush();
48 void end();
49 void close();
50 bool peer_addr(char *buf, size_t buflen, uint16_t&);
51 void keepalive(bool flag);
52 int get_sd() const;
53 void set_write_timeout(uint32_t timeout);
54 void set_read_timeout(uint32_t timeout);
55 bool write(const void*, size_t);
56 bool write_command(unsigned char command, data_ref header, data_ref body);
57 uint32_t read();
58};
59
60
61} /* namespace drizzle_plugin */
62
void init(int sock, uint32_t buffer_length)
Definition net_serv.cc:69
Virtual I/O layer, only used with TCP/IP sockets at the moment.
Definition vio.h:28