Drizzled Public API Documentation

vio.h
00001 /* Copyright (C) 2000 MySQL AB
00002 
00003    This program is free software; you can redistribute it and/or modify
00004    it under the terms of the GNU General Public License as published by
00005    the Free Software Foundation; version 2 of the License.
00006 
00007    This program is distributed in the hope that it will be useful,
00008    but WITHOUT ANY WARRANTY; without even the implied warranty of
00009    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010    GNU General Public License for more details.
00011 
00012    You should have received a copy of the GNU General Public License
00013    along with this program; if not, write to the Free Software
00014    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
00015 
00016 
00017 #pragma once
00018 
00019 #include <sys/socket.h>
00020 #include <cerrno>
00021 
00022 namespace drizzle_plugin {
00023 
00027 class Vio
00028 {
00029 public:
00034   Vio(int sd);
00035   ~Vio();
00036 
00041   int close();
00042 
00049   size_t read(unsigned char* buf, size_t size);
00050   
00057   size_t write(const unsigned char* buf, size_t size);
00058 
00065   int blocking(bool set_blocking_mode, bool *old_mode);
00066 
00072   int fastsend();
00073 
00079   int32_t keepalive(bool set_keep_alive);
00080 
00084   bool should_retry() const;
00085 
00089   bool was_interrupted() const;
00090 
00098   bool peer_addr(char *buf, size_t buflen, uint16_t& port) const;
00099 
00105   void timeout(bool is_sndtimeo, int32_t timeout);
00106 
00111   int get_errno() const;
00112 
00117   int get_fd() const;
00118 
00119 private:
00120   int sd;
00121   int fcntl_mode; /* Buffered fcntl(sd,F_GETFL) */
00122 };
00123 
00124 } /* namespace drizzle_plugin */
00125