~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to plugin/mysql_protocol/net_serv.h

  • Committer: Package Import Robot
  • Author(s): Clint Byrum
  • Date: 2012-06-19 10:46:49 UTC
  • mfrom: (1.1.6)
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20120619104649-e2l0ggd4oz3um0f4
Tags: upstream-7.1.36-stable
ImportĀ upstreamĀ versionĀ 7.1.36-stable

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
#define LIBDRIZZLE_ERRMSG_SIZE 512
26
26
#define LIBDRIZZLE_SQLSTATE_LENGTH 5
27
27
 
28
 
namespace drizzle_plugin
 
28
namespace drizzle_plugin {
 
29
 
 
30
class NET
29
31
{
30
 
 
31
 
typedef struct st_net {
32
 
  Vio *vio;
 
32
public:
 
33
  Vio* vio;
33
34
  unsigned char *buff,*buff_end,*write_pos,*read_pos;
34
 
  int fd;                                       /* For Perl DBI/dbd */
35
 
  /*
36
 
    The following variable is set if we are doing several queries in one
37
 
    command ( as in LOAD TABLE ... FROM MASTER ),
38
 
    and do not want to confuse the client with OK at the wrong time
39
 
  */
40
35
  unsigned long remain_in_buf,length, buf_length, where_b;
41
36
  unsigned long max_packet,max_packet_size;
42
37
  unsigned int pkt_nr,compress_pkt_nr;
43
 
  unsigned int write_timeout;
44
 
  unsigned int read_timeout;
 
38
  unsigned int write_timeout_;
 
39
  unsigned int read_timeout_;
45
40
  unsigned int retry_count;
46
 
  int fcntl;
47
 
  unsigned int *return_status;
48
 
  unsigned char reading_or_writing;
49
41
  char save_char;
50
42
  bool compress;
51
 
  /*
52
 
    Pointer to query object in query cache, do not equal NULL (0) for
53
 
    queries in cache that have not stored its results yet
54
 
  */
55
 
  /*
56
 
    Unused, please remove with the next incompatible ABI change.
57
 
  */
58
 
  unsigned char *unused;
59
43
  unsigned int last_errno;
60
 
  unsigned char error;
61
 
  /** Client library error message buffer. Actually belongs to struct MYSQL. */
62
 
  char last_error[LIBDRIZZLE_ERRMSG_SIZE];
63
 
  /** Client library sqlstate buffer. Set along with the error message. */
64
 
  char sqlstate[LIBDRIZZLE_SQLSTATE_LENGTH+1];
65
 
  void *extension;
66
 
} NET;
67
 
 
68
 
bool drizzleclient_net_init(NET *net, Vio* vio, uint32_t buffer_length);
69
 
void drizzleclient_net_end(NET *net);
70
 
void drizzleclient_net_clear(NET *net, bool clear_buffer);
71
 
bool drizzleclient_net_flush(NET *net);
72
 
bool drizzleclient_net_write(NET *net,const unsigned char *packet, size_t len);
73
 
bool drizzleclient_net_write_command(NET *net,unsigned char command,
74
 
                                     const unsigned char *header, size_t head_len,
75
 
                                     const unsigned char *packet, size_t len);
76
 
uint32_t drizzleclient_net_read(NET *net);
77
 
void drizzleclient_net_close(NET *net);
78
 
bool drizzleclient_net_init_sock(NET * net, int sock, uint32_t buffer_length);
79
 
bool drizzleclient_net_peer_addr(NET *net, char *buf, uint16_t *port, size_t buflen);
80
 
void drizzleclient_net_keepalive(NET *net, bool flag);
81
 
int drizzleclient_net_get_sd(NET *net);
82
 
bool drizzleclient_net_more_data(NET *net);
83
 
 
84
 
void drizzleclient_net_set_write_timeout(NET *net, uint32_t timeout);
85
 
void drizzleclient_net_set_read_timeout(NET *net, uint32_t timeout);
86
 
void drizzleclient_drizzleclient_net_clear_error(NET *net);
 
44
  unsigned char error_;
 
45
 
 
46
  void init(int sock, uint32_t buffer_length);
 
47
  bool flush();
 
48
  void end();
 
49
  void close();
 
50
  bool peer_addr(char *buf, size_t buflen, uint16_t&);
 
51
  void keepalive(bool flag);
 
52
  int get_sd() const;
 
53
  void set_write_timeout(uint32_t timeout);
 
54
  void set_read_timeout(uint32_t timeout);
 
55
  bool write(const void*, size_t);
 
56
  bool write_command(unsigned char command, data_ref header, data_ref body);
 
57
  uint32_t read();
 
58
};
 
59
 
87
60
 
88
61
} /* namespace drizzle_plugin */
89
62