~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/oldlibdrizzle/oldlibdrizzle.h

  • Committer: Padraig O'Sullivan
  • Date: 2009-09-13 01:03:01 UTC
  • mto: (1126.9.2 captain-20090915-01)
  • mto: This revision was merged to the branch mainline in revision 1133.
  • Revision ID: osullivan.padraig@gmail.com-20090913010301-tcvvezipx1124acy
Added calls to the dtrace delete begin/end probes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#ifndef PLUGIN_DRIZZLE_PROTOCOL_DRIZZLE_PROTOCOL_H
21
 
#define PLUGIN_DRIZZLE_PROTOCOL_DRIZZLE_PROTOCOL_H
 
20
#ifndef DRIZZLED_PLUGIN_OLDLIBDRIZZLE_H
 
21
#define DRIZZLED_PLUGIN_OLDLIBDRIZZLE_H
22
22
 
23
 
#include <drizzled/plugin/listen_tcp.h>
24
 
#include <drizzled/plugin/client.h>
 
23
#include <drizzled/plugin/listen.h>
 
24
#include <drizzled/plugin/protocol.h>
25
25
 
26
26
#include "net_serv.h"
27
 
 
28
 
namespace drizzle_protocol
29
 
{
30
 
 
31
 
class ListenDrizzleProtocol: public drizzled::plugin::ListenTcp
 
27
#include "password.h"
 
28
 
 
29
class ListenOldLibdrizzle: public drizzled::plugin::Listen
32
30
{
33
31
private:
34
 
  bool using_mysql41_protocol;
 
32
  in_port_t port;
35
33
 
36
34
public:
37
 
  ListenDrizzleProtocol(std::string name_arg, bool using_mysql41_protocol_arg):
38
 
   drizzled::plugin::ListenTcp(name_arg),
39
 
   using_mysql41_protocol(using_mysql41_protocol_arg)
40
 
  { }
41
 
  virtual const char* getHost(void) const;
 
35
  ListenOldLibdrizzle();
 
36
  ListenOldLibdrizzle(in_port_t port_arg): port(port_arg) {}
42
37
  virtual in_port_t getPort(void) const;
43
 
  virtual drizzled::plugin::Client *getClient(int fd);
 
38
  virtual drizzled::plugin::Protocol *protocolFactory(void) const;
44
39
};
45
40
 
46
 
class ClientDrizzleProtocol: public drizzled::plugin::Client
 
41
class ProtocolOldLibdrizzle: public drizzled::plugin::Protocol
47
42
{
48
43
private:
49
44
  NET net;
50
 
  drizzled::String packet;
 
45
  Vio* save_vio;
 
46
  char scramble[SCRAMBLE_LENGTH+1];
 
47
  String *packet;
 
48
  String *convert;
 
49
  uint32_t field_pos;
 
50
  uint32_t field_count;
51
51
  uint32_t client_capabilities;
52
 
  bool using_mysql41_protocol;
 
52
  bool netStoreData(const unsigned char *from, size_t length);
53
53
 
 
54
  /**
 
55
   * Performs handshake with client and authorizes user.
 
56
   *
 
57
   * Returns true is the connection is valid and the
 
58
   * user is authorized, otherwise false.
 
59
   */  
54
60
  bool checkConnection(void);
55
 
  bool netStoreData(const unsigned char *from, size_t length);
56
 
  void writeEOFPacket(uint32_t server_status, uint32_t total_warn_count);
57
61
 
58
62
public:
59
 
  ClientDrizzleProtocol(int fd, bool using_mysql41_protocol_arg);
60
 
  virtual ~ClientDrizzleProtocol();
61
 
 
62
 
  virtual int getFileDescriptor(void);
 
63
  ProtocolOldLibdrizzle();
 
64
  ~ProtocolOldLibdrizzle();
 
65
  virtual void setSession(Session *session_arg);
63
66
  virtual bool isConnected();
 
67
  virtual void setError(char error);
 
68
  virtual bool haveError(void);
 
69
  virtual bool wasAborted(void);
 
70
  virtual bool haveMoreData(void);
64
71
  virtual bool isReading(void);
65
72
  virtual bool isWriting(void);
66
 
  virtual bool flush(void);
67
 
  virtual void close(void);
68
 
 
 
73
  virtual bool setFileDescriptor(int fd);
 
74
  virtual int fileDescriptor(void);
69
75
  virtual bool authenticate(void);
70
76
  virtual bool readCommand(char **packet, uint32_t *packet_length);
71
 
 
72
 
  virtual void sendOK(void);
73
 
  virtual void sendEOF(void);
 
77
  virtual void sendOK();
 
78
  virtual void sendEOF();
74
79
  virtual void sendError(uint32_t sql_errno, const char *err);
75
 
 
76
 
  virtual bool sendFields(drizzled::List<drizzled::Item> *list);
77
 
 
78
 
  using Client::store;
79
 
  virtual bool store(drizzled::Field *from);
 
80
  virtual void close();
 
81
  virtual void forceClose();
 
82
  virtual void prepareForResend();
 
83
  virtual void free();
 
84
  virtual bool write();
 
85
 
 
86
  virtual bool sendFields(List<Item> *list);
 
87
 
 
88
  using Protocol::store;
 
89
  virtual bool store(Field *from);
80
90
  virtual bool store(void);
81
91
  virtual bool store(int32_t from);
82
92
  virtual bool store(uint32_t from);
83
93
  virtual bool store(int64_t from);
84
94
  virtual bool store(uint64_t from);
85
 
  virtual bool store(double from, uint32_t decimals, drizzled::String *buffer);
 
95
  virtual bool store(double from, uint32_t decimals, String *buffer);
 
96
  virtual bool store(const DRIZZLE_TIME *from);
86
97
  virtual bool store(const char *from, size_t length);
87
 
 
88
 
  virtual bool haveError(void);
89
 
  virtual bool haveMoreData(void);
90
 
  virtual bool wasAborted(void);
91
98
};
92
99
 
93
 
} /* namespace drizzle_protocol */
94
 
 
95
 
#endif /* PLUGIN_DRIZZLE_PROTOCOL_DRIZZLE_PROTOCOL_H */
 
100
#endif /* DRIZZLED_PLUGIN_OLDLIBDRIZZLE_H */