~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/mysql_protocol/vio.h

  • Committer: Olaf van der Spek
  • Date: 2011-06-24 13:24:06 UTC
  • mto: This revision was merged to the branch mainline in revision 2349.
  • Revision ID: olafvdspek@gmail.com-20110624132406-xf8cq0hcel3kw2uj
Refactor

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
15
15
 
16
16
 
17
 
#ifndef PLUGIN_MYSQL_PROTOCOL_VIO_H
18
 
#define PLUGIN_MYSQL_PROTOCOL_VIO_H
 
17
#pragma once
19
18
 
20
19
#include <sys/socket.h>
21
20
#include <cerrno>
22
21
 
23
 
namespace drizzle_plugin
24
 
{
 
22
namespace drizzle_plugin {
25
23
 
26
24
/**
27
25
 *@brief Virtual I/O layer, only used with TCP/IP sockets at the moment.
97
95
   @param[in] buflen Size of buf.
98
96
   @returns True on success, false otherwise.
99
97
   */
100
 
  bool peer_addr(char *buf, uint16_t *port, size_t buflen) const;
 
98
  bool peer_addr(char *buf, size_t buflen, uint16_t& port) const;
101
99
 
102
100
  /**
103
101
   * Sets either the send, or recieve timeouts for the socket.
118
116
   */
119
117
  int get_fd() const;
120
118
 
121
 
  /**
122
 
   * Returns the current read position.
123
 
   */
124
 
  char *get_read_pos() const;
125
 
 
126
 
  /**
127
 
   * Returns the current write position.
128
 
   */
129
 
  char *get_read_end() const;
130
 
 
131
119
private:
132
 
  bool closed;
133
120
  int sd;
134
121
  int fcntl_mode; /* Buffered fcntl(sd,F_GETFL) */
135
 
  struct sockaddr_storage local; /* Local internet address */
136
 
  struct sockaddr_storage remote; /* Remote internet address */
137
 
  char *read_pos; /* start of unfetched data in the read buffer */
138
 
  char *read_end; /* end of unfetched data */
139
 
 
140
122
};
141
123
 
142
124
} /* namespace drizzle_plugin */
143
125
 
144
 
#endif /* PLUGIN_MYSQL_PROTOCOL_VIO_H */