~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/protocol.h

Moved NET to Protocol. libdrizzleclient is now completely isolated, need to start reworking Protocol now.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
#include <drizzled/sql_list.h>
24
24
#include <drizzled/item.h>
25
 
#include <libdrizzleclient/password.h>     // rand_struct
 
25
#include <libdrizzleclient/net_serv.h>
 
26
#include <libdrizzleclient/password.h>
26
27
 
27
28
class Field;
28
29
class String;
37
38
class Protocol
38
39
{
39
40
protected:
40
 
  Session        *session;
 
41
  Session *session;
 
42
  NET net;
41
43
  String *packet;
42
44
  String *convert;
43
45
  uint32_t field_pos;
61
63
  void set_retry_count(uint32_t count);
62
64
  void set_error(char error);
63
65
  bool have_error(void);
 
66
  bool was_aborted(void);
64
67
  bool have_compression(void);
 
68
  void enable_compression(void);
65
69
  bool have_more_data(void);
 
70
  bool is_reading(void);
 
71
  bool is_writing(void);
66
72
  void disable_results(void);
67
73
  void enable_results(void);
68
74
 
72
78
                           uint64_t seed2 __attribute__ ((unused))) {};
73
79
  virtual bool authenticate(void)=0;
74
80
  virtual bool read_command(char **packet, uint32_t *packet_length)=0;
 
81
  virtual void send_error(uint32_t sql_errno, const char *err)=0;
 
82
  virtual void send_error_packet(uint32_t sql_errno, const char *err)=0;
75
83
  virtual void close(void) {};
76
84
 
77
85
  enum { SEND_NUM_ROWS= 1, SEND_DEFAULTS= 2, SEND_EOF= 4 };
153
161
  virtual void init_random(uint64_t seed1, uint64_t seed2);
154
162
  virtual bool authenticate(void);
155
163
  virtual bool read_command(char **packet, uint32_t *packet_length);
 
164
  virtual void send_error(uint32_t sql_errno, const char *err);
 
165
  virtual void send_error_packet(uint32_t sql_errno, const char *err);
156
166
  virtual void close(void);
157
167
  virtual void prepare_for_resend();
158
168
  virtual bool store(I_List<i_string> *str_list)
193
203
  virtual enum enum_protocol_type type() { return PROTOCOL_TEXT; };
194
204
};
195
205
 
196
 
void send_warning(Session *session, uint32_t sql_errno, const char *err=0);
197
 
void net_send_error(Session *session, uint32_t sql_errno=0, const char *err=0);
198
 
unsigned char *net_store_data(unsigned char *to,const unsigned char *from, size_t length);
199
 
unsigned char *net_store_data(unsigned char *to,int32_t from);
200
 
unsigned char *net_store_data(unsigned char *to,int64_t from);
201
 
 
202
 
#define net_new_transaction(net) ((net)->pkt_nr=0)
203
 
 
204
206
#endif /* DRIZZLED_PROTOCOL_H */