Drizzled Public API Documentation

vio.h
1 /* Copyright (C) 2000 MySQL AB
2 
3  This program is free software; you can redistribute it and/or modify
4  it under the terms of the GNU General Public License as published by
5  the Free Software Foundation; version 2 of the License.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  GNU General Public License for more details.
11 
12  You should have received a copy of the GNU General Public License
13  along with this program; if not, write to the Free Software
14  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
15 
16 
17 #pragma once
18 
19 #include <sys/socket.h>
20 #include <cerrno>
21 
22 namespace drizzle_plugin {
23 
27 class Vio
28 {
29 public:
34  Vio(int sd);
35  ~Vio();
36 
41  int close();
42 
49  size_t read(unsigned char* buf, size_t size);
50 
57  size_t write(const unsigned char* buf, size_t size);
58 
65  int blocking(bool set_blocking_mode, bool *old_mode);
66 
72  int fastsend();
73 
79  int32_t keepalive(bool set_keep_alive);
80 
84  bool should_retry() const;
85 
89  bool was_interrupted() const;
90 
98  bool peer_addr(char *buf, size_t buflen, uint16_t& port) const;
99 
105  void timeout(bool is_sndtimeo, int32_t timeout);
106 
111  int get_errno() const;
112 
117  int get_fd() const;
118 
119 private:
120  int sd;
121  int fcntl_mode; /* Buffered fcntl(sd,F_GETFL) */
122 };
123 
124 } /* namespace drizzle_plugin */
125 
int32_t keepalive(bool set_keep_alive)
Definition: vio.cc:129
int get_fd() const
Definition: vio.cc:194
bool was_interrupted() const
Definition: vio.cc:147
int blocking(bool set_blocking_mode, bool *old_mode)
Definition: vio.cc:92
bool should_retry() const
Definition: vio.cc:141
Virtual I/O layer, only used with TCP/IP sockets at the moment.
Definition: vio.h:27
int fastsend()
Definition: vio.cc:120
int get_errno() const
Definition: vio.cc:189
void timeout(bool is_sndtimeo, int32_t timeout)
Definition: vio.cc:172
size_t read(unsigned char *buf, size_t size)
Definition: vio.cc:82
size_t write(const unsigned char *buf, size_t size)
Definition: vio.cc:87
Vio(int sd)
Definition: vio.cc:45
bool peer_addr(char *buf, size_t buflen, uint16_t &port) const
Definition: vio.cc:153