~drizzle-trunk/drizzle/development

390.1.2 by Monty Taylor
Fixed copyright headers in drizzled/
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
 */
1 by brian
clean slate
19
1333 by Brian Aker
Fix naming issue.
20
#ifndef PLUGIN_DRIZZLE_PROTOCOL_DRIZZLE_PROTOCOL_H
21
#define PLUGIN_DRIZZLE_PROTOCOL_DRIZZLE_PROTOCOL_H
1 by brian
clean slate
22
971.6.7 by Eric Day
Reworked listen interface to not require binding of TCP ports.
23
#include <drizzled/plugin/listen_tcp.h>
971.6.1 by Eric Day
Renamed Protocol to Client, cleaned up some unnecessary methods along the way.
24
#include <drizzled/plugin/client.h>
971.3.16 by Eric Day
Cleaned up Protocol plugin interface (now a class factory) and moved libdrizzlclient to oldlibdrizzle to be clear.
25
971.3.14 by Eric Day
Created Protocol plugin interface and changed libdrizzleclient to be a plugin.
26
#include "net_serv.h"
584.1.14 by Monty Taylor
Removed field.h from common_includes.
27
1300.5.1 by Monty Taylor
Put drizzle_protocol plugin in to its own namespace so that symbols won't
28
namespace drizzle_protocol
29
{
30
971.7.10 by Eric Day
Duplicated oldlibdrizzle module, one for Drizzle protocol and one for MySQL, per Brian's request from merge proposal. Port options are now --drizzle-protocol-port and --mysql-protocol-port.
31
class ListenDrizzleProtocol: public drizzled::plugin::ListenTcp
971.3.48 by Eric Day
New Listen interface about done, not quite compiling yet, but need a backup.
32
{
971.7.8 by Eric Day
Moved port options into protocol plugin and added MySQL protocol support.
33
private:
971.7.9 by Eric Day
Renamed mysql protocol variable from Jay's suggestion.
34
  bool using_mysql41_protocol;
971.7.8 by Eric Day
Moved port options into protocol plugin and added MySQL protocol support.
35
971.3.48 by Eric Day
New Listen interface about done, not quite compiling yet, but need a backup.
36
public:
971.7.10 by Eric Day
Duplicated oldlibdrizzle module, one for Drizzle protocol and one for MySQL, per Brian's request from merge proposal. Port options are now --drizzle-protocol-port and --mysql-protocol-port.
37
  ListenDrizzleProtocol(std::string name_arg, bool using_mysql41_protocol_arg):
971.7.9 by Eric Day
Renamed mysql protocol variable from Jay's suggestion.
38
   drizzled::plugin::ListenTcp(name_arg),
39
   using_mysql41_protocol(using_mysql41_protocol_arg)
1130.2.3 by Monty Taylor
Made Listen into a Plugin.
40
  { }
971.7.1 by Eric Day
Client/Listen cleanup, moved globals, console plugin cleanup.
41
  virtual const char* getHost(void) const;
971.3.51 by Eric Day
Finished up new Listen plugin interface.
42
  virtual in_port_t getPort(void) const;
971.6.7 by Eric Day
Reworked listen interface to not require binding of TCP ports.
43
  virtual drizzled::plugin::Client *getClient(int fd);
971.3.48 by Eric Day
New Listen interface about done, not quite compiling yet, but need a backup.
44
};
45
971.7.10 by Eric Day
Duplicated oldlibdrizzle module, one for Drizzle protocol and one for MySQL, per Brian's request from merge proposal. Port options are now --drizzle-protocol-port and --mysql-protocol-port.
46
class ClientDrizzleProtocol: public drizzled::plugin::Client
1 by brian
clean slate
47
{
971.3.12 by Eric Day
Started abstracting Protocol, removed init_connect, init_file.
48
private:
971.3.8 by Eric Day
Moved NET to Protocol. libdrizzleclient is now completely isolated, need to start reworking Protocol now.
49
  NET net;
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
50
  drizzled::String packet;
971.3.59 by Eric Day
Removed client_capabilities from session and pushed functionality into protocol plugin.
51
  uint32_t client_capabilities;
971.7.9 by Eric Day
Renamed mysql protocol variable from Jay's suggestion.
52
  bool using_mysql41_protocol;
971.7.1 by Eric Day
Client/Listen cleanup, moved globals, console plugin cleanup.
53
54
  bool checkConnection(void);
971.3.12 by Eric Day
Started abstracting Protocol, removed init_connect, init_file.
55
  bool netStoreData(const unsigned char *from, size_t length);
971.7.1 by Eric Day
Client/Listen cleanup, moved globals, console plugin cleanup.
56
  void writeEOFPacket(uint32_t server_status, uint32_t total_warn_count);
971.3.6 by Eric Day
Moved the last of the libdrizzleclient calls into Protocol.
57
1 by brian
clean slate
58
public:
971.7.10 by Eric Day
Duplicated oldlibdrizzle module, one for Drizzle protocol and one for MySQL, per Brian's request from merge proposal. Port options are now --drizzle-protocol-port and --mysql-protocol-port.
59
  ClientDrizzleProtocol(int fd, bool using_mysql41_protocol_arg);
60
  virtual ~ClientDrizzleProtocol();
971.7.1 by Eric Day
Client/Listen cleanup, moved globals, console plugin cleanup.
61
971.6.1 by Eric Day
Renamed Protocol to Client, cleaned up some unnecessary methods along the way.
62
  virtual int getFileDescriptor(void);
971.3.12 by Eric Day
Started abstracting Protocol, removed init_connect, init_file.
63
  virtual bool isConnected();
971.6.1 by Eric Day
Renamed Protocol to Client, cleaned up some unnecessary methods along the way.
64
  virtual bool isReading(void);
65
  virtual bool isWriting(void);
971.7.1 by Eric Day
Client/Listen cleanup, moved globals, console plugin cleanup.
66
  virtual bool flush(void);
67
  virtual void close(void);
68
971.3.6 by Eric Day
Moved the last of the libdrizzleclient calls into Protocol.
69
  virtual bool authenticate(void);
971.3.19 by Eric Day
Finished first pass at Protocol cleanup, still some things to remove but they are a bit more involved.
70
  virtual bool readCommand(char **packet, uint32_t *packet_length);
971.7.1 by Eric Day
Client/Listen cleanup, moved globals, console plugin cleanup.
71
72
  virtual void sendOK(void);
73
  virtual void sendEOF(void);
971.3.12 by Eric Day
Started abstracting Protocol, removed init_connect, init_file.
74
  virtual void sendError(uint32_t sql_errno, const char *err);
971.3.19 by Eric Day
Finished first pass at Protocol cleanup, still some things to remove but they are a bit more involved.
75
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
76
  virtual bool sendFields(drizzled::List<drizzled::Item> *list);
971.3.17 by Eric Day
Cleaned up int/date related store functions.
77
971.6.1 by Eric Day
Renamed Protocol to Client, cleaned up some unnecessary methods along the way.
78
  using Client::store;
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
79
  virtual bool store(drizzled::Field *from);
971.3.17 by Eric Day
Cleaned up int/date related store functions.
80
  virtual bool store(void);
81
  virtual bool store(int32_t from);
82
  virtual bool store(uint32_t from);
83
  virtual bool store(int64_t from);
84
  virtual bool store(uint64_t from);
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
85
  virtual bool store(double from, uint32_t decimals, drizzled::String *buffer);
1054.2.9 by Monty Taylor
Removed CHARSET_INFO stuff from protocol plugin interface - it makes no sense.
86
  virtual bool store(const char *from, size_t length);
971.7.1 by Eric Day
Client/Listen cleanup, moved globals, console plugin cleanup.
87
88
  virtual bool haveError(void);
89
  virtual bool haveMoreData(void);
90
  virtual bool wasAborted(void);
1 by brian
clean slate
91
};
92
1320.2.1 by Monty Taylor
Merged in drizzle_protocol namespace change.
93
} /* namespace drizzle_protocol */
1300.5.1 by Monty Taylor
Put drizzle_protocol plugin in to its own namespace so that symbols won't
94
1333 by Brian Aker
Fix naming issue.
95
#endif /* PLUGIN_DRIZZLE_PROTOCOL_DRIZZLE_PROTOCOL_H */