~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/drizzle_protocol/drizzle_protocol.h

  • Committer: lbieber
  • Date: 2010-10-01 12:16:18 UTC
  • mfrom: (1802.1.1 fix-bug-651256)
  • Revision ID: lbieber@orisndriz08-20101001121618-uqcboygpjwbiglem
Merge Vijay - fix bug 651256 - Remove --help-extended

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
 
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2010 Brian Aker
 
4
 *  Copyright (C) 2008 Sun Microsystems
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
8
 
 *  the Free Software Foundation; either version 2 of the License, or
9
 
 *  (at your option) any later version.
 
8
 *  the Free Software Foundation; version 2 of the License.
10
9
 *
11
10
 *  This program is distributed in the hope that it will be useful,
12
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
18
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
18
 */
20
19
 
21
 
 
22
20
#ifndef PLUGIN_DRIZZLE_PROTOCOL_DRIZZLE_PROTOCOL_H
23
21
#define PLUGIN_DRIZZLE_PROTOCOL_DRIZZLE_PROTOCOL_H
24
22
 
27
25
#include <drizzled/atomics.h>
28
26
#include "drizzled/plugin/table_function.h"
29
27
 
30
 
#include "plugin/mysql_protocol/mysql_protocol.h"
 
28
#include "net_serv.h"
31
29
 
32
 
namespace drizzle_plugin
33
 
{
34
30
namespace drizzle_protocol
35
31
{
36
32
 
37
 
class ListenDrizzleProtocol: public ListenMySQLProtocol
 
33
class ListenDrizzleProtocol: public drizzled::plugin::ListenTcp
38
34
{
 
35
private:
 
36
  bool using_mysql41_protocol;
 
37
 
39
38
public:
40
 
  ListenDrizzleProtocol(std::string name, 
41
 
                        const std::string &bind_address,
42
 
                        bool using_mysql41_protocol):
43
 
    ListenMySQLProtocol(name, bind_address, using_mysql41_protocol)
 
39
  ListenDrizzleProtocol(std::string name_arg, bool using_mysql41_protocol_arg):
 
40
   drizzled::plugin::ListenTcp(name_arg),
 
41
   using_mysql41_protocol(using_mysql41_protocol_arg)
44
42
  { }
45
 
 
46
 
  ~ListenDrizzleProtocol();
47
 
  in_port_t getPort(void) const;
48
 
  static ProtocolCounters *drizzle_counters;
49
 
  virtual ProtocolCounters *getCounters(void) const { return drizzle_counters; }
50
 
  drizzled::plugin::Client *getClient(int fd);
 
43
  virtual ~ListenDrizzleProtocol();
 
44
  virtual const char* getHost(void) const;
 
45
  virtual in_port_t getPort(void) const;
 
46
  virtual drizzled::plugin::Client *getClient(int fd);
51
47
};
52
48
 
53
 
class ClientDrizzleProtocol: public ClientMySQLProtocol
 
49
class ClientDrizzleProtocol: public drizzled::plugin::Client
54
50
{
 
51
private:
 
52
  NET net;
 
53
  drizzled::String packet;
 
54
  uint32_t client_capabilities;
 
55
  bool using_mysql41_protocol;
 
56
 
 
57
  bool checkConnection(void);
 
58
  bool netStoreData(const unsigned char *from, size_t length);
 
59
  void writeEOFPacket(uint32_t server_status, uint32_t total_warn_count);
 
60
 
55
61
public:
56
 
  ClientDrizzleProtocol(int fd, ProtocolCounters *set_counters): ClientMySQLProtocol(fd, true, set_counters) {}
57
 
 
58
 
  static std::vector<std::string> drizzle_admin_ip_addresses;
59
 
  static void drizzle_compose_ip_addresses(std::vector<std::string> options);
60
 
  bool isAdminAllowed(void);
 
62
  ClientDrizzleProtocol(int fd, bool using_mysql41_protocol_arg);
 
63
  virtual ~ClientDrizzleProtocol();
 
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);
61
98
};
62
99
 
63
100
} /* namespace drizzle_protocol */
64
 
} /* namespace drizzle_plugin */
65
 
 
 
101
 
66
102
#endif /* PLUGIN_DRIZZLE_PROTOCOL_DRIZZLE_PROTOCOL_H */