Drizzled Public API Documentation

net_serv.h
00001 /* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
00002  *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
00003  *
00004  *  Copyright (C) 2008 Sun Microsystems, Inc.
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; version 2 of the License.
00009  *
00010  *  This program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *  GNU General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with this program; if not, write to the Free Software
00017  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
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 } /* namespace drizzle_plugin */
00062