00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #pragma once
00022
00023 #include "vio.h"
00024
00025 #define LIBDRIZZLE_ERRMSG_SIZE 512
00026 #define LIBDRIZZLE_SQLSTATE_LENGTH 5
00027
00028 namespace drizzle_plugin {
00029
00030 class NET
00031 {
00032 public:
00033 Vio* vio;
00034 unsigned char *buff,*buff_end,*write_pos,*read_pos;
00035 unsigned long remain_in_buf,length, buf_length, where_b;
00036 unsigned long max_packet,max_packet_size;
00037 unsigned int pkt_nr,compress_pkt_nr;
00038 unsigned int write_timeout_;
00039 unsigned int read_timeout_;
00040 unsigned int retry_count;
00041 char save_char;
00042 bool compress;
00043 unsigned int last_errno;
00044 unsigned char error_;
00045
00046 void init(int sock, uint32_t buffer_length);
00047 bool flush();
00048 void end();
00049 void close();
00050 bool peer_addr(char *buf, size_t buflen, uint16_t&);
00051 void keepalive(bool flag);
00052 int get_sd() const;
00053 void set_write_timeout(uint32_t timeout);
00054 void set_read_timeout(uint32_t timeout);
00055 bool write(const void*, size_t);
00056 bool write_command(unsigned char command, data_ref header, data_ref body);
00057 uint32_t read();
00058 };
00059
00060
00061 }
00062