~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/mysql_protocol/mysql_protocol.h

  • Committer: Monty Taylor
  • Date: 2008-10-16 09:12:23 UTC
  • mto: (511.1.6 codestyle)
  • mto: This revision was merged to the branch mainline in revision 521.
  • Revision ID: monty@inaugust.com-20081016091223-17ngih0qu9vssjs3
We pass -Wunused-macros now!

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems
5
 
 *
6
 
 *  This program is free software; you can redistribute it and/or modify
7
 
 *  it under the terms of the GNU General Public License as published by
8
 
 *  the Free Software Foundation; version 2 of the License.
9
 
 *
10
 
 *  This program is distributed in the hope that it will be useful,
11
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
 *  GNU General Public License for more details.
14
 
 *
15
 
 *  You should have received a copy of the GNU General Public License
16
 
 *  along with this program; if not, write to the Free Software
17
 
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
 
 */
19
 
 
20
 
#ifndef PLUGIN_MYSQL_PROTOCOL_MYSQL_PROTOCOL_H
21
 
#define PLUGIN_MYSQL_PROTOCOL_MYSQL_PROTOCOL_H
22
 
 
23
 
#include <drizzled/plugin/listen_tcp.h>
24
 
#include <drizzled/plugin/client.h>
25
 
#include <drizzled/atomics.h>
26
 
#include "drizzled/plugin/table_function.h"
27
 
 
28
 
#include "net_serv.h"
29
 
 
30
 
class ListenMySQLProtocol: public drizzled::plugin::ListenTcp
31
 
{
32
 
private:
33
 
  bool using_mysql41_protocol;
34
 
  static drizzled::plugin::TableFunction* status_table_function_ptr;
35
 
 
36
 
public:
37
 
  ListenMySQLProtocol(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 ~ListenMySQLProtocol();
42
 
  virtual const char* getHost(void) const;
43
 
  virtual in_port_t getPort(void) const;
44
 
  virtual drizzled::plugin::Client *getClient(int fd);
45
 
};
46
 
 
47
 
class ClientMySQLProtocol: public drizzled::plugin::Client
48
 
{
49
 
private:
50
 
  NET net;
51
 
  drizzled::String packet;
52
 
  uint32_t client_capabilities;
53
 
  bool using_mysql41_protocol;
54
 
 
55
 
  bool checkConnection(void);
56
 
  bool netStoreData(const unsigned char *from, size_t length);
57
 
  void writeEOFPacket(uint32_t server_status, uint32_t total_warn_count);
58
 
  unsigned char *storeLength(unsigned char *packet, uint64_t length);
59
 
  void makeScramble(char *scramble);
60
 
 
61
 
public:
62
 
  ClientMySQLProtocol(int fd, bool using_mysql41_protocol_arg);
63
 
  virtual ~ClientMySQLProtocol();
64
 
 
65
 
  static drizzled::atomic<uint64_t> connectionCount;
66
 
  static drizzled::atomic<uint64_t> failedConnections;
67
 
  static drizzled::atomic<uint64_t> connected;
68
 
 
69
 
  virtual int getFileDescriptor(void);
70
 
  virtual bool isConnected();
71
 
  virtual bool isReading(void);
72
 
  virtual bool isWriting(void);
73
 
  virtual bool flush(void);
74
 
  virtual void close(void);
75
 
 
76
 
  virtual bool authenticate(void);
77
 
  virtual bool readCommand(char **packet, uint32_t *packet_length);
78
 
 
79
 
  virtual void sendOK(void);
80
 
  virtual void sendEOF(void);
81
 
  virtual void sendError(uint32_t sql_errno, const char *err);
82
 
 
83
 
  virtual bool sendFields(drizzled::List<drizzled::Item> *list);
84
 
 
85
 
  using Client::store;
86
 
  virtual bool store(drizzled::Field *from);
87
 
  virtual bool store(void);
88
 
  virtual bool store(int32_t from);
89
 
  virtual bool store(uint32_t from);
90
 
  virtual bool store(int64_t from);
91
 
  virtual bool store(uint64_t from);
92
 
  virtual bool store(double from, uint32_t decimals, drizzled::String *buffer);
93
 
  virtual bool store(const char *from, size_t length);
94
 
 
95
 
  virtual bool haveError(void);
96
 
  virtual bool haveMoreData(void);
97
 
  virtual bool wasAborted(void);
98
 
};
99
 
 
100
 
#endif /* PLUGIN_MYSQL_PROTOCOL_MYSQL_PROTOCOL_H */